/* ================== SNDDMA_Init Try to find a sound device to mix for. Returns false if nothing is found. ================== */ int SNDDMA_Init( void *hInst ) { si_state_t stat = SIS_FAILURE; // assume DirectSound won't initialize // already initialized if( dma.initialized ) return true; Q_memset( &dma, 0, sizeof( dma )); s_primary = Cvar_Get( "s_primary", "0", CVAR_INIT, "use direct primary buffer" ); // init DirectSound stat = SNDDMA_InitDirect( hInst ); if( stat == SIS_SUCCESS ) { if( snd_firsttime ) MsgDev( D_INFO, "Audio: DirectSound\n" ); } else { if( snd_firsttime ) MsgDev( D_ERROR, "SNDDMA_Init: can't initialize sound device\n" ); return false; } dma.initialized = true; snd_firsttime = false; return true; }
qboolean SNDDMA_Init (void) { sndinitstat stat; if (COM_CheckParm ("-wavonly")) wavonly = true; dsound_init = wav_init = 0; stat = SIS_FAILURE; // assume DirectSound won't // initialize /* Init DirectSound */ if (!wavonly) { if (snd_firsttime || snd_isdirect) { stat = SNDDMA_InitDirect ();; if (stat == SIS_SUCCESS) { snd_isdirect = true; if (snd_firsttime) Con_Printf ("DirectSound initialized\n"); } else { snd_isdirect = false; Con_Printf ("DirectSound failed to init\n"); } } } // if DirectSound didn't succeed in initializing, try to initialize // waveOut sound, unless DirectSound failed because the hardware is // already allocated (in which case the user has already chosen not // to have sound) if (!dsound_init && (stat != SIS_NOTAVAIL)) { if (snd_firsttime || snd_iswave) { snd_iswave = SNDDMA_InitWav (); if (snd_iswave) { if (snd_firsttime) Con_Printf ("Wave sound initialized\n"); } else { Con_Printf ("Wave sound failed to init\n"); } } } snd_firsttime = false; if (!dsound_init && !wav_init) { if (snd_firsttime) Con_Printf ("No sound device initialized\n"); return 0; } return 1; }
//Try to find a sound device to mix for. //Returns false if nothing is found. qbool SNDDMA_Init(void) { sndinitstat stat; Cvar_SetCurrentGroup(CVAR_GROUP_SOUND); Cvar_Register (&sys_inactivesound); Cvar_ResetCurrentGroup (); if (COM_CheckParm ("-wavonly")) wavonly = true; dsound_init = wav_init = 0; stat = SIS_FAILURE; // assume DirectSound won't initialize /* Init DirectSound */ if (!wavonly) { if (snd_firsttime || snd_isdirect) { stat = SNDDMA_InitDirect (); if (stat == SIS_SUCCESS) { snd_isdirect = true; if (snd_firsttime) Com_Printf_State (PRINT_OK, "DirectSound initialized\n"); } else { snd_isdirect = false; Com_Printf_State (PRINT_FAIL, "DirectSound failed to init\n"); } } } // if DirectSound didn't succeed in initializing, try to initialize waveOut sound if (!dsound_init) { if (snd_firsttime || snd_iswave) { snd_iswave = SNDDMA_InitWav (); if (snd_iswave) { if (snd_firsttime) Com_Printf_State (PRINT_OK, "Wave sound initialized\n"); } else { Com_Printf_State (PRINT_FAIL, "Wave sound failed to init\n"); } } } snd_firsttime = false; if (!dsound_init && !wav_init) { if (snd_firsttime) Com_Printf_State (PRINT_INFO, "No sound device initialized\n"); return false; } return true; }
/* SNDDMA_Init Try to find a sound device to mix for. Returns false if nothing is found. */ static volatile dma_t * SNDDMA_Init (void) { sndinitstat stat; stat = SIS_FAILURE; // assume DirectSound won't // initialize /* Init DirectSound */ if (snd_firsttime) { snd_firsttime = false; stat = SNDDMA_InitDirect (); if (stat == SIS_SUCCESS) { Sys_Printf ("DirectSound initialized\n"); } else { Sys_Printf ("DirectSound failed to init\n"); return 0; } } return &sn; }
/* * S_Activate * * Called when the main window gains or loses focus. * The window have been destroyed and recreated * between a deactivate and an activate. */ void S_Activate( bool active ) { if( !pDS ) return; if( s_globalfocus->modified ) { SNDDMA_Shutdown( false ); SNDDMA_InitDirect( false ); s_globalfocus->modified = false; if( !pDS ) return; } // just set the priority for directsound if( pDS->lpVtbl->SetCooperativeLevel( pDS, cl_hwnd, DSSCL_PRIORITY ) != DS_OK ) { Com_Printf( "DirectSound SetCooperativeLevel failed\n" ); SNDDMA_Shutdown( false ); } }
/* ================== SNDDMA_Init Try to find a sound device to mix for. Returns 0 if nothing is found. ================== */ int SNDDMA_Init(void) { sndinitstat stat; memset ((void *)&dma, 0, sizeof (dma)); s_soundsystem = Cvar_Get ("s_soundsystem", "1", CVAR_ARCHIVE ); s_soundquality = Cvar_Get ("s_soundquality", "2", CVAR_ARCHIVE ); s_buffersize = Cvar_Get ("s_buffersize", "1", CVAR_ARCHIVE); dsound_init = wav_init = 0; stat = SIS_FAILURE; // assume DirectSound won't initialize switch ((long int)s_khz->value) { case 96: dma.speed = 96000; break; case 48: dma.speed = 48000; break; case 44: dma.speed = 44100; break; case 22: dma.speed = 22050; break; case 11: dma.speed = 11025; break; case 8: dma.speed = 8000; break; default: dma.speed = 22050; // Default to ok quality break; } /* Init DirectSound */ if (s_soundsystem->value == 2) { //if (snd_firsttime || snd_isdirect) //{ stat = SNDDMA_InitDirect (); if (stat == SIS_SUCCESS) { snd_isdirect = 1; //if (snd_firsttime) Com_Printf ("DirectSound 8 initialization succeeded\n" ); } else { snd_isdirect = 0; Com_Printf ("*** DirectSound 8 initialization failed ***\n"); } //} } /* Init WaveOut */ else if (s_soundsystem->value == 1) { //if (snd_firsttime || snd_iswave) //{ snd_iswave = SNDDMA_InitWav (); if (snd_iswave) { if (snd_firsttime) Com_Printf ("Wave sound init succeeded\n"); } else { Com_Printf ("Wave sound init failed\n"); } //} } /* No Audio */ else if (s_soundsystem->value == 0) S_Shutdown(); snd_firsttime = 0; snd_buffer_count = 1; if (!dsound_init && !wav_init) { Com_Printf ("*** No sound device initialized ***\n"); } // NeVo - initialize Winamp Integration S_WinAmp_Init(); if (s_soundsystem->value == 0) return 0; return 1; }
/* ================== SNDDMA_Init Try to find a sound device to mix for. Returns false if nothing is found. ================== */ int SNDDMA_Init(void) { sndinitstat stat; memset ((void *)&dma, 0, sizeof (dma)); s_wavonly = Cvar_Get ("s_wavonly", "0", 0); dsound_init = wav_init = 0; stat = SIS_FAILURE; // assume DirectSound won't initialize /* Init DirectSound */ if (!s_wavonly->value) { if (snd_firsttime || snd_isdirect) { stat = SNDDMA_InitDirect (); if (stat == SIS_SUCCESS) { snd_isdirect = true; if (snd_firsttime) Com_Printf ("dsound init succeeded\n" ); } else { snd_isdirect = false; Com_Printf ("*** dsound init failed ***\n"); } } } // if DirectSound didn't succeed in initializing, try to initialize // waveOut sound, unless DirectSound failed because the hardware is // already allocated (in which case the user has already chosen not // to have sound) if (!dsound_init && (stat != SIS_NOTAVAIL)) { if (snd_firsttime || snd_iswave) { snd_iswave = SNDDMA_InitWav (); if (snd_iswave) { if (snd_firsttime) Com_Printf ("Wave sound init succeeded\n"); } else { Com_Printf ("Wave sound init failed\n"); } } } snd_firsttime = false; snd_buffer_count = 1; if (!dsound_init && !wav_init) { if (snd_firsttime) Com_Printf ("*** No sound device initialized ***\n"); return 0; } return 1; }
/* * SNDDMA_Init * * Try to find a sound device to mix for. * Returns false if nothing is found. */ bool SNDDMA_Init( void *hwnd, bool verbose ) { sndinitstat stat; cl_hwnd = ( HWND )hwnd; memset( (void *)&dma, 0, sizeof( dma ) ); s_wavonly = trap_Cvar_Get( "s_wavonly", "0", CVAR_LATCH_SOUND|CVAR_ARCHIVE ); s_globalfocus->modified = false; dsound_init = wav_init = false; stat = SIS_FAILURE; // assume DirectSound won't initialize /* Init DirectSound */ if( !s_wavonly->integer ) { if( /*snd_isdirect*/1 ) { stat = SNDDMA_InitDirect( verbose ); if( stat == SIS_SUCCESS ) { snd_isdirect = true; if( verbose ) Com_Printf( "dsound init succeeded\n" ); } else { snd_isdirect = false; Com_Printf( "*** dsound init failed ***\n" ); } } } // if DirectSound didn't succeed in initializing, try to initialize // waveOut sound, unless DirectSound failed because the hardware is // already allocated (in which case the user has already chosen not // to have sound) if( !dsound_init && ( stat != SIS_NOTAVAIL ) ) { if( /*snd_iswave*/1 ) { snd_iswave = SNDDMA_InitWav( verbose ); if( snd_iswave ) { if( verbose ) Com_Printf( "Wave sound init succeeded\n" ); } else { Com_Printf( "Wave sound init failed\n" ); } } } if( !dsound_init && !wav_init ) { Com_Printf( "*** No sound device initialized ***\n" ); return false; } return true; }
qbool SNDDMA_Init(void) { sndinitstat stat; if (COM_CheckParm ("-wavonly")) wavonly = true; dsound_init = wav_init = 0; stat = SIS_FAILURE; // assume DirectSound won't initialize /* Init DirectSound */ if (!wavonly) { if (snd_firsttime || snd_isdirect) { stat = SNDDMA_InitDirect ();; if (stat == SIS_SUCCESS) { snd_isdirect = true; // if (snd_firsttime) Com_Printf ("DirectSound initialized\n"); } else { snd_isdirect = false; Com_Printf ("DirectSound failed to init\n"); } } } // if DirectSound didn't succeed in initializing, try to initialize // waveOut sound if (!dsound_init) { if (snd_firsttime || snd_iswave) { snd_iswave = SNDDMA_InitWav (); if (snd_iswave) { if (snd_firsttime) Com_Printf ("Wave sound initialized\n"); } else { Com_Printf ("Wave sound failed to init\n"); } } } snd_firsttime = false; if (!dsound_init && !wav_init) { if (snd_firsttime) Com_Printf ("No sound device initialized\n"); return false; } return true; }