/* ================= S_Init ================= */ void S_Init( void ) { cvar_t *cv; qboolean started = qfalse; Com_Printf( "------ Initializing Sound ------\n" ); s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE ); s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE ); s_muted = Cvar_Get("s_muted", "0", CVAR_ROM); s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE ); s_backend = Cvar_Get( "s_backend", "", CVAR_ROM ); s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE ); s_muteWhenUnfocused = Cvar_Get( "s_muteWhenUnfocused", "0", CVAR_ARCHIVE ); cv = Cvar_Get( "s_initsound", "1", 0 ); if( !cv->integer ) { Com_Printf( "Sound disabled.\n" ); } else { S_CodecInit( ); Cmd_AddCommand( "play", S_Play_f ); Cmd_AddCommand( "music", S_Music_f ); Cmd_AddCommand( "stopmusic", S_StopMusic_f ); Cmd_AddCommand( "s_list", S_SoundList ); Cmd_AddCommand( "s_stop", S_StopAllSounds ); Cmd_AddCommand( "s_info", S_SoundInfo ); #ifdef URBAN_TERROR /* This doesn't work properly in UrT so disable it by default */ cv = Cvar_Get( "s_useOpenAL", "0", CVAR_ARCHIVE ); #else cv = Cvar_Get( "s_useOpenAL", "1", CVAR_ARCHIVE ); #endif if( cv->integer ) { //OpenAL started = S_AL_Init( &si ); Cvar_Set( "s_backend", "OpenAL" ); } if( !started ) { started = S_Base_Init( &si ); Cvar_Set( "s_backend", "base" ); } if( started ) { if( !S_ValidSoundInterface( &si ) ) { Com_Error( ERR_FATAL, "Sound interface invalid" ); } S_SoundInfo( ); Com_Printf( "Sound initialization successful.\n" ); } else { Com_Printf( "Sound initialization failed.\n" ); } } Com_Printf( "--------------------------------\n"); }
/* ================= S_Init ================= */ void S_Init( void ) { cvar_t *cv; bool started = false; Com_Printf( "------ Initializing Sound ------\n" ); s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE ); s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE ); s_muted = Cvar_Get("s_muted", "0", CVAR_ROM); s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE ); s_backend = Cvar_Get( "s_backend", "", CVAR_ROM ); s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE ); s_muteWhenUnfocused = Cvar_Get( "s_muteWhenUnfocused", "0", CVAR_ARCHIVE ); cv = Cvar_Get( "s_initsound", "1", 0 ); if( !cv->integer ) { Com_Printf( "Sound disabled.\n" ); } else { S_CodecInit( ); Cmd_AddCommand( "play", S_Play_f ); Cmd_SetCommandCompletionFunc( "play", S_CompleteSoundName ); Cmd_AddCommand( "music", S_Music_f ); Cmd_SetCommandCompletionFunc( "music", S_CompleteMusicName ); Cmd_AddCommand( "stopmusic", S_StopMusic_f ); Cmd_AddCommand( "s_list", S_SoundList ); Cmd_AddCommand( "s_stop", S_StopAllSounds ); Cmd_AddCommand( "s_info", S_SoundInfo ); cv = Cvar_Get( "s_useOpenAL", "1", CVAR_ARCHIVE ); if( cv->integer ) { //OpenAL started = S_AL_Init( &si ); Cvar_Set( "s_backend", "OpenAL" ); } if( !started ) { started = S_Base_Init( &si ); Cvar_Set( "s_backend", "base" ); } if( started ) { if( !S_ValidSoundInterface( &si ) ) { Com_Error( ERR_FATAL, "Sound interface invalid" ); } S_SoundInfo( ); Com_Printf( "Sound initialization successful.\n" ); } else { Com_Printf( "Sound initialization failed.\n" ); } } Com_Printf( "--------------------------------\n"); }
/* ================= S_Init ================= */ void S_Init( void ) { convar_t *cv; bool started = false; Com_Printf( "------ Initializing Sound ------\n" ); s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE, "test" ); s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE, "test" ); s_muted = Cvar_Get("s_muted", "0", CVAR_ROM, "test"); s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE, "test" ); s_backend = Cvar_Get( "s_backend", "", CVAR_ROM, "test" ); s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE, "test" ); s_muteWhenUnfocused = Cvar_Get( "s_muteWhenUnfocused", "0", CVAR_ARCHIVE, "test" ); cv = Cvar_Get( "s_initsound", "1", 0, "test" ); if( !cv->integer ) { Com_Printf( "Sound disabled.\n" ); } else { S_CodecInit( ); Cmd_AddCommand( "play", S_Play_f, "^1Plays specified music file (music music.wav)." ); Cmd_AddCommand( "music", S_Music_f, "^1Plays specified music file (music music.wav)." ); Cmd_AddCommand( "stopmusic", S_StopMusic_f, "^1Stop playing music file." ); Cmd_AddCommand( "s_list", S_SoundList, "^1Display paths and filenames of all sound files as they are played." ); Cmd_AddCommand( "s_stop", S_StopAllSounds, "^1Stop whatever sound that is currently playing from playing." ); Cmd_AddCommand( "s_info", S_SoundInfo, "^1Display information about sound system." ); cv = Cvar_Get( "s_useOpenAL", "1", CVAR_ARCHIVE, "test" ); if( cv->integer ) { //OpenAL started = S_AL_Init( &si ); Cvar_Set( "s_backend", "OpenAL" ); } if( !started ) { started = S_Base_Init( &si ); Cvar_Set( "s_backend", "base" ); } if( started ) { if( !S_ValidSoundInterface( &si ) ) { Com_Error( ERR_FATAL, "Sound interface invalid" ); } S_SoundInfo( ); Com_Printf( "Sound initialization successful.\n" ); } else { Com_Printf( "Sound initialization failed.\n" ); } } Com_Printf( "--------------------------------\n"); }
void S_Init() { qbool started = qfalse; Com_Printf( "------ Initializing Sound ------\n" ); s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE ); s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE ); const cvar_t* cv = Cvar_Get( "s_initsound", "1", 0 ); if ( !cv->integer ) { Com_Memset( &si, 0, sizeof(si) ); Com_Printf( "Sound disabled.\n" ); } else { S_CodecInit(); Cmd_AddCommand( "play", S_Play_f ); Cmd_AddCommand( "music", S_Music_f ); Cmd_AddCommand( "s_list", S_SoundList ); Cmd_AddCommand( "s_stop", S_StopAllSounds ); Cmd_AddCommand( "s_info", S_SoundInfo ); started = S_Base_Init( &si ); if ( started ) { if ( !S_ValidSoundInterface() ) { Com_Error( ERR_FATAL, "Sound interface invalid." ); } S_SoundInfo(); Com_Printf( "Sound initialization successful.\n" ); } else { Com_Printf( "Sound initialization failed.\n" ); } } Com_Printf( "--------------------------------\n" ); }
/** * @brief Initiates the sound system */ void S_Init(void) { cvar_t *cv = Cvar_Get("s_initsound", "1", CVAR_ARCHIVE | CVAR_LATCH | CVAR_UNSAFE); // 0 = disabled, 1 = base, 2 = OpenAL Com_Printf("------ Initializing Sound (%i)------\n", cv->integer); s_volume = Cvar_Get("s_volume", "0.8", CVAR_ARCHIVE); s_musicVolume = Cvar_Get("s_musicvolume", "0.25", CVAR_ARCHIVE); s_muted = Cvar_Get("s_muted", "0", CVAR_ROM); s_doppler = Cvar_Get("s_doppler", "1", CVAR_ARCHIVE); s_backend = Cvar_Get("s_backend", "", CVAR_ROM); s_muteWhenMinimized = Cvar_Get("s_muteWhenMinimized", "1", CVAR_ARCHIVE); s_muteWhenUnfocused = Cvar_Get("s_muteWhenUnfocused", "0", CVAR_ARCHIVE); if (!cv->integer) { Com_Printf("Sound disabled.\n"); } else { qboolean started = qfalse; S_CodecInit(); Cmd_AddCommand("play", S_Play_f); Cmd_AddCommand("music", S_Music_f); Cmd_AddCommand("stopmusic", S_StopMusic_f); Cmd_AddCommand("stream", S_Stream_f); Cmd_AddCommand("s_list", S_SoundList); Cmd_AddCommand("s_stop", S_StopAllSounds); Cmd_AddCommand("s_info", S_SoundInfo); #ifdef FEATURE_OPENAL if (cv->integer == 2) { //OpenAL started = S_AL_Init(&si); Cvar_Set("s_backend", "OpenAL"); } #endif // FEATURE_OPENAL if (!started) { if (cv->integer == 2) { Com_Printf("Can't initialize OpenAL - reverting to base interface.\n"); } started = S_Base_Init(&si); Cvar_Set("s_backend", "base"); } if (started) { if (!S_ValidSoundInterface(&si)) { Com_Error(ERR_FATAL, "Invalid sound interface."); } S_SoundInfo(); Com_Printf("Sound initialization successfully done.\ns_backend set to %s\n", s_backend->string); } else { Com_Printf("Sound initialization failed.\n"); } } Com_Printf("--------------------------------\n"); }
/* ================= S_Init ================= */ void S_Init( void ) { cvar_t *cv; qboolean started = qfalse; Com_VPrintf( "------ Initializing Sound ------\n" ); //Com_VPrintf s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE ); s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE ); s_muted = Cvar_Get("s_muted", "0", CVAR_ROM); s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE ); s_backend = Cvar_Get( "s_backend", "", CVAR_ROM ); s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE ); s_muteWhenUnfocused = Cvar_Get( "s_muteWhenUnfocused", "0", CVAR_ARCHIVE ); //muff s_ambientLoopVolume = Cvar_Get( "s_ambientLoopVolume", "0.75", CVAR_ARCHIVE ); Cvar_CheckRange( s_ambientLoopVolume, 0, 1, qfalse ); s_ambientVolume = Cvar_Get( "s_ambientVolume", "0.75", CVAR_ARCHIVE ); Cvar_CheckRange( s_ambientVolume, 0, 1, qfalse ); s_announcerVolume = Cvar_Get( "s_announcerVolume", "0.75", CVAR_ARCHIVE ); Cvar_CheckRange( s_announcerVolume, 0, 1, qfalse ); s_menuMusicVolume = Cvar_Get( "s_menuMusicVolume", "0.25", CVAR_ARCHIVE ); Cvar_CheckRange( s_menuMusicVolume, 0, 1, qfalse ); //-muff cv = Cvar_Get( "s_initsound", "1", 0 ); if( !cv->integer ) { Com_Printf( "Sound disabled.\n" ); } else { S_CodecInit( ); Cmd_AddCommand( "play", S_Play_f ); Cmd_AddCommand( "music", S_Music_f ); Cmd_AddCommand( "stopmusic", S_StopMusic_f ); Cmd_AddCommand( "s_list", S_SoundList ); Cmd_AddCommand( "s_stop", S_StopAllSounds ); Cmd_AddCommand( "s_info", S_SoundInfo ); cv = Cvar_Get( "s_useOpenAL", "0", CVAR_ARCHIVE ); if( cv->integer ) { //OpenAL started = S_AL_Init( &si ); Cvar_Set( "s_backend", "OpenAL" ); } if( !started ) { started = S_Base_Init( &si ); Cvar_Set( "s_backend", "base" ); } if( started ) { if( !S_ValidSoundInterface( &si ) ) { Com_Error( ERR_FATAL, "Sound interface invalid" ); } if ( com_verbose->integer ) S_SoundInfo(); Com_VPrintf( "Sound initialization successful.\n" ); //Com_VPrintf } else { Com_Printf( "Sound initialization failed.\n" ); } } Com_VPrintf( "-------------------------------\n"); //Com_VPrintf }