mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-20 20:41:10 +00:00
Stereo Mode: fix unsequenced track fading at the end
- Starts both stereo and stereo_fade in tandem - Suspends the tune which is not to be heard - Swaps suspension when toggling SEQ - Special handling so fade-out can not be interrupted by switching off SEQ
This commit is contained in:
parent
64aaf02b8a
commit
95f4768e46
2 changed files with 35 additions and 5 deletions
|
|
@ -80,6 +80,27 @@ static void M_SoundTestSeq(INT32 choice)
|
|||
(void)choice;
|
||||
|
||||
soundtest.autosequence ^= true;
|
||||
|
||||
if (soundtest.playing && S_SoundTestCanSequenceFade())
|
||||
{
|
||||
boolean unfaded = Music_DurationLeft("stereo_fade") > Music_FadeOutDuration("stereo_fade") * TICRATE / 1000;
|
||||
|
||||
// 1) You cannot cancel a fade once it has started
|
||||
// 2) However, if the fade wasn't heard, switching
|
||||
// over restarts the fade
|
||||
if (!unfaded && Music_Suspended("stereo_fade"))
|
||||
{
|
||||
Music_DelayEnd("stereo_fade", 0);
|
||||
unfaded = true;
|
||||
}
|
||||
|
||||
if (unfaded)
|
||||
{
|
||||
soundtest.tune ^= 1;
|
||||
Music_UnSuspend(S_SoundTestTune(0));
|
||||
Music_Suspend(S_SoundTestTune(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M_SoundTestShf(INT32 choice)
|
||||
|
|
|
|||
|
|
@ -1657,6 +1657,12 @@ boolean S_SoundTestCanSequenceFade(void)
|
|||
soundtest.currenttrack == soundtest.current->numtracks-1;
|
||||
}
|
||||
|
||||
static void S_SoundTestReconfigure(const char *tune)
|
||||
{
|
||||
Music_Remap(tune, soundtest.current->name[soundtest.currenttrack]);
|
||||
Music_Play(tune);
|
||||
}
|
||||
|
||||
void S_SoundTestPlay(void)
|
||||
{
|
||||
UINT32 sequencemaxtime = 0;
|
||||
|
|
@ -1670,9 +1676,8 @@ void S_SoundTestPlay(void)
|
|||
soundtest.playing = true;
|
||||
soundtest.tune = (soundtest.autosequence == true && S_SoundTestCanSequenceFade() == true);
|
||||
|
||||
Music_Remap(soundtest.tune, soundtest.current->name[soundtest.currenttrack]);
|
||||
Music_Loop(soundtest.tune, !soundtest.current->basenoloop[soundtest.currenttrack]);
|
||||
Music_Play(soundtest.tune);
|
||||
S_SoundTestReconfigure("stereo");
|
||||
S_SoundTestReconfigure("stereo_fade");
|
||||
|
||||
// Assuming this song is now actually playing
|
||||
sequencemaxtime = I_GetSongLength();
|
||||
|
|
@ -1701,8 +1706,12 @@ void S_SoundTestPlay(void)
|
|||
}
|
||||
}
|
||||
|
||||
// ms to TICRATE conversion
|
||||
Music_DelayEnd(S_SoundTestTune(0), (TICRATE*sequencemaxtime)/1000);
|
||||
Music_DelayEnd(
|
||||
S_SoundTestCanSequenceFade() ? "stereo_fade" : "stereo",
|
||||
(TICRATE*sequencemaxtime)/1000 // ms to TICRATE conversion
|
||||
);
|
||||
|
||||
Music_Suspend(S_SoundTestTune(1));
|
||||
}
|
||||
|
||||
void S_SoundTestStop(void)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue