33 #include <sys/ioctl.h>
39 #include "../../idlib/precompiled.h"
40 #include "../../sound/snd_local.h"
41 #include "../posix/posix_public.h"
106 common->
Warning(
"failed to close sound device: %s", strerror(errno) );
124 common->
Printf(
"--------------------------------------\n" );
133 sprintf( str,
"%d.%d.%d", ( version & 0xFF0000 ) >> 16, ( version & 0xFF00 ) >> 8, version & 0xFF );
150 common->
Printf(
"------ OSS Sound Initialization ------\n");
152 int requested_sample_format, caps, oss_version;
153 idStr s_compiled_oss_version, s_oss_version;
156 memset( &info, 0,
sizeof( info ) );
171 if ( ( flags = fcntl(
m_audio_fd, F_GETFL ) ) == -1 ) {
176 flags &= ~O_NONBLOCK;
177 if ( fcntl(
m_audio_fd, F_SETFL, flags ) == -1 ) {
192 common->
Printf(
"ioctl SNDCTL_SYSINFO failed: %s\nthis ioctl is only available in OSS/Linux implementation. If you run OSS/Free, don't bother.", strerror( errno ) );
198 common->
Warning(
"ioctl SNDCTL_DSP_GETCAPS failed - driver too old?" );
210 common->
DPrintf(
"OSS interface version %s - compile time %s\n", s_oss_version.
c_str(), s_compiled_oss_version.
c_str() );
212 common->
Warning(
"driver doesn't have DSP_CAP_MMAP capability" );
217 common->
Warning(
"driver doesn't have DSP_CAP_TRIGGER capability" );
226 common->
Warning(
"ioctl SNDCTL_DSP_SETFMT %d failed: %s", requested_sample_format, strerror(errno) );
231 common->
Warning(
"ioctl SNDCTL_DSP_SETFMT failed to get the requested sample format %d, got %d", requested_sample_format,
m_sample_format );
240 common->
Warning(
"invalid value for s_numberOfSpeakers. Use either 2 or 6" );
256 common->
Warning(
"ioctl SNDCTL_DSP_CHANNELS fallback to 2 failed: %s", strerror(errno) );
305 common->
Warning(
"ioctl SNDCTL_DSP_SETTRIGGER 0 failed: %s", strerror(errno) );
309 common->
Warning(
"ioctl SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed: %s", strerror(errno) );
312 common->
Printf(
"--------------------------------------\n");
324 Sys_Printf(
"ioctl SNDCTL_DSP_GETOSPACE failed: %s\n", strerror( errno ) );
380 if ( ( ret = write(
m_audio_fd, (
void*)pos, len ) ) == -1 ) {
381 Sys_Printf(
"write to audio fd failed: %s\n", strerror( errno ) );
assert(prefInfo.fullscreenBtn)
idCVarSystem * cvarSystem
#define SNDCTL_DSP_SETTRIGGER
static idCVar s_numberOfSpeakers
const int MIXBUFFER_SAMPLES
void Sys_Printf(const char *msg,...)
static const int MIXBUFFER_CHUNKS
void ExtractOSSVersion(int version, idStr &str) const
virtual ~idAudioHardwareOSS()
#define ioctl(a, b, c, d)
idCVar s_device("s_dsp","/dev/dsp", CVAR_SYSTEM|CVAR_ARCHIVE,"")
#define PCM_ENABLE_OUTPUT
#define SNDCTL_DSP_CHANNELS
void SetInteger(const int value)
virtual void SetCVarBool(const char *name, const bool value, int flags=0)=0
int GetInteger(void) const
#define SNDCTL_DSP_GETOSPACE
#define SNDCTL_DSP_GETCAPS
virtual void Printf(const char *fmt,...) id_attribute((format(printf
const char * s_driverArgs[]
const char * GetString(void) const
void Write(bool flushing)
void Release(bool bSilent=false)
bool Sys_LoadOpenAL(void)
const char * c_str(void) const
#define SNDCTL_DSP_SETFMT
static idAudioHardware * Alloc()
virtual void DPrintf(const char *fmt,...) id_attribute((format(printf
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
ID_INLINE T Min(T x, T y)
int sprintf(idStr &string, const char *fmt,...)
virtual ~idAudioHardware()