-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstrument.h
More file actions
35 lines (28 loc) · 776 Bytes
/
Copy pathinstrument.h
File metadata and controls
35 lines (28 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef INSTRUMENT_H_INCLUDED
#define INSTRUMENT_H_INCLUDED
struct envelope {
int attack;
int decay;
double sustain;
int release;
// https://en.wikipedia.org/wiki/Envelope_(music)
// times are in 1/44100 second intervals
// attack is the time until full volume (plus 1, i.e. 1 represents 0)
// decay is the time from full volume until sustain volume
// sustain is the volume during sustain. If sustain is 0.0, the note ends after decay
// release is the time from release to no volume
};
static const struct envelope default_envelope = {
44,
22050,
0.5,
4410,
};
struct instrument {
int count;
double *amplitudes;
double fullamplitude;
struct envelope envelope;
};
extern const struct instrument instruments[128];
#endif // ndef INSTRUMENT_H_INCLUDED