Move atomic method definitions to a separate common source
[openal-soft.git] / OpenAL32 / Include / alMidi.h
blob24e6675f6e44d808da0d4920b1085a3c2e392291
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 volatile RefCount ref;
37 ALint MinKey, MaxKey;
38 ALint MinVelocity, MaxVelocity;
40 ALint ModLfoToPitch;
41 ALint VibratoLfoToPitch;
42 ALint ModEnvToPitch;
44 ALint FilterCutoff;
45 ALint FilterQ;
46 ALint ModLfoToFilterCutoff;
47 ALint ModEnvToFilterCutoff;
48 ALint ModLfoToVolume;
50 ALint ChorusSend;
51 ALint ReverbSend;
53 ALint Pan;
55 struct {
56 ALint Delay;
57 ALint Frequency;
58 } ModLfo;
59 struct {
60 ALint Delay;
61 ALint Frequency;
62 } VibratoLfo;
64 ALenvelope ModEnv;
65 ALenvelope VolEnv;
67 ALint Attenuation;
69 ALint CoarseTuning;
70 ALint FineTuning;
72 ALenum LoopMode;
74 ALint TuningScale;
76 ALint ExclusiveClass;
78 ALuint Start;
79 ALuint End;
80 ALuint LoopStart;
81 ALuint LoopEnd;
82 ALuint SampleRate;
83 ALubyte PitchKey;
84 ALbyte PitchCorrection;
85 ALenum SampleType;
86 struct ALfontsound *Link;
88 UIntMap ModulatorMap;
90 ALuint id;
91 } ALfontsound;
93 void ALfontsound_Destruct(ALfontsound *self);
94 void ALfontsound_setPropi(ALfontsound *self, ALCcontext *context, ALenum param, ALint value);
95 void ALfontsound_setModStagei(ALfontsound *self, ALCcontext *context, ALsizei stage, ALenum param, ALint value);
97 ALfontsound *NewFontsound(ALCcontext *context);
99 inline struct ALfontsound *LookupFontsound(ALCdevice *device, ALuint id)
100 { return (struct ALfontsound*)LookupUIntMapKey(&device->FontsoundMap, id); }
101 inline struct ALfontsound *RemoveFontsound(ALCdevice *device, ALuint id)
102 { return (struct ALfontsound*)RemoveUIntMapKey(&device->FontsoundMap, id); }
104 inline struct ALsfmodulator *LookupModulator(ALfontsound *sound, ALuint id)
105 { return (struct ALsfmodulator*)LookupUIntMapKey(&sound->ModulatorMap, id); }
106 inline struct ALsfmodulator *RemoveModulator(ALfontsound *sound, ALuint id)
107 { return (struct ALsfmodulator*)RemoveUIntMapKey(&sound->ModulatorMap, id); }
109 void ReleaseALFontsounds(ALCdevice *device);
112 typedef struct ALsfpreset {
113 volatile RefCount ref;
115 ALint Preset; /* a.k.a. MIDI program number */
116 ALint Bank; /* MIDI bank 0...127, or percussion (bank 128) */
118 ALfontsound **Sounds;
119 ALsizei NumSounds;
121 ALuint id;
122 } ALsfpreset;
124 ALsfpreset *NewPreset(ALCcontext *context);
125 void DeletePreset(ALsfpreset *preset, ALCdevice *device);
127 inline struct ALsfpreset *LookupPreset(ALCdevice *device, ALuint id)
128 { return (struct ALsfpreset*)LookupUIntMapKey(&device->PresetMap, id); }
129 inline struct ALsfpreset *RemovePreset(ALCdevice *device, ALuint id)
130 { return (struct ALsfpreset*)RemoveUIntMapKey(&device->PresetMap, id); }
132 void ReleaseALPresets(ALCdevice *device);
135 typedef struct ALsoundfont {
136 volatile RefCount ref;
138 ALsfpreset **Presets;
139 ALsizei NumPresets;
141 ALshort *Samples;
142 ALint NumSamples;
144 RWLock Lock;
145 volatile ALenum Mapped;
147 ALuint id;
148 } ALsoundfont;
150 void ALsoundfont_Construct(ALsoundfont *self);
151 void ALsoundfont_Destruct(ALsoundfont *self);
152 ALsoundfont *ALsoundfont_getDefSoundfont(ALCcontext *context);
153 void ALsoundfont_deleteSoundfont(ALsoundfont *self, ALCdevice *device);
155 inline struct ALsoundfont *LookupSfont(ALCdevice *device, ALuint id)
156 { return (struct ALsoundfont*)LookupUIntMapKey(&device->SfontMap, id); }
157 inline struct ALsoundfont *RemoveSfont(ALCdevice *device, ALuint id)
158 { return (struct ALsoundfont*)RemoveUIntMapKey(&device->SfontMap, id); }
160 void ReleaseALSoundfonts(ALCdevice *device);
162 #ifdef __cplusplus
164 #endif
166 #endif /* ALMIDI_H */