Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
On shutdown, deallocate global memory we might have allocated for eff…
…ects.
Partially fixes Bugzilla #385.
- Loading branch information
Showing
with
28 additions
and
2 deletions.
-
+14
−0
effect_position.c
-
+8
−0
effects_internal.c
-
+2
−0
effects_internal.h
-
+4
−2
mixer.c
|
@@ -79,6 +79,20 @@ static position_args **pos_args_array = NULL; |
|
|
static position_args *pos_args_global = NULL; |
|
|
static int position_channels = 0; |
|
|
|
|
|
void _Eff_PositionDeinit(void) |
|
|
{ |
|
|
int i; |
|
|
for (i = 0; i < position_channels; i++) { |
|
|
free(pos_args_array[i]); |
|
|
} |
|
|
|
|
|
free(pos_args_global); |
|
|
pos_args_global = NULL; |
|
|
free(pos_args_array); |
|
|
pos_args_array = NULL; |
|
|
} |
|
|
|
|
|
|
|
|
/* This just frees up the callback-specific data. */ |
|
|
static void _Eff_PositionDone(int channel, void *udata) |
|
|
{ |
|
|
|
@@ -32,6 +32,9 @@ |
|
|
#include <stdlib.h> |
|
|
#include "SDL_mixer.h" |
|
|
|
|
|
#define __MIX_INTERNAL_EFFECT__ |
|
|
#include "effects_internal.h" |
|
|
|
|
|
/* Should we favor speed over memory usage and/or quality of output? */ |
|
|
int _Mix_effects_max_speed = 0; |
|
|
|
|
@@ -41,6 +44,11 @@ void _Mix_InitEffects(void) |
|
|
_Mix_effects_max_speed = (getenv(MIX_EFFECTSMAXSPEED) != NULL); |
|
|
} |
|
|
|
|
|
void _Mix_DeinitEffects(void) |
|
|
{ |
|
|
_Eff_PositionDeinit(); |
|
|
} |
|
|
|
|
|
|
|
|
void *_Eff_volume_table = NULL; |
|
|
|
|
|
|
@@ -41,6 +41,8 @@ extern void *_Eff_volume_table; |
|
|
void *_Eff_build_volume_table_u8(void); |
|
|
void *_Eff_build_volume_table_s8(void); |
|
|
|
|
|
void _Eff_PositionDeinit(void); |
|
|
|
|
|
/* Set up for C function definitions, even when using C++ */ |
|
|
#ifdef __cplusplus |
|
|
} |
|
|
|
@@ -35,6 +35,9 @@ |
|
|
#include "load_voc.h" |
|
|
#include "load_ogg.h" |
|
|
|
|
|
#define __MIX_INTERNAL_EFFECT__ |
|
|
#include "effects_internal.h" |
|
|
|
|
|
/* Magic numbers for various audio file formats */ |
|
|
#define RIFF 0x46464952 /* "RIFF" */ |
|
|
#define WAVE 0x45564157 /* "WAVE" */ |
|
@@ -266,8 +269,6 @@ static void PrintFormat(char *title, SDL_AudioSpec *fmt) |
|
|
} |
|
|
|
|
|
|
|
|
void _Mix_InitEffects(void); |
|
|
|
|
|
/* Open the mixer with a certain desired audio format */ |
|
|
int Mix_OpenAudio(int frequency, Uint16 format, int nchannels, int chunksize) |
|
|
{ |
|
@@ -960,6 +961,7 @@ void Mix_CloseAudio(void) |
|
|
Mix_UnregisterAllEffects(MIX_CHANNEL_POST); |
|
|
close_music(); |
|
|
Mix_HaltChannel(-1); |
|
|
_Eff_PositionDeinit(); |
|
|
SDL_CloseAudio(); |
|
|
free(mix_channel); |
|
|
mix_channel = NULL; |
|
|