diff options
author | Chris Robinson <[email protected]> | 2013-12-27 02:59:50 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-12-27 02:59:50 -0800 |
commit | f85d733f9dc569bd6b3f37a0a4b8be7b3c783ad6 (patch) | |
tree | a67fa24599e54bee27a36e14e2cde8bca3348465 /OpenAL32/alState.c | |
parent | 2b772a5607c2147d68eb8e45b04b2f381ec6c0ad (diff) |
Add a method to set and get soundfonts
The main purpose of this is to select soundfonts for playback, eventually,
instead of the existing method that takes a filename.
Diffstat (limited to 'OpenAL32/alState.c')
-rw-r--r-- | OpenAL32/alState.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 8d96018b..6a528519 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -28,6 +28,7 @@ #include "alError.h" #include "alSource.h" #include "alAuxEffectSlot.h" +#include "alMidi.h" #include "midi/base.h" @@ -249,6 +250,8 @@ done: AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) { ALCcontext *context; + ALCdevice *device; + MidiSynth *synth; ALint value = 0; context = GetContextRef(); @@ -276,6 +279,12 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) value = (ALint)context->DeferUpdates; break; + case AL_SOUNDFONTS_SIZE_SOFT: + device = context->Device; + synth = device->Synth; + value = synth->NumSoundfonts; + break; + default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } @@ -290,6 +299,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) { ALCcontext *context; ALCdevice *device; + MidiSynth *synth; ALint64SOFT value = 0; context = GetContextRef(); @@ -324,6 +334,12 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) ALCdevice_Unlock(device); break; + case AL_SOUNDFONTS_SIZE_SOFT: + device = context->Device; + synth = device->Synth; + value = (ALint64SOFT)synth->NumSoundfonts; + break; + default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } @@ -438,6 +454,9 @@ done: AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) { ALCcontext *context; + ALCdevice *device; + MidiSynth *synth; + ALsizei i; if(values) { @@ -448,6 +467,7 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) case AL_DISTANCE_MODEL: case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: + case AL_SOUNDFONTS_SIZE_SOFT: values[0] = alGetInteger(pname); return; } @@ -456,10 +476,20 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); switch(pname) { + case AL_SOUNDFONTS_SOFT: + device = context->Device; + synth = device->Synth; + if(synth->NumSoundfonts > 0) + { + if(!(values)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + for(i = 0;i < synth->NumSoundfonts;i++) + values[i] = synth->Soundfonts[i]->id; + } + break; + default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } @@ -471,6 +501,9 @@ done: AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) { ALCcontext *context; + ALCdevice *device; + MidiSynth *synth; + ALsizei i; if(values) { @@ -482,6 +515,7 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_MIDI_CLOCK_SOFT: + case AL_SOUNDFONTS_SIZE_SOFT: values[0] = alGetInteger64SOFT(pname); return; } @@ -490,10 +524,20 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); switch(pname) { + case AL_SOUNDFONTS_SOFT: + device = context->Device; + synth = device->Synth; + if(synth->NumSoundfonts > 0) + { + if(!(values)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + for(i = 0;i < synth->NumSoundfonts;i++) + values[i] = (ALint64SOFT)synth->Soundfonts[i]->id; + } + break; + default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } |