From bd5b2b9f85522203609df18292df510dbb674246 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Thu, 23 Oct 2008 16:18:33 +0000 Subject: removed glfw and portaudio. SDL is now a requirement --- src/engine/client/ec_snd.c | 77 +--------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) (limited to 'src/engine/client/ec_snd.c') diff --git a/src/engine/client/ec_snd.c b/src/engine/client/ec_snd.c index 11c19d2d..a7219b65 100644 --- a/src/engine/client/ec_snd.c +++ b/src/engine/client/ec_snd.c @@ -4,12 +4,7 @@ #include #include -#ifdef CONFIG_NO_SDL - #include -#else - #include "SDL.h" -#endif - +#include "SDL.h" #include #include @@ -239,76 +234,13 @@ static void mix(short *final_out, unsigned frames) } } -#ifdef CONFIG_NO_SDL -static PaStream *stream; -static int pacallback(const void *in, void *out, unsigned long frames, const PaStreamCallbackTimeInfo* time, PaStreamCallbackFlags status, void *user) -{ - mix(out, frames); - return 0; -} -#else static void sdlcallback(void *unused, Uint8 *stream, int len) { mix((short *)stream, len/2/2); } -#endif - int snd_init() { -#ifdef CONFIG_NO_SDL - PaStreamParameters params; - PaError err = Pa_Initialize(); - - sound_lock = lock_create(); - - if(!config.snd_enable) - return 0; - - mixing_rate = config.snd_rate; - - { - int num = Pa_GetDeviceCount(); - int i; - const PaDeviceInfo *info; - - for(i = 0; i < num; i++) - { - info = Pa_GetDeviceInfo(i); - dbg_msg("snd", "device #%d name='%s'", i, info->name); - } - } - - params.device = config.snd_device; - if(params.device == -1) - { - params.device = Pa_GetDefaultOutputDevice(); - if(params.device < 0) - { - dbg_msg("snd", "no default device (%d)", params.device); - return 1; - } - } - - if(params.device < 0) - return 1; - dbg_msg("snd", "device = %d", params.device); - params.channelCount = 2; - params.sampleFormat = paInt16; - params.suggestedLatency = Pa_GetDeviceInfo(params.device)->defaultLowOutputLatency; - params.hostApiSpecificStreamInfo = 0x0; - - err = Pa_OpenStream( - &stream, /* passes back stream pointer */ - 0, /* no input channels */ - ¶ms, /* pointer to parameters */ - mixing_rate, /* sample rate */ - 128, /* frames per buffer */ - paClipOff, /* no clamping */ - pacallback, /* specify our custom callback */ - 0x0); /* pass our data through to callback */ - err = Pa_StartStream(stream); -#else SDL_AudioSpec format; sound_lock = lock_create(); @@ -337,7 +269,6 @@ int snd_init() SDL_PauseAudio(0); -#endif sound_enabled = 1; snd_update(); /* update the volume */ return 0; @@ -363,14 +294,8 @@ int snd_update() int snd_shutdown() { -#ifdef CONFIG_NO_SDL - Pa_StopStream(stream); - Pa_Terminate(); -#else SDL_CloseAudio(); -#endif lock_destroy(sound_lock); - return 0; } -- cgit 1.4.1