diff options
-rw-r--r-- | Alc/ALc.c | 3 | ||||
-rw-r--r-- | Alc/midi/base.c | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 9 | ||||
-rw-r--r-- | OpenAL32/Include/alMidi.h | 4 | ||||
-rw-r--r-- | OpenAL32/alPreset.c | 100 |
5 files changed, 117 insertions, 2 deletions
@@ -290,6 +290,9 @@ static const ALCfunction alcFunctions[] = { DECL(alGenPresetsSOFT), DECL(alDeletePresetsSOFT), DECL(alIsPresetSOFT), + DECL(alPresetiSOFT), + DECL(alPresetivSOFT), + DECL(alGetPresetivSOFT), DECL(alGenInstrumentsSOFT), DECL(alDeleteInstrumentsSOFT), DECL(alIsInstrumentSOFT), diff --git a/Alc/midi/base.c b/Alc/midi/base.c index b7e94fd2..0d81952b 100644 --- a/Alc/midi/base.c +++ b/Alc/midi/base.c @@ -425,6 +425,9 @@ void ALsfpreset_Construct(ALsfpreset *self) { self->ref = 0; + self->Preset = 0; + self->Bank = 0; + self->Zones = NULL; self->NumZones = 0; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 039807de..79ccdb60 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -31,6 +31,8 @@ #define ALC_SOFT_midi_interface 1 #define AL_MIDI_CLOCK_SOFT 0x9999 #define AL_MIDI_GAIN_SOFT 0x9998 +#define AL_MIDI_PRESET_SOFT 0x9997 +#define AL_MIDI_BANK_SOFT 0x9996 #define AL_NOTEOFF_SOFT 0x0080 #define AL_NOTEON_SOFT 0x0090 #define AL_AFTERTOUCH_SOFT 0x00A0 @@ -47,6 +49,9 @@ typedef void (AL_APIENTRY*LPALSOUNDFONTUNMAPSAMPLESSOFT)(ALuint sfid); typedef void (AL_APIENTRY*LPALGENPRESETSSOFT)(ALsizei n, ALuint *ids); typedef void (AL_APIENTRY*LPALDELETEPRESETSSOFT)(ALsizei n, const ALuint *ids); typedef ALboolean (AL_APIENTRY*LPALISPRESETSOFT)(ALuint id); +typedef void (AL_APIENTRY*LPALPRESETISOFT)(ALuint id, ALenum param, ALint value); +typedef void (AL_APIENTRY*LPALPRESETIVSOFT)(ALuint id, ALenum param, const ALint *values); +typedef void (AL_APIENTRY*LPALGETPRESETIVSOFT)(ALuint id, ALenum param, ALint *values); typedef void (AL_APIENTRY*LPALGENINSTRUMENTSSOFT)(ALsizei n, ALuint *ids); typedef void (AL_APIENTRY*LPALDELETEINSTRUMENTSSOFT)(ALsizei n, const ALuint *ids); typedef ALboolean (AL_APIENTRY*LPALISINSTRUMENTSOFT)(ALuint id); @@ -71,6 +76,10 @@ AL_API ALvoid AL_APIENTRY alSoundfontUnmapSamplesSOFT(ALuint sfid); AL_API void AL_APIENTRY alGenPresetsSOFT(ALsizei n, ALuint *ids); AL_API void AL_APIENTRY alDeletePresetsSOFT(ALsizei n, const ALuint *ids); AL_API ALboolean AL_APIENTRY alIsPresetSOFT(ALuint id); +AL_API void AL_APIENTRY alPresetiSOFT(ALuint id, ALenum param, ALint value); +AL_API void AL_APIENTRY alPresetivSOFT(ALuint id, ALenum param, const ALint *values); +AL_API void AL_APIENTRY alGetPresetivSOFT(ALuint id, ALenum param, ALint *values); + AL_API void AL_APIENTRY alGenInstrumentsSOFT(ALsizei n, ALuint *ids); AL_API void AL_APIENTRY alDeleteInstrumentsSOFT(ALsizei n, const ALuint *ids); AL_API ALboolean AL_APIENTRY alIsInstrumentSOFT(ALuint id); diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h index fffb1174..b37a6546 100644 --- a/OpenAL32/Include/alMidi.h +++ b/OpenAL32/Include/alMidi.h @@ -87,8 +87,8 @@ void ReleaseALInstruments(ALCdevice *device); typedef struct ALsfpreset { volatile RefCount ref; - ALint Program; - ALint Bank; + ALint Preset; /* a.k.a. MIDI program number */ + ALint Bank; /* MIDI bank 0...127, or percussion (bank 128) */ ALsfzone *Zones; ALsizei NumZones; diff --git a/OpenAL32/alPreset.c b/OpenAL32/alPreset.c index 873d9ad1..c01f4e80 100644 --- a/OpenAL32/alPreset.c +++ b/OpenAL32/alPreset.c @@ -117,6 +117,106 @@ AL_API ALboolean AL_APIENTRY alIsPresetSOFT(ALuint id) return ret; } +AL_API void AL_APIENTRY alPresetiSOFT(ALuint id, ALenum param, ALint value) +{ + ALCdevice *device; + ALCcontext *context; + ALsfpreset *preset; + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + if((preset=LookupPreset(device, id)) == NULL) + SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + if(preset->ref != 0) + SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + switch(param) + { + case AL_MIDI_PRESET_SOFT: + if(!(value >= 0 && value <= 127)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + preset->Preset = value; + break; + + case AL_MIDI_BANK_SOFT: + if(!(value >= 0 && value <= 128)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + preset->Bank = value; + break; + + default: + SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + } + +done: + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alPresetivSOFT(ALuint id, ALenum param, const ALint *values) +{ + ALCdevice *device; + ALCcontext *context; + ALsfpreset *preset; + + switch(param) + { + case AL_MIDI_PRESET_SOFT: + case AL_MIDI_BANK_SOFT: + alPresetiSOFT(id, param, values[0]); + return; + } + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + if((preset=LookupPreset(device, id)) == NULL) + SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + if(preset->ref != 0) + SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + switch(param) + { + default: + SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + } + +done: + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alGetPresetivSOFT(ALuint id, ALenum param, ALint *values) +{ + ALCdevice *device; + ALCcontext *context; + ALsfpreset *preset; + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + if((preset=LookupPreset(device, id)) == NULL) + SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + if(preset->ref != 0) + SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + switch(param) + { + case AL_MIDI_PRESET_SOFT: + values[0] = preset->Preset; + break; + + case AL_MIDI_BANK_SOFT: + values[0] = preset->Bank; + break; + + default: + SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + } + +done: + ALCcontext_DecRef(context); +} + /* ReleaseALPresets * |