diff options
author | Chris Robinson <[email protected]> | 2013-12-13 14:15:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-12-13 14:15:01 -0800 |
commit | 1dd05bac5c127fdddcf56dc7a066b0a3cc974885 (patch) | |
tree | f0ecc6574e3017d5690aaa4c317a64c266b4ce63 | |
parent | a343d78724cf59f6368971f871493c0e45f66cea (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.
-rw-r--r-- | Alc/ALc.c | 1 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/alMidi.c | 32 |
3 files changed, 28 insertions, 7 deletions
@@ -287,6 +287,7 @@ static const ALCfunction alcFunctions[] = { DECL(alMidiPlaySOFT), DECL(alMidiPauseSOFT), DECL(alMidiStopSOFT), + DECL(alMidiResetSOFT), DECL(alMidiGainSOFT), DECL(alGetInteger64SOFT), DECL(alGetInteger64vSOFT), diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index e19ab487..64ab1174 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -45,6 +45,7 @@ typedef void (AL_APIENTRY*LPALMIDISYSEXSOFT)(ALuint64SOFT time, const ALbyte *da typedef void (AL_APIENTRY*LPALMIDIPLAYSOFT)(void); typedef void (AL_APIENTRY*LPALMIDIPAUSESOFT)(void); typedef void (AL_APIENTRY*LPALMIDISTOPSOFT)(void); +typedef void (AL_APIENTRY*LPALMIDIRESETSOFT)(void); typedef void (AL_APIENTRY*LPALMIDIGAINSOFT)(ALfloat value); typedef ALint64SOFT (AL_APIENTRY*LPALGETINTEGER64SOFT)(ALenum pname); typedef void (AL_APIENTRY*LPALGETINTEGER64VSOFT)(ALenum pname, ALint64SOFT *values); @@ -56,6 +57,7 @@ AL_API void AL_APIENTRY alMidiSysExSOFT(ALuint64SOFT time, const ALbyte *data, A AL_API void AL_APIENTRY alMidiPlaySOFT(void); AL_API void AL_APIENTRY alMidiPauseSOFT(void); AL_API void AL_APIENTRY alMidiStopSOFT(void); +AL_API void AL_APIENTRY alMidiResetSOFT(void); AL_API void AL_APIENTRY alMidiGainSOFT(ALfloat value); AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname); AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values); 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) { |