aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alMidi.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-01-01 07:25:23 -0800
committerChris Robinson <[email protected]>2014-01-01 07:25:23 -0800
commit0a5a08c0fb942e4db407f6eccc86c091dc7c362f (patch)
treeed9bd455c1aedaa680f38283018cc29ee158a87f /OpenAL32/alMidi.c
parente699ab8614d1806c8961efa02a947d3e25e0bc67 (diff)
Pass the ALsoundfont object to loadSf2, rather than its ID
Diffstat (limited to 'OpenAL32/alMidi.c')
-rw-r--r--OpenAL32/alMidi.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c
index c040bf36..17384bcf 100644
--- a/OpenAL32/alMidi.c
+++ b/OpenAL32/alMidi.c
@@ -63,11 +63,38 @@ done:
AL_API void AL_APIENTRY alLoadSoundfontSOFT(ALuint id, size_t(*cb)(ALvoid*,size_t,ALvoid*), ALvoid *user)
{
+ ALCdevice *device;
+ ALCcontext *context;
+ ALsoundfont *sfont;
Reader reader;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ if(!(sfont=LookupSfont(device, id)))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
+
+ WriteLock(&sfont->Lock);
+ if(sfont->ref != 0)
+ {
+ WriteUnlock(&sfont->Lock);
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ }
+ if(sfont->Mapped)
+ {
+ WriteUnlock(&sfont->Lock);
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ }
+
reader.cb = cb;
reader.ptr = user;
reader.error = 0;
- loadSf2(&reader, id);
+ loadSf2(&reader, sfont, context);
+ WriteUnlock(&sfont->Lock);
+
+done:
+ ALCcontext_DecRef(context);
}