aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-11-28 04:29:38 -0800
committerChris Robinson <[email protected]>2013-11-28 04:29:38 -0800
commit29a4ac329a8d6f8c4432217e1e1f3e55cbf146fe (patch)
tree951cbad7187694acba1ff738144a1336a856d091 /OpenAL32
parent5dad1688d4293b490a22b1c7459a20419e8cff5b (diff)
Move MidiSynth locking out of the setState method
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alMidi.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c
index cd1dd020..b45a92e0 100644
--- a/OpenAL32/alMidi.c
+++ b/OpenAL32/alMidi.c
@@ -51,9 +51,7 @@ static void MidiSynth_Destruct(MidiSynth *self)
static inline void MidiSynth_setState(MidiSynth *self, ALenum state)
{
- WriteLock(&self->Lock);
ExchangeInt(&self->State, state);
- WriteUnlock(&self->Lock);
}
ALuint64 MidiSynth_getTime(const MidiSynth *self)
@@ -199,7 +197,6 @@ static ALenum FSynth_loadSoundfont(FSynth *self, const char *filename)
static void FSynth_setState(FSynth *self, ALenum state)
{
- WriteLock(&STATIC_CAST(MidiSynth, self)->Lock);
if(state == AL_PLAYING)
{
if(self->FontID == FLUID_FAILED)
@@ -215,8 +212,7 @@ static void FSynth_setState(FSynth *self, ALenum state)
}
}
}
- ExchangeInt(&STATIC_CAST(MidiSynth, self)->State, state);
- WriteUnlock(&STATIC_CAST(MidiSynth, self)->Lock);
+ MidiSynth_setState(STATIC_CAST(MidiSynth, self), state);
}
static void FSynth_update(FSynth *self, ALCdevice *device)
@@ -518,28 +514,32 @@ done:
AL_API void AL_APIENTRY alMidiPlaySOFT(void)
{
- ALCdevice *device;
ALCcontext *context;
+ MidiSynth *synth;
context = GetContextRef();
if(!context) return;
- device = context->Device;
- V(device->Synth,setState)(AL_PLAYING);
+ synth = context->Device->Synth;
+ WriteLock(&synth->Lock);
+ V(synth,setState)(AL_PLAYING);
+ WriteUnlock(&synth->Lock);
ALCcontext_DecRef(context);
}
AL_API void AL_APIENTRY alMidiPauseSOFT(void)
{
- ALCdevice *device;
ALCcontext *context;
+ MidiSynth *synth;
context = GetContextRef();
if(!context) return;
- device = context->Device;
- V(device->Synth,setState)(AL_PAUSED);
+ synth = context->Device->Synth;
+ WriteLock(&synth->Lock);
+ V(synth,setState)(AL_PAUSED);
+ WriteUnlock(&synth->Lock);
ALCcontext_DecRef(context);
}