diff options
author | Chris Robinson <[email protected]> | 2013-12-18 23:21:59 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-12-18 23:21:59 -0800 |
commit | 1e536cf7ca6413cc20536df144bb4eba8797bbad (patch) | |
tree | de263227d73e852d4c0273c3bd87664a2a3f22d2 /OpenAL32 | |
parent | 73fc4592ab8fd3c3bbff608ccfbd8def756def06 (diff) |
Properly initialize and cleanup the soundfont map
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMidi.h | 1 | ||||
-rw-r--r-- | OpenAL32/alMidi.c | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h index 46dcaad5..6cc13b20 100644 --- a/OpenAL32/Include/alMidi.h +++ b/OpenAL32/Include/alMidi.h @@ -112,6 +112,7 @@ inline struct ALsoundfont *LookupSfont(ALCdevice *device, ALuint id) inline struct ALsoundfont *RemoveSfont(ALCdevice *device, ALuint id) { return (struct ALsoundfont*)RemoveUIntMapKey(&device->SfontMap, id); } +void ReleaseALSoundfonts(ALCdevice *device); #ifdef __cplusplus } diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c index b311d390..c67ef81d 100644 --- a/OpenAL32/alMidi.c +++ b/OpenAL32/alMidi.c @@ -316,3 +316,24 @@ AL_API void AL_APIENTRY alMidiGainSOFT(ALfloat value) done: ALCcontext_DecRef(context); } + + +/* ReleaseALSoundfonts + * + * Called to destroy any soundfonts that still exist on the device + */ +void ReleaseALSoundfonts(ALCdevice *device) +{ + ALsizei i; + for(i = 0;i < device->SfontMap.size;i++) + { + ALsoundfont *temp = device->SfontMap.array[i].value; + device->SfontMap.array[i].value = NULL; + + FreeThunkEntry(temp->id); + ALsoundfont_Destruct(temp); + + memset(temp, 0, sizeof(*temp)); + free(temp); + } +} |