diff --git a/src/client/sound/header/qal_api.h b/src/client/sound/header/qal_api.h index 24911463..bdee3ebc 100644 --- a/src/client/sound/header/qal_api.h +++ b/src/client/sound/header/qal_api.h @@ -26,6 +26,9 @@ * ======================================================================= */ +#ifndef _QAL_API_H_ +#define _QAL_API_H_ + #include /* Function pointers used to tie @@ -104,15 +107,23 @@ extern LPALDOPPLERVELOCITY qalDopplerVelocity; extern LPALSPEEDOFSOUND qalSpeedOfSound; extern LPALDISTANCEMODEL qalDistanceModel; +/* + * Gives information over the OpenAL + * implementation and it's state + */ +void QAL_SoundInfo(void); + /* * Loads the OpenAL shared lib, creates * a context and device handle. */ -qboolean QAL_Init( void ); +qboolean QAL_Init(void); /* * Shuts OpenAL down, frees all context and * device handles and unloads the shared lib. */ -void QAL_Shutdown( void ); +void QAL_Shutdown(void); + +#endif /* _QAL_API_H_ */ diff --git a/src/client/sound/qal_api.c b/src/client/sound/qal_api.c index 5bf7393a..a06b102c 100644 --- a/src/client/sound/qal_api.c +++ b/src/client/sound/qal_api.c @@ -30,7 +30,9 @@ */ #include +#include #include +#include #include "../../common/header/common.h" #include "header/qal_api.h" @@ -138,7 +140,58 @@ LPALDOPPLERFACTOR qalDopplerFactor; LPALDOPPLERVELOCITY qalDopplerVelocity; LPALSPEEDOFSOUND qalSpeedOfSound; LPALDISTANCEMODEL qalDistanceModel; - + +/* + * Gives information over the OpenAL + * implementation and it's state + */ +void QAL_SoundInfo() +{ + Com_Printf("OpenAL settings:\n"); + Com_Printf("AL_VENDOR: %s\n", qalGetString(AL_VENDOR)); + Com_Printf("AL_RENDERER: %s\n", qalGetString(AL_RENDERER)); + Com_Printf("AL_VERSION: %s\n", qalGetString(AL_VERSION)); + Com_Printf("AL_EXTENSIONS: %s\n", qalGetString(AL_EXTENSIONS)); + + if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) + { + const char *devs = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); + + Com_Printf("\nAvailable OpenAL devices:\n"); + + if (devs == NULL) + { + Com_Printf("- No devices found. Depending on your\n"); + Com_Printf(" platform this may be expected and\n"); + Com_Printf(" doesn't indicate a problem!\n"); + } + else + { + while (devs && *devs) + { + Com_Printf("- %s\n", devs); + devs += strlen(devs) + 1; + } + } + } + + if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) + { + const char *devs = alcGetString(NULL, ALC_DEVICE_SPECIFIER); + + Com_Printf("\nCurrent OpenAL device:\n"); + + if (devs == NULL) + { + Com_Printf("- No OpenAL device in use\n"); + } + else + { + Com_Printf("- %s\n", devs); + } + } +} + /* * Shuts OpenAL down, frees all context and * device handles and unloads the shared lib. @@ -422,6 +475,11 @@ QAL_Init() Com_Printf("ok\n"); + /* Print OpenAL informations */ + Com_Printf("\n"); + QAL_SoundInfo(); + Com_Printf("\n"); + return true; } diff --git a/src/client/sound/snd_al.c b/src/client/sound/snd_al.c index c61f69ff..f94b4bc3 100644 --- a/src/client/sound/snd_al.c +++ b/src/client/sound/snd_al.c @@ -49,14 +49,6 @@ static void S_AL_StreamUpdate( void ); static void S_AL_StreamDie( void ); // /Forward Declarations -void AL_SoundInfo( void ) { - Com_Printf( "AL_VENDOR: %s\n", qalGetString( AL_VENDOR ) ); - Com_Printf( "AL_RENDERER: %s\n", qalGetString( AL_RENDERER ) ); - Com_Printf( "AL_VERSION: %s\n", qalGetString( AL_VERSION ) ); - Com_Printf( "AL_EXTENSIONS: %s\n", qalGetString( AL_EXTENSIONS ) ); - Com_Printf( "Number of sources: %d\n", s_numchannels ); -} - static void AL_InitStreamSource() { qalSourcei (streamSource, AL_BUFFER, 0 ); qalSourcei (streamSource, AL_LOOPING, AL_FALSE ); @@ -108,10 +100,9 @@ qboolean AL_Init( void ) { s_numchannels = i; AL_InitStreamSource(); + + Com_Printf("Number of OpenAL sources: %d\n\n", s_numchannels); - Com_Printf("\nOpenAL setting:\n"); - AL_SoundInfo(); - Com_Printf("\n"); return true; fail: diff --git a/src/client/sound/snd_dma.c b/src/client/sound/snd_dma.c index 83b7e922..c52c5d7f 100644 --- a/src/client/sound/snd_dma.c +++ b/src/client/sound/snd_dma.c @@ -29,6 +29,7 @@ #include "../header/client.h" #include "header/local.h" #include "header/vorbis.h" +#include "header/qal_api.h" void S_Play ( void ); void S_SoundList ( void ); @@ -108,7 +109,8 @@ S_SoundInfo_f ( void ) } #if USE_OPENAL if(sound_started == SS_OAL) { - AL_SoundInfo(); + QAL_SoundInfo(); + Com_Printf("\nNumber of sources: %d\n", s_numchannels); } else #endif DMA_SoundInfo();