aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMidi.h1
-rw-r--r--OpenAL32/alMidi.c21
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);
+ }
+}