aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alMidi.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-13 14:15:01 -0800
committerChris Robinson <[email protected]>2013-12-13 14:15:01 -0800
commit1dd05bac5c127fdddcf56dc7a066b0a3cc974885 (patch)
treef0ecc6574e3017d5690aaa4c317a64c266b4ce63 /OpenAL32/alMidi.c
parenta343d78724cf59f6368971f871493c0e45f66cea (diff)
Add a alMidiResetSOFT method to reset the synth
Playback is stopped, the queue is flushed, the clock is reset to 0, and the MIDI system is reset to power-up status.
Diffstat (limited to 'OpenAL32/alMidi.c')
-rw-r--r--OpenAL32/alMidi.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c
index 2f87faad..cf634617 100644
--- a/OpenAL32/alMidi.c
+++ b/OpenAL32/alMidi.c
@@ -345,13 +345,8 @@ static void FSynth_stop(FSynth *self)
static void FSynth_reset(FSynth *self)
{
- ALsizei chan;
- /* All sounds off + reset all controllers */
- for(chan = 0;chan < 16;chan++)
- {
- fluid_synth_cc(self->Synth, chan, 120, 0);
- fluid_synth_cc(self->Synth, chan, 121, 0);
- }
+ /* Reset to power-up status. */
+ fluid_synth_system_reset(self->Synth);
MidiSynth_reset(STATIC_CAST(MidiSynth, self));
}
@@ -795,6 +790,29 @@ AL_API void AL_APIENTRY alMidiStopSOFT(void)
ALCcontext_DecRef(context);
}
+AL_API void AL_APIENTRY alMidiResetSOFT(void)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ MidiSynth *synth;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ synth = device->Synth;
+
+ WriteLock(&synth->Lock);
+ V(synth,setState)(AL_INITIAL);
+
+ ALCdevice_Lock(device);
+ V0(synth,reset)();
+ ALCdevice_Unlock(device);
+ WriteUnlock(&synth->Lock);
+
+ ALCcontext_DecRef(context);
+}
+
AL_API void AL_APIENTRY alMidiGainSOFT(ALfloat value)
{