2013-11-27 05:12:11 -08:00
|
|
|
#ifndef ALMIDI_H
|
|
|
|
#define ALMIDI_H
|
|
|
|
|
|
|
|
#include "alMain.h"
|
2013-12-17 21:56:28 -08:00
|
|
|
#include "atomic.h"
|
2013-11-27 05:12:11 -08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-12-18 22:51:53 -08:00
|
|
|
typedef struct ALsfmodulator {
|
2014-01-05 17:21:34 -08:00
|
|
|
struct {
|
|
|
|
ALenum Input;
|
|
|
|
ALenum Type;
|
|
|
|
ALenum Form;
|
|
|
|
} Source[2];
|
2013-12-18 22:51:53 -08:00
|
|
|
ALint Amount;
|
|
|
|
ALenum TransformOp;
|
2014-01-05 17:21:34 -08:00
|
|
|
ALenum Dest;
|
2013-12-18 22:51:53 -08:00
|
|
|
} ALsfmodulator;
|
|
|
|
|
2014-01-17 00:36:33 -08:00
|
|
|
typedef struct ALenvelope {
|
|
|
|
ALint DelayTime;
|
|
|
|
ALint AttackTime;
|
|
|
|
ALint HoldTime;
|
|
|
|
ALint DecayTime;
|
|
|
|
ALint SustainAttn;
|
|
|
|
ALint ReleaseTime;
|
|
|
|
ALint KeyToHoldTime;
|
|
|
|
ALint KeyToDecayTime;
|
|
|
|
} ALenvelope;
|
|
|
|
|
2013-12-19 00:57:07 -08:00
|
|
|
|
2013-12-25 19:13:59 -08:00
|
|
|
typedef struct ALfontsound {
|
2014-05-14 02:47:07 -07:00
|
|
|
RefCount ref;
|
2013-12-25 19:13:59 -08:00
|
|
|
|
2014-09-03 16:29:17 -07:00
|
|
|
ATOMIC(struct ALbuffer*) Buffer;
|
2014-06-29 00:47:29 -07:00
|
|
|
|
2013-12-25 19:13:59 -08:00
|
|
|
ALint MinKey, MaxKey;
|
|
|
|
ALint MinVelocity, MaxVelocity;
|
|
|
|
|
2013-12-29 02:25:40 -08:00
|
|
|
ALint ModLfoToPitch;
|
|
|
|
ALint VibratoLfoToPitch;
|
|
|
|
ALint ModEnvToPitch;
|
|
|
|
|
2013-12-29 03:18:31 -08:00
|
|
|
ALint FilterCutoff;
|
|
|
|
ALint FilterQ;
|
|
|
|
ALint ModLfoToFilterCutoff;
|
|
|
|
ALint ModEnvToFilterCutoff;
|
2013-12-29 05:09:50 -08:00
|
|
|
ALint ModLfoToVolume;
|
2013-12-29 03:18:31 -08:00
|
|
|
|
2013-12-29 04:36:01 -08:00
|
|
|
ALint ChorusSend;
|
|
|
|
ALint ReverbSend;
|
|
|
|
|
2013-12-29 04:24:32 -08:00
|
|
|
ALint Pan;
|
|
|
|
|
2013-12-29 05:09:50 -08:00
|
|
|
struct {
|
|
|
|
ALint Delay;
|
|
|
|
ALint Frequency;
|
|
|
|
} ModLfo;
|
|
|
|
struct {
|
|
|
|
ALint Delay;
|
|
|
|
ALint Frequency;
|
|
|
|
} VibratoLfo;
|
|
|
|
|
2014-01-17 00:36:33 -08:00
|
|
|
ALenvelope ModEnv;
|
|
|
|
ALenvelope VolEnv;
|
2013-12-29 02:14:10 -08:00
|
|
|
|
2013-12-29 04:24:32 -08:00
|
|
|
ALint Attenuation;
|
|
|
|
|
2013-12-29 03:43:00 -08:00
|
|
|
ALint CoarseTuning;
|
|
|
|
ALint FineTuning;
|
|
|
|
|
|
|
|
ALenum LoopMode;
|
|
|
|
|
|
|
|
ALint TuningScale;
|
|
|
|
|
2013-12-29 05:09:50 -08:00
|
|
|
ALint ExclusiveClass;
|
|
|
|
|
2013-12-25 19:13:59 -08:00
|
|
|
ALuint Start;
|
|
|
|
ALuint End;
|
|
|
|
ALuint LoopStart;
|
|
|
|
ALuint LoopEnd;
|
|
|
|
ALuint SampleRate;
|
|
|
|
ALubyte PitchKey;
|
|
|
|
ALbyte PitchCorrection;
|
|
|
|
ALenum SampleType;
|
2014-09-03 16:29:17 -07:00
|
|
|
|
|
|
|
ATOMIC(struct ALfontsound*) Link;
|
2013-12-26 22:10:41 -08:00
|
|
|
|
2014-07-06 09:06:35 -07:00
|
|
|
/* NOTE: Each map entry contains *four* (4) ALsfmodulator objects. */
|
2014-01-02 14:43:44 -08:00
|
|
|
UIntMap ModulatorMap;
|
2013-12-25 19:13:59 -08:00
|
|
|
|
|
|
|
ALuint id;
|
|
|
|
} ALfontsound;
|
|
|
|
|
2014-01-03 18:48:47 -08:00
|
|
|
void ALfontsound_setPropi(ALfontsound *self, ALCcontext *context, ALenum param, ALint value);
|
2014-01-05 17:21:34 -08:00
|
|
|
void ALfontsound_setModStagei(ALfontsound *self, ALCcontext *context, ALsizei stage, ALenum param, ALint value);
|
2014-01-03 18:48:47 -08:00
|
|
|
|
2014-01-02 13:53:16 -08:00
|
|
|
ALfontsound *NewFontsound(ALCcontext *context);
|
2014-06-30 00:10:40 -07:00
|
|
|
void DeleteFontsound(ALCdevice *device, ALfontsound *sound);
|
2013-12-25 19:13:59 -08:00
|
|
|
|
|
|
|
inline struct ALfontsound *LookupFontsound(ALCdevice *device, ALuint id)
|
|
|
|
{ return (struct ALfontsound*)LookupUIntMapKey(&device->FontsoundMap, id); }
|
|
|
|
inline struct ALfontsound *RemoveFontsound(ALCdevice *device, ALuint id)
|
|
|
|
{ return (struct ALfontsound*)RemoveUIntMapKey(&device->FontsoundMap, id); }
|
|
|
|
|
|
|
|
void ReleaseALFontsounds(ALCdevice *device);
|
|
|
|
|
|
|
|
|
2013-12-18 22:51:53 -08:00
|
|
|
typedef struct ALsfpreset {
|
2014-05-14 02:47:07 -07:00
|
|
|
RefCount ref;
|
2013-12-18 22:51:53 -08:00
|
|
|
|
2013-12-23 03:23:42 -08:00
|
|
|
ALint Preset; /* a.k.a. MIDI program number */
|
|
|
|
ALint Bank; /* MIDI bank 0...127, or percussion (bank 128) */
|
2013-12-18 22:51:53 -08:00
|
|
|
|
2013-12-25 19:50:46 -08:00
|
|
|
ALfontsound **Sounds;
|
|
|
|
ALsizei NumSounds;
|
2013-12-18 22:51:53 -08:00
|
|
|
|
|
|
|
ALuint id;
|
|
|
|
} ALsfpreset;
|
|
|
|
|
2014-01-02 10:39:21 -08:00
|
|
|
ALsfpreset *NewPreset(ALCcontext *context);
|
2014-06-30 00:10:40 -07:00
|
|
|
void DeletePreset(ALCdevice *device, ALsfpreset *preset);
|
2013-12-18 22:51:53 -08:00
|
|
|
|
2013-12-19 00:09:55 -08:00
|
|
|
inline struct ALsfpreset *LookupPreset(ALCdevice *device, ALuint id)
|
|
|
|
{ return (struct ALsfpreset*)LookupUIntMapKey(&device->PresetMap, id); }
|
|
|
|
inline struct ALsfpreset *RemovePreset(ALCdevice *device, ALuint id)
|
|
|
|
{ return (struct ALsfpreset*)RemoveUIntMapKey(&device->PresetMap, id); }
|
|
|
|
|
|
|
|
void ReleaseALPresets(ALCdevice *device);
|
|
|
|
|
|
|
|
|
2013-12-18 22:51:53 -08:00
|
|
|
typedef struct ALsoundfont {
|
2014-05-14 02:47:07 -07:00
|
|
|
RefCount ref;
|
2013-12-18 22:51:53 -08:00
|
|
|
|
|
|
|
ALsfpreset **Presets;
|
|
|
|
ALsizei NumPresets;
|
|
|
|
|
2013-12-20 00:47:12 -08:00
|
|
|
RWLock Lock;
|
2013-12-19 04:19:03 -08:00
|
|
|
|
2013-12-18 22:51:53 -08:00
|
|
|
ALuint id;
|
|
|
|
} ALsoundfont;
|
|
|
|
|
2014-01-05 05:11:07 -08:00
|
|
|
ALsoundfont *ALsoundfont_getDefSoundfont(ALCcontext *context);
|
|
|
|
void ALsoundfont_deleteSoundfont(ALsoundfont *self, ALCdevice *device);
|
2013-12-18 22:51:53 -08:00
|
|
|
|
|
|
|
inline struct ALsoundfont *LookupSfont(ALCdevice *device, ALuint id)
|
|
|
|
{ return (struct ALsoundfont*)LookupUIntMapKey(&device->SfontMap, id); }
|
|
|
|
inline struct ALsoundfont *RemoveSfont(ALCdevice *device, ALuint id)
|
|
|
|
{ return (struct ALsoundfont*)RemoveUIntMapKey(&device->SfontMap, id); }
|
|
|
|
|
2013-12-18 23:21:59 -08:00
|
|
|
void ReleaseALSoundfonts(ALCdevice *device);
|
2013-12-18 22:51:53 -08:00
|
|
|
|
2014-07-04 11:18:32 -07:00
|
|
|
|
|
|
|
inline ALboolean IsValidCtrlInput(int cc)
|
|
|
|
{
|
|
|
|
/* These correspond to MIDI functions, not real controller values. */
|
|
|
|
if(cc == 0 || cc == 6 || cc == 32 || cc == 38 || (cc >= 98 && cc <= 101) || cc >= 120)
|
|
|
|
return AL_FALSE;
|
|
|
|
/* These are the LSB components of CC0...CC31, which are automatically used when
|
|
|
|
* reading the MSB controller value. */
|
|
|
|
if(cc >= 32 && cc <= 63)
|
|
|
|
return AL_FALSE;
|
|
|
|
/* All the rest are okay! */
|
|
|
|
return AL_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-11-27 05:12:11 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ALMIDI_H */
|