]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_main.c
Rename COM_CheckParm to Sys_CheckParm and move it to sys_shared.c
[xonotic/darkplaces.git] / snd_main.c
index 1509d97b3369439fbd454b6fd4aef380d7219562..c76e503d211d59f5662903fb06fea0d3243d58a8 100644 (file)
@@ -364,6 +364,14 @@ static void S_SoundInfo_f(cmd_state_t *cmd)
        Con_Printf("%5u total_channels\n", total_channels);
 }
 
+static void S_PauseSound_f(cmd_state_t *cmd)
+{
+       if( Cmd_Argc(cmd) != 2 ) {
+               Con_Print("pausesound <pause>\n");
+               return;
+       }
+       S_PauseGameSounds(atoi( Cmd_Argv(cmd, 1 ) ) != 0);
+}
 
 int S_GetSoundRate(void)
 {
@@ -375,6 +383,11 @@ int S_GetSoundChannels(void)
        return snd_renderbuffer ? snd_renderbuffer->format.channels : 0;
 }
 
+int S_GetSoundWidth(void)
+{
+       return snd_renderbuffer ? snd_renderbuffer->format.width : 0;
+}
+
 
 #define SWAP_LISTENERS(l1, l2, tmpl) { tmpl = (l1); (l1) = (l2); (l2) = tmpl; }
 
@@ -517,28 +530,28 @@ void S_Startup (void)
 
        // Parse the command line to see if the player wants a particular sound format
 // COMMANDLINEOPTION: Sound: -sndquad sets sound output to 4 channel surround
-       if (COM_CheckParm ("-sndquad") != 0)
+       if (Sys_CheckParm ("-sndquad") != 0)
        {
                chosen_fmt.channels = 4;
        }
 // COMMANDLINEOPTION: Sound: -sndstereo sets sound output to stereo
-       else if (COM_CheckParm ("-sndstereo") != 0)
+       else if (Sys_CheckParm ("-sndstereo") != 0)
        {
                chosen_fmt.channels = 2;
        }
 // COMMANDLINEOPTION: Sound: -sndmono sets sound output to mono
-       else if (COM_CheckParm ("-sndmono") != 0)
+       else if (Sys_CheckParm ("-sndmono") != 0)
        {
                chosen_fmt.channels = 1;
        }
 // COMMANDLINEOPTION: Sound: -sndspeed <hz> chooses sound output rate (supported values are 48000, 44100, 32000, 24000, 22050, 16000, 11025 (quake), 8000)
-       i = COM_CheckParm ("-sndspeed");
+       i = Sys_CheckParm ("-sndspeed");
        if (0 < i && i < sys.argc - 1)
        {
                chosen_fmt.speed = atoi (sys.argv[i + 1]);
        }
 // COMMANDLINEOPTION: Sound: -sndbits <bits> chooses 8 bit or 16 bit or 32bit float sound output
-       i = COM_CheckParm ("-sndbits");
+       i = Sys_CheckParm ("-sndbits");
        if (0 < i && i < sys.argc - 1)
        {
                chosen_fmt.width = atoi (sys.argv[i + 1]) / 8;
@@ -572,7 +585,7 @@ void S_Startup (void)
        {
                chosen_fmt.width = SND_MIN_WIDTH;
        }
-    else if (chosen_fmt.width == 3)
+       else if (chosen_fmt.width == 3)
        {
                chosen_fmt.width = 4;
        }
@@ -762,7 +775,7 @@ void S_Init(void)
        Cvar_RegisterVariable(&snd_identicalsoundrandomization_tics);
 
 // COMMANDLINEOPTION: Sound: -nosound disables sound (including CD audio)
-       if (COM_CheckParm("-nosound"))
+       if (Sys_CheckParm("-nosound"))
        {
                // dummy out Play and Play2 because mods stuffcmd that
                Cmd_AddCommand(CMD_CLIENT, "play", Host_NoOperation_f, "does nothing because -nosound was specified");
@@ -773,13 +786,14 @@ void S_Init(void)
        snd_mempool = Mem_AllocPool("sound", 0, NULL);
 
 // COMMANDLINEOPTION: Sound: -simsound runs sound mixing but with no output
-       if (COM_CheckParm("-simsound"))
+       if (Sys_CheckParm("-simsound"))
                simsound = true;
 
        Cmd_AddCommand(CMD_CLIENT, "play", S_Play_f, "play a sound at your current location (not heard by anyone else)");
        Cmd_AddCommand(CMD_CLIENT, "play2", S_Play2_f, "play a sound globally throughout the level (not heard by anyone else)");
        Cmd_AddCommand(CMD_CLIENT, "playvol", S_PlayVol_f, "play a sound at the specified volume level at your current location (not heard by anyone else)");
        Cmd_AddCommand(CMD_CLIENT, "stopsound", S_StopAllSounds_f, "silence");
+       Cmd_AddCommand(CMD_CLIENT, "pausesound", S_PauseSound_f, "temporary silence");
        Cmd_AddCommand(CMD_CLIENT, "soundlist", S_SoundList_f, "list loaded sounds");
        Cmd_AddCommand(CMD_CLIENT, "soundinfo", S_SoundInfo_f, "print sound system information (such as channels and speed)");
        Cmd_AddCommand(CMD_CLIENT, "snd_restart", S_Restart_f, "restart sound system");