Load soundfont samples into an ALbuffer
[openal-soft.git] / OpenAL32 / Include / alMidi.h
blob03aa8253677cb6b2be74fb853907cd18eadcdcd0
1 #ifndef ALMIDI_H
2 #define ALMIDI_H
4 #include "alMain.h"
5 #include "atomic.h"
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 typedef struct ALsfmodulator {
12 struct {
13 ALenum Input;
14 ALenum Type;
15 ALenum Form;
16 } Source[2];
17 ALint Amount;
18 ALenum TransformOp;
19 ALenum Dest;
20 } ALsfmodulator;
22 typedef struct ALenvelope {
23 ALint DelayTime;
24 ALint AttackTime;
25 ALint HoldTime;
26 ALint DecayTime;
27 ALint SustainAttn;
28 ALint ReleaseTime;
29 ALint KeyToHoldTime;
30 ALint KeyToDecayTime;
31 } ALenvelope;
34 typedef struct ALfontsound {
35 RefCount ref;
37 struct ALbuffer *Buffer;
39 ALint MinKey, MaxKey;
40 ALint MinVelocity, MaxVelocity;
42 ALint ModLfoToPitch;
43 ALint VibratoLfoToPitch;
44 ALint ModEnvToPitch;
46 ALint FilterCutoff;
47 ALint FilterQ;
48 ALint ModLfoToFilterCutoff;
49 ALint ModEnvToFilterCutoff;
50 ALint ModLfoToVolume;
52 ALint ChorusSend;
53 ALint ReverbSend;
55 ALint Pan;
57 struct {
58 ALint Delay;
59 ALint Frequency;
60 } ModLfo;
61 struct {
62 ALint Delay;
63 ALint Frequency;
64 } VibratoLfo;
66 ALenvelope ModEnv;
67 ALenvelope VolEnv;
69 ALint Attenuation;
71 ALint CoarseTuning;
72 ALint FineTuning;
74 ALenum LoopMode;
76 ALint TuningScale;
78 ALint ExclusiveClass;
80 ALuint Start;
81 ALuint End;
82 ALuint LoopStart;
83 ALuint LoopEnd;
84 ALuint SampleRate;
85 ALubyte PitchKey;
86 ALbyte PitchCorrection;
87 ALenum SampleType;
88 struct ALfontsound *Link;
90 UIntMap ModulatorMap;
92 ALuint id;
93 } ALfontsound;
95 void ALfontsound_Destruct(ALfontsound *self);
96 void ALfontsound_setPropi(ALfontsound *self, ALCcontext *context, ALenum param, ALint value);
97 void ALfontsound_setModStagei(ALfontsound *self, ALCcontext *context, ALsizei stage, ALenum param, ALint value);
99 ALfontsound *NewFontsound(ALCcontext *context);
101 inline struct ALfontsound *LookupFontsound(ALCdevice *device, ALuint id)
102 { return (struct ALfontsound*)LookupUIntMapKey(&device->FontsoundMap, id); }
103 inline struct ALfontsound *RemoveFontsound(ALCdevice *device, ALuint id)
104 { return (struct ALfontsound*)RemoveUIntMapKey(&device->FontsoundMap, id); }
106 inline struct ALsfmodulator *LookupModulator(ALfontsound *sound, ALuint id)
107 { return (struct ALsfmodulator*)LookupUIntMapKey(&sound->ModulatorMap, id); }
108 inline struct ALsfmodulator *RemoveModulator(ALfontsound *sound, ALuint id)
109 { return (struct ALsfmodulator*)RemoveUIntMapKey(&sound->ModulatorMap, id); }
111 void ReleaseALFontsounds(ALCdevice *device);
114 typedef struct ALsfpreset {
115 RefCount ref;
117 ALint Preset; /* a.k.a. MIDI program number */
118 ALint Bank; /* MIDI bank 0...127, or percussion (bank 128) */
120 ALfontsound **Sounds;
121 ALsizei NumSounds;
123 ALuint id;
124 } ALsfpreset;
126 ALsfpreset *NewPreset(ALCcontext *context);
127 void DeletePreset(ALsfpreset *preset, ALCdevice *device);
129 inline struct ALsfpreset *LookupPreset(ALCdevice *device, ALuint id)
130 { return (struct ALsfpreset*)LookupUIntMapKey(&device->PresetMap, id); }
131 inline struct ALsfpreset *RemovePreset(ALCdevice *device, ALuint id)
132 { return (struct ALsfpreset*)RemoveUIntMapKey(&device->PresetMap, id); }
134 void ReleaseALPresets(ALCdevice *device);
137 typedef struct ALsoundfont {
138 RefCount ref;
140 ALsfpreset **Presets;
141 ALsizei NumPresets;
143 RWLock Lock;
145 ALuint id;
146 } ALsoundfont;
148 void ALsoundfont_Construct(ALsoundfont *self);
149 void ALsoundfont_Destruct(ALsoundfont *self);
150 ALsoundfont *ALsoundfont_getDefSoundfont(ALCcontext *context);
151 void ALsoundfont_deleteSoundfont(ALsoundfont *self, ALCdevice *device);
153 inline struct ALsoundfont *LookupSfont(ALCdevice *device, ALuint id)
154 { return (struct ALsoundfont*)LookupUIntMapKey(&device->SfontMap, id); }
155 inline struct ALsoundfont *RemoveSfont(ALCdevice *device, ALuint id)
156 { return (struct ALsoundfont*)RemoveUIntMapKey(&device->SfontMap, id); }
158 void ReleaseALSoundfonts(ALCdevice *device);
160 #ifdef __cplusplus
162 #endif
164 #endif /* ALMIDI_H */