mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-10 19:01:50 +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;
|
(void)choice;
|
||||||
|
|
||||||
soundtest.autosequence ^= true;
|
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)
|
static void M_SoundTestShf(INT32 choice)
|
||||||
|
|
|
||||||
|
|
@ -1657,6 +1657,12 @@ boolean S_SoundTestCanSequenceFade(void)
|
||||||
soundtest.currenttrack == soundtest.current->numtracks-1;
|
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)
|
void S_SoundTestPlay(void)
|
||||||
{
|
{
|
||||||
UINT32 sequencemaxtime = 0;
|
UINT32 sequencemaxtime = 0;
|
||||||
|
|
@ -1670,9 +1676,8 @@ void S_SoundTestPlay(void)
|
||||||
soundtest.playing = true;
|
soundtest.playing = true;
|
||||||
soundtest.tune = (soundtest.autosequence == true && S_SoundTestCanSequenceFade() == true);
|
soundtest.tune = (soundtest.autosequence == true && S_SoundTestCanSequenceFade() == true);
|
||||||
|
|
||||||
Music_Remap(soundtest.tune, soundtest.current->name[soundtest.currenttrack]);
|
S_SoundTestReconfigure("stereo");
|
||||||
Music_Loop(soundtest.tune, !soundtest.current->basenoloop[soundtest.currenttrack]);
|
S_SoundTestReconfigure("stereo_fade");
|
||||||
Music_Play(soundtest.tune);
|
|
||||||
|
|
||||||
// Assuming this song is now actually playing
|
// Assuming this song is now actually playing
|
||||||
sequencemaxtime = I_GetSongLength();
|
sequencemaxtime = I_GetSongLength();
|
||||||
|
|
@ -1701,8 +1706,12 @@ void S_SoundTestPlay(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ms to TICRATE conversion
|
Music_DelayEnd(
|
||||||
Music_DelayEnd(S_SoundTestTune(0), (TICRATE*sequencemaxtime)/1000);
|
S_SoundTestCanSequenceFade() ? "stereo_fade" : "stereo",
|
||||||
|
(TICRATE*sequencemaxtime)/1000 // ms to TICRATE conversion
|
||||||
|
);
|
||||||
|
|
||||||
|
Music_Suspend(S_SoundTestTune(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SoundTestStop(void)
|
void S_SoundTestStop(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue