aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alMidi.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-11-28 01:53:05 -0800
committerChris Robinson <[email protected]>2013-11-28 01:53:05 -0800
commita48f362d282401ddefe742188bd13a59fc79835e (patch)
tree9964affac5410cce4d4189564afa18b6c350f84c /OpenAL32/alMidi.c
parent489723723c79b4a7470c0d01065bd24d1301a6d1 (diff)
Start a MIDI interface extension
Diffstat (limited to 'OpenAL32/alMidi.c')
-rw-r--r--OpenAL32/alMidi.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c
index b3356e64..3e75b805 100644
--- a/OpenAL32/alMidi.c
+++ b/OpenAL32/alMidi.c
@@ -196,6 +196,67 @@ MidiSynth *SynthCreate(ALCdevice *device)
}
+AL_API void AL_APIENTRY alMidiEventSOFT(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ ALenum err;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ if(!(event == AL_NOTEOFF_SOFT || event == AL_NOTEON_SOFT ||
+ event == AL_AFTERTOUCH_SOFT || event == AL_CONTROLLERCHANGE_SOFT ||
+ event == AL_PROGRAMCHANGE_SOFT || event == AL_CHANNELPRESSURE_SOFT ||
+ event == AL_PITCHBEND_SOFT))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ if(!(channel >= 0 && channel <= 15))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ if(!(param1 >= 0 && param1 <= 127))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ if(!(param2 >= 0 && param2 <= 127))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+
+ device = context->Device;
+ ALCdevice_Lock(device);
+ err = MidiSynth_insertEvent(device->Synth, time, event|channel, param1, param2);
+ ALCdevice_Unlock(device);
+ if(err != AL_NO_ERROR)
+ alSetError(context, err);
+
+done:
+ ALCcontext_DecRef(context);
+}
+
+AL_API void AL_APIENTRY alMidiPlaySOFT(void)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ V(device->Synth,setState)(AL_PLAYING);
+
+ ALCcontext_DecRef(context);
+}
+
+AL_API void AL_APIENTRY alMidiPauseSOFT(void)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ V(device->Synth,setState)(AL_PAUSED);
+
+ ALCcontext_DecRef(context);
+}
+
+
void InitEvtQueue(EvtQueue *queue)
{
queue->events = NULL;