28 #include "../../idlib/precompiled.h"
29 #include "../../sound/snd_local.h"
30 #include "../posix/posix_public.h"
35 static idCVar s_alsa_pcm(
"s_alsa_pcm",
"default",
CVAR_SYSTEM |
CVAR_ARCHIVE,
"which alsa pcm device to use. default, hwplug, hw.. see alsa docs" );
57 common->
Printf(
"dlsym(\"snd_asoundlib_version\") failed: %s\n", dlerror() );
58 common->
Warning(
"please consider upgrading alsa to a more recent version." );
70 ALSA_DLSYM(snd_pcm_hw_params_set_buffer_size_min);
114 common->
Printf(
"--------------------------------------\n" );
125 common->
Printf(
"------ Alsa Sound Initialization -----\n" );
140 snd_pcm_hw_params_t *hwparams;
165 common->
Warning(
"invalid value for s_numberOfSpeakers. Use either 2 or 6" );
197 snd_pcm_uframes_t frames;
216 common->
Printf(
"device buffer size: %lu frames ( %lu bytes )\n", (
long unsigned int )frames, frames *
m_channels * 2 );
231 assert( curstate == SND_PCM_STATE_PREPARED );
234 common->
Printf(
"--------------------------------------\n" );
244 common->
Printf(
"----------- Alsa Shutdown ------------\n" );
246 common->
Printf(
"--------------------------------------\n" );
274 snd_pcm_state_t state;
276 if ( state != SND_PCM_STATE_RUNNING && state != SND_PCM_STATE_PREPARED ) {
282 Sys_Printf(
"preparing audio device for output\n" );
310 if ( frames != -EAGAIN ) {
pfn_snd_pcm_hw_params_set_buffer_size_min id_snd_pcm_hw_params_set_buffer_size_min
assert(prefInfo.fullscreenBtn)
idCVarSystem * cvarSystem
static idCVar s_numberOfSpeakers
virtual ~idAudioHardwareALSA()
const int MIXBUFFER_SAMPLES
const char *(* pfn_snd_asoundlib_version)(void)
void Sys_Printf(const char *msg,...)
pfn_snd_pcm_hw_params id_snd_pcm_hw_params
pfn_snd_pcm_hw_params_set_rate id_snd_pcm_hw_params_set_rate
pfn_snd_pcm_hw_params_any id_snd_pcm_hw_params_any
short * GetMixBuffer(void)
pfn_snd_pcm_hw_params_set_access id_snd_pcm_hw_params_set_access
#define id_snd_pcm_hw_params_alloca(ptr)
int GetMixBufferSize(void)
void SetInteger(const int value)
virtual void SetCVarBool(const char *name, const bool value, int flags=0)=0
int GetInteger(void) const
pfn_snd_strerror id_snd_strerror
pfn_snd_pcm_writei id_snd_pcm_writei
pfn_snd_asoundlib_version id_snd_asoundlib_version
virtual void Printf(const char *fmt,...) id_attribute((format(printf
pfn_snd_pcm_hw_params_set_format id_snd_pcm_hw_params_set_format
const char * GetString(void) const
void Write(bool flushing)
static WindowRef ValidModeCallbackProc inCallback OSStatus err
pfn_snd_pcm_open id_snd_pcm_open
pfn_snd_pcm_hw_params_set_channels id_snd_pcm_hw_params_set_channels
pfn_snd_pcm_hw_params_get_buffer_size id_snd_pcm_hw_params_get_buffer_size
pfn_snd_pcm_prepare id_snd_pcm_prepare
pfn_snd_pcm_state id_snd_pcm_state
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
pfn_snd_pcm_close id_snd_pcm_close