diff options
author | Sven Gothel <[email protected]> | 2014-06-10 05:30:02 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-10 05:30:02 +0200 |
commit | f95bf4457fbc31112fa82dacbc1b7e094b9fd1cf (patch) | |
tree | 965ba5b8e6fc8e6bfe7a981c1dfb1179bb9adcde /OpenAL32/alSoundfont.c | |
parent | 7297c3214a4c648aaee81a9877da15b88f798197 (diff) | |
parent | c07fb7b45c1e345dbaa439882250de5b2213026f (diff) |
Merge branch 'UPSTREAM' into UPSTREAM_MERGE
Diffstat (limited to 'OpenAL32/alSoundfont.c')
-rw-r--r-- | OpenAL32/alSoundfont.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/OpenAL32/alSoundfont.c b/OpenAL32/alSoundfont.c index 355c5b41..357e13e7 100644 --- a/OpenAL32/alSoundfont.c +++ b/OpenAL32/alSoundfont.c @@ -91,7 +91,7 @@ AL_API ALvoid AL_APIENTRY alDeleteSoundfontsSOFT(ALsizei n, const ALuint *ids) } else if((sfont=LookupSfont(device, ids[i])) == NULL) SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(sfont->Mapped != AL_FALSE || sfont->ref != 0) + if(sfont->Mapped != AL_FALSE || ReadRef(&sfont->ref) != 0) SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); } @@ -157,7 +157,7 @@ AL_API ALvoid AL_APIENTRY alSoundfontSamplesSOFT(ALuint id, ALenum type, ALsizei SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); WriteLock(&sfont->Lock); - if(sfont->ref != 0) + if(ReadRef(&sfont->ref) != 0) alSetError(context, AL_INVALID_OPERATION); else if(sfont->Mapped) alSetError(context, AL_INVALID_OPERATION); @@ -232,7 +232,7 @@ AL_API ALvoid* AL_APIENTRY alSoundfontMapSamplesSOFT(ALuint id, ALsizei offset, SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); ReadLock(&sfont->Lock); - if(sfont->ref != 0) + if(ReadRef(&sfont->ref) != 0) alSetError(context, AL_INVALID_OPERATION); else if(ExchangeInt(&sfont->Mapped, AL_TRUE) == AL_TRUE) alSetError(context, AL_INVALID_OPERATION); @@ -329,7 +329,7 @@ AL_API void AL_APIENTRY alSoundfontPresetsSOFT(ALuint id, ALsizei count, const A SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); WriteLock(&sfont->Lock); - if(sfont->ref != 0) + if(ReadRef(&sfont->ref) != 0) { WriteUnlock(&sfont->Lock); SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); @@ -350,6 +350,7 @@ AL_API void AL_APIENTRY alSoundfontPresetsSOFT(ALuint id, ALsizei count, const A { if(!(presets[i]=LookupPreset(device, pids[i]))) { + free(presets); WriteUnlock(&sfont->Lock); SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); } @@ -389,7 +390,7 @@ AL_API void AL_APIENTRY alLoadSoundfontSOFT(ALuint id, size_t(*cb)(ALvoid*,size_ SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); WriteLock(&sfont->Lock); - if(sfont->ref != 0) + if(ReadRef(&sfont->ref) != 0) { WriteUnlock(&sfont->Lock); SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); @@ -418,7 +419,7 @@ done: void ALsoundfont_Construct(ALsoundfont *self) { - self->ref = 0; + InitRef(&self->ref, 0); self->Presets = NULL; self->NumPresets = 0; @@ -469,7 +470,7 @@ ALsoundfont *ALsoundfont_getDefSoundfont(ALCcontext *context) { FILE *f; - f = fopen(fname, "rb"); + f = OpenDataFile(fname, "openal/soundfonts"); if(f == NULL) ERR("Failed to open %s\n", fname); else @@ -519,7 +520,7 @@ void ALsoundfont_deleteSoundfont(ALsoundfont *self, ALCdevice *device) deleting = AL_FALSE; for(j = 0;j < num_sounds;j++) { - if(sounds[j] && sounds[j]->ref == 0) + if(sounds[j] && ReadRef(&sounds[j]->ref) == 0) { deleting = AL_TRUE; RemoveFontsound(device, sounds[j]->id); |