mixer.c
changeset 470 5cebd6c5be2d
parent 466 d3d060cb94a6
child 472 463ba3222193
     1.1 --- a/mixer.c	Sun Nov 08 15:06:43 2009 +0000
     1.2 +++ b/mixer.c	Sun Nov 08 16:35:36 2009 +0000
     1.3 @@ -35,6 +35,10 @@
     1.4  #include "load_voc.h"
     1.5  #include "load_ogg.h"
     1.6  #include "load_flac.h"
     1.7 +#include "dynamic_flac.h"
     1.8 +#include "dynamic_mod.h"
     1.9 +#include "dynamic_mp3.h"
    1.10 +#include "dynamic_ogg.h"
    1.11  
    1.12  #define __MIX_INTERNAL_EFFECT__
    1.13  #include "effects_internal.h"
    1.14 @@ -134,6 +138,54 @@
    1.15  	return(&linked_version);
    1.16  }
    1.17  
    1.18 +static int initialized = 0;
    1.19 +
    1.20 +int Mix_Init(int flags)
    1.21 +{
    1.22 +	int result = 0;
    1.23 +
    1.24 +	if ((flags & MIX_INIT_FLAC) && !(initialized & MIX_INIT_FLAC)) {
    1.25 +		if (Mix_InitFLAC() == 0) {
    1.26 +			result |= MIX_INIT_FLAC;
    1.27 +		}
    1.28 +	}
    1.29 +	if ((flags & MIX_INIT_MOD) && !(initialized & MIX_INIT_MOD)) {
    1.30 +		if (Mix_InitMOD() == 0) {
    1.31 +			result |= MIX_INIT_MOD;
    1.32 +		}
    1.33 +	}
    1.34 +	if ((flags & MIX_INIT_MP3) && !(initialized & MIX_INIT_MP3)) {
    1.35 +		if (Mix_InitMP3() == 0) {
    1.36 +			result |= MIX_INIT_MP3;
    1.37 +		}
    1.38 +	}
    1.39 +	if ((flags & MIX_INIT_OGG) && !(initialized & MIX_INIT_OGG)) {
    1.40 +		if (Mix_InitOgg() == 0) {
    1.41 +			result |= MIX_INIT_OGG;
    1.42 +		}
    1.43 +	}
    1.44 +	initialized |= result;
    1.45 +
    1.46 +	return (result);
    1.47 +}
    1.48 +
    1.49 +void Mix_Quit()
    1.50 +{
    1.51 +	if (initialized & MIX_INIT_FLAC) {
    1.52 +		Mix_QuitFLAC();
    1.53 +	}
    1.54 +	if (initialized & MIX_INIT_MOD) {
    1.55 +		Mix_QuitMOD();
    1.56 +	}
    1.57 +	if (initialized & MIX_INIT_MP3) {
    1.58 +		Mix_QuitMP3();
    1.59 +	}
    1.60 +	if (initialized & MIX_INIT_OGG) {
    1.61 +		Mix_QuitOgg();
    1.62 +	}
    1.63 +	initialized = 0;
    1.64 +}
    1.65 +
    1.66  static int _Mix_remove_all_effects(int channel, effect_info **e);
    1.67  
    1.68  /*