From 53fc4aec0a4691835025812f0104edc96e8a7038 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 29 Mar 2023 15:08:01 +0100 Subject: [PATCH] Adjustments to user handling of Stereo Per VC discussion: - Pressing STOP does not NULL your selected song - ...unless you press it a second time while already stopped - Pressing PLAY should de-activate pause if active, not restart the track - Pressing PAUSE while paused should not de-activate pause - Removed the Extra functionality from TRACK. --- src/menus/transient/sound-test.c | 90 ++++++++++++++++---------------- src/s_sound.c | 2 - 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/menus/transient/sound-test.c b/src/menus/transient/sound-test.c index 2ea8880a4..045cdc246 100644 --- a/src/menus/transient/sound-test.c +++ b/src/menus/transient/sound-test.c @@ -11,13 +11,7 @@ static void M_SoundTestMainControl(INT32 choice) // Sound test exception if (soundtest.current == NULL || soundtest.current->numtracks == 0) { - if (currentMenu->menuitems[itemOn].mvar1 == 1) // Play - { - soundtest.playing = true; - //soundtest.sequence = true; - S_UpdateSoundTestDef(false, false, false); - } - else if (cv_soundtest.value != 0) + if (cv_soundtest.value != 0) { S_StopSounds(); @@ -25,6 +19,16 @@ static void M_SoundTestMainControl(INT32 choice) { CV_SetValue(&cv_soundtest, 0); } + else if (currentMenu->menuitems[itemOn].mvar1 == 1) // Play + { + S_StartSound(NULL, cv_soundtest.value); + } + } + else if (currentMenu->menuitems[itemOn].mvar1 == 1) // Play + { + soundtest.playing = true; + //soundtest.sequence = true; + S_UpdateSoundTestDef(false, false, false); } return; @@ -32,19 +36,34 @@ static void M_SoundTestMainControl(INT32 choice) if (currentMenu->menuitems[itemOn].mvar1 == 1) // Play { - S_SoundTestPlay(); - } - else if (soundtest.playing == true) - { - if (currentMenu->menuitems[itemOn].mvar1 == 2) + if (soundtest.paused == true) { S_SoundTestTogglePause(); } - else + else if (soundtest.playing == false) + { + S_SoundTestPlay(); + } + } + else if (soundtest.playing == true) + { + if (currentMenu->menuitems[itemOn].mvar1 == 2) // Pause + { + if (soundtest.paused == false) + { + S_SoundTestTogglePause(); + } + } + else // Stop { S_SoundTestStop(); } } + else if (currentMenu->menuitems[itemOn].mvar1 == 0) // Stop while stopped? + { + soundtest.current = NULL; + soundtest.currenttrack = 0; + } } static void M_SoundTestNextPrev(INT32 choice) @@ -58,53 +77,34 @@ static void M_SoundTestTrack(INT32 choice) { const UINT8 numtracks = (soundtest.current != NULL) ? soundtest.current->numtracks : 0; - if (numtracks == 1) + if (numtracks == 1 // No cycling + || choice == -1) // Extra { return; } + // Confirm is generally treated as Up. + // Soundtest exception if (numtracks == 0) { S_StopSounds(); - - if (choice == -1) // Extra - { - if (cv_soundtest.value != 0) - CV_SetValue(&cv_soundtest, 0); - } - else if (choice == 2) // Confirm - { - if (cv_soundtest.value != 0) - S_StartSound(NULL, cv_soundtest.value); - } - else // Up or Down - { - CV_AddValue(&cv_soundtest, ((choice == 0) ? -1 : 1)); - } + CV_AddValue(&cv_soundtest, ((choice == 0) ? -1 : 1)); return; } - if (choice == -1) // Extra + if (choice == 0) // Down { - soundtest.currenttrack = 0; + soundtest.currenttrack--; + if (soundtest.currenttrack < 0) + soundtest.currenttrack = numtracks-1; } - else + else //if (choice == 1) -- Up { - // Confirm resets the current instance - if (choice == 0) // Down - { - soundtest.currenttrack--; - if (soundtest.currenttrack < 0) - soundtest.currenttrack = numtracks-1; - } - else if (choice == 1) // Up - { - soundtest.currenttrack++; - if (soundtest.currenttrack >= numtracks) - soundtest.currenttrack = 0; - } + soundtest.currenttrack++; + if (soundtest.currenttrack >= numtracks) + soundtest.currenttrack = 0; } if (soundtest.playing) diff --git a/src/s_sound.c b/src/s_sound.c index 918a21c08..cc7ec287d 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1628,8 +1628,6 @@ void S_SoundTestStop(void) soundtest.playing = false; soundtest.paused = false; - soundtest.current = NULL; - soundtest.currenttrack = 0; S_AttemptToRestoreMusic();