From c0893027da41c485113cb20718edeee5b22e279f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Mar 2018 12:12:14 +0200 Subject: [PATCH] - added a band-aid fix in case Timidity has both chorus and reverb active. This merely addresses the crashing issue, it does nothing about the faulty initialization logic here that causes the chorus not to get initialized properly if reverb is active. The issue needs more in-detail investigation but for now this has to suffice. --- src/sound/timiditypp/playmidi.cpp | 2 +- src/sound/timiditypp/reverb.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sound/timiditypp/playmidi.cpp b/src/sound/timiditypp/playmidi.cpp index 961a7b61d..4ffa768c8 100644 --- a/src/sound/timiditypp/playmidi.cpp +++ b/src/sound/timiditypp/playmidi.cpp @@ -131,11 +131,11 @@ CUSTOM_CVAR(Int, timidity_chorus, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(Bool, timidity_surround_chorus, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - ChangeVarSync(TimidityPlus::timidity_surround_chorus, *self); if (currSong != nullptr && currSong->GetDeviceType() == MDEV_TIMIDITY) { MIDIDeviceChanged(-1, true); } + ChangeVarSync(TimidityPlus::timidity_surround_chorus, *self); } CUSTOM_CVAR(Bool, timidity_channel_pressure, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) diff --git a/src/sound/timiditypp/reverb.cpp b/src/sound/timiditypp/reverb.cpp index c83e1f568..ae7401143 100644 --- a/src/sound/timiditypp/reverb.cpp +++ b/src/sound/timiditypp/reverb.cpp @@ -1878,6 +1878,14 @@ void Reverb::do_ch_stereo_chorus(int32_t *buf, int32_t count, InfoStereoChorus * return; } + if (bufL == nullptr) + { + set_delay(&(info->delayL), info->rpt0); + set_delay(&(info->delayR), info->rpt0); + bufL = info->delayL.buf; + bufR = info->delayR.buf; + } + /* LFO */ f0 = imuldiv24(lfobufL[imuldiv24(lfocnt, icycle)], depth); spt0 = wpt0 - pdelay - (f0 >> 8); /* integral part of delay */