aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alPreset.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-23 03:23:42 -0800
committerChris Robinson <[email protected]>2013-12-23 03:23:42 -0800
commitd7de86966d677366d8514a32be46b3040d9bc902 (patch)
tree81bc0fd23772a09179ed7973ae3835e70c0bf49e /OpenAL32/alPreset.c
parent0df5eb90ea0d244050f71c5f71167c46cbc17355 (diff)
Add methods to get and set a preset object's preset and bank numbers
Diffstat (limited to 'OpenAL32/alPreset.c')
-rw-r--r--OpenAL32/alPreset.c100
1 files changed, 100 insertions, 0 deletions
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
*