diff options
author | Chris Robinson <[email protected]> | 2014-06-30 00:10:40 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-06-30 00:10:40 -0700 |
commit | 22982948cf951924c206b37e80c31532b75c5410 (patch) | |
tree | e3f9738d0bb1fd749e4d71d03360ccdd1eb8db28 /OpenAL32/alFontsound.c | |
parent | 8f8898b7b0a5c0b1d6aa855b205b433b778e46a1 (diff) |
Standardize some New/Delete methods
Diffstat (limited to 'OpenAL32/alFontsound.c')
-rw-r--r-- | OpenAL32/alFontsound.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/OpenAL32/alFontsound.c b/OpenAL32/alFontsound.c index 80a7562e..8e28355a 100644 --- a/OpenAL32/alFontsound.c +++ b/OpenAL32/alFontsound.c @@ -15,9 +15,11 @@ extern inline struct ALfontsound *LookupFontsound(ALCdevice *device, ALuint id); extern inline struct ALfontsound *RemoveFontsound(ALCdevice *device, ALuint id); +extern inline struct ALsfmodulator *LookupModulator(ALfontsound *sound, ALuint id); +extern inline struct ALsfmodulator *RemoveModulator(ALfontsound *sound, ALuint id); static void ALfontsound_Construct(ALfontsound *self); -void ALfontsound_Destruct(ALfontsound *self); +static void ALfontsound_Destruct(ALfontsound *self); void ALfontsound_setPropi(ALfontsound *self, ALCcontext *context, ALenum param, ALint value); static ALsfmodulator *ALfontsound_getModStage(ALfontsound *self, ALsizei stage); void ALfontsound_setModStagei(ALfontsound *self, ALCcontext *context, ALsizei stage, ALenum param, ALint value); @@ -76,13 +78,8 @@ AL_API ALvoid AL_APIENTRY alDeleteFontsoundsSOFT(ALsizei n, const ALuint *ids) for(i = 0;i < n;i++) { - if((inst=RemoveFontsound(device, ids[i])) == NULL) - continue; - - ALfontsound_Destruct(inst); - - memset(inst, 0, sizeof(*inst)); - free(inst); + if((inst=LookupFontsound(device, ids[i])) == NULL) + DeleteFontsound(device, inst); } done: @@ -510,6 +507,16 @@ ALfontsound *NewFontsound(ALCcontext *context) return sound; } +void DeleteFontsound(ALCdevice *device, ALfontsound *sound) +{ + RemoveFontsound(device, sound->id); + + ALfontsound_Destruct(sound); + + memset(sound, 0, sizeof(*sound)); + free(sound); +} + static void ALfontsound_Construct(ALfontsound *self) { @@ -587,7 +594,7 @@ static void ALfontsound_Construct(ALfontsound *self) self->id = 0; } -void ALfontsound_Destruct(ALfontsound *self) +static void ALfontsound_Destruct(ALfontsound *self) { ALsizei i; |