engine: added audio backend print to s_info command
This commit is contained in:
parent
d3437c70bd
commit
9f9141823a
5 changed files with 12 additions and 8 deletions
|
@ -1851,7 +1851,7 @@ S_SoundInfo_f
|
||||||
*/
|
*/
|
||||||
void S_SoundInfo_f( void )
|
void S_SoundInfo_f( void )
|
||||||
{
|
{
|
||||||
Con_Printf( "Audio: DirectSound\n" );
|
Con_Printf( "Audio backend: %s\n", dma.backendName );
|
||||||
Con_Printf( "%5d channel(s)\n", 2 );
|
Con_Printf( "%5d channel(s)\n", 2 );
|
||||||
Con_Printf( "%5d samples\n", dma.samples );
|
Con_Printf( "%5d samples\n", dma.samples );
|
||||||
Con_Printf( "%5d bits/sample\n", 16 );
|
Con_Printf( "%5d bits/sample\n", 16 );
|
||||||
|
@ -1927,6 +1927,7 @@ qboolean S_Init( void )
|
||||||
Cmd_AddCommand( "spk", S_SayReliable_f, "reliable play a specified sententce" );
|
Cmd_AddCommand( "spk", S_SayReliable_f, "reliable play a specified sententce" );
|
||||||
Cmd_AddCommand( "speak", S_Say_f, "playing a specified sententce" );
|
Cmd_AddCommand( "speak", S_Say_f, "playing a specified sententce" );
|
||||||
|
|
||||||
|
dma.backendName = "None";
|
||||||
if( !SNDDMA_Init( ) )
|
if( !SNDDMA_Init( ) )
|
||||||
{
|
{
|
||||||
Con_Printf( "Audio: sound system can't be initialized\n" );
|
Con_Printf( "Audio: sound system can't be initialized\n" );
|
||||||
|
|
|
@ -118,6 +118,7 @@ typedef struct
|
||||||
int samplepos; // in mono samples
|
int samplepos; // in mono samples
|
||||||
byte *buffer;
|
byte *buffer;
|
||||||
qboolean initialized; // sound engine is active
|
qboolean initialized; // sound engine is active
|
||||||
|
const char *backendName;
|
||||||
} dma_t;
|
} dma_t;
|
||||||
|
|
||||||
#include "vox.h"
|
#include "vox.h"
|
||||||
|
|
|
@ -209,7 +209,7 @@ qboolean SNDDMA_Init( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
Msg( "OpenSL ES audio initialized.\n" );
|
Msg( "OpenSL ES audio initialized.\n" );
|
||||||
|
dma.backendName = "OpenSL ES";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,12 +185,12 @@ qboolean SNDDMA_Init( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
dma.buffer = Z_Malloc( samples * 2 ); //allocate pcm frame buffer
|
dma.buffer = Z_Malloc( samples * 2 ); //allocate pcm frame buffer
|
||||||
|
|
||||||
dma.samplepos = 0;
|
dma.samplepos = 0;
|
||||||
|
|
||||||
dma.samples = samples;
|
dma.samples = samples;
|
||||||
dma.format.width = 2;
|
dma.format.width = 2;
|
||||||
dma.initialized = 1;
|
dma.initialized = 1;
|
||||||
|
dma.backendName = "ALSA";
|
||||||
|
|
||||||
snd_pcm_prepare( s_alsa.pcm_handle );
|
snd_pcm_prepare( s_alsa.pcm_handle );
|
||||||
snd_pcm_writei( s_alsa.pcm_handle, dma.buffer, 2 * s_alsa.period_size );
|
snd_pcm_writei( s_alsa.pcm_handle, dma.buffer, 2 * s_alsa.period_size );
|
||||||
snd_pcm_start( s_alsa.pcm_handle );
|
snd_pcm_start( s_alsa.pcm_handle );
|
||||||
|
|
|
@ -46,6 +46,7 @@ so it can unlock and free the data block after it has been played.
|
||||||
static int sdl_dev;
|
static int sdl_dev;
|
||||||
static SDL_AudioDeviceID in_dev = 0;
|
static SDL_AudioDeviceID in_dev = 0;
|
||||||
static SDL_AudioFormat sdl_format;
|
static SDL_AudioFormat sdl_format;
|
||||||
|
static char sdl_backend_name[32];
|
||||||
|
|
||||||
//static qboolean snd_firsttime = true;
|
//static qboolean snd_firsttime = true;
|
||||||
//static qboolean primary_format_set;
|
//static qboolean primary_format_set;
|
||||||
|
@ -139,8 +140,9 @@ qboolean SNDDMA_Init( void )
|
||||||
sdl_format = obtained.format;
|
sdl_format = obtained.format;
|
||||||
|
|
||||||
Con_Printf( "Using SDL audio driver: %s @ %d Hz\n", SDL_GetCurrentAudioDriver( ), obtained.freq );
|
Con_Printf( "Using SDL audio driver: %s @ %d Hz\n", SDL_GetCurrentAudioDriver( ), obtained.freq );
|
||||||
|
Q_snprintf( sdl_backend_name, sizeof( sdl_backend_name ), "SDL (%s)", SDL_GetCurrentAudioDriver( ));
|
||||||
dma.initialized = true;
|
dma.initialized = true;
|
||||||
|
dma.backendName = sdl_backend_name;
|
||||||
|
|
||||||
SNDDMA_Activate( true );
|
SNDDMA_Activate( true );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue