From: <sag...@us...> - 2012-12-26 00:28:48
|
Revision: 1479 http://sourceforge.net/p/modplug/code/1479 Author: saga-games Date: 2012-12-26 00:28:39 +0000 (Wed, 26 Dec 2012) Log Message: ----------- [Fix] Fixed crash in reverb that could occour at high sample rates (also unified reverb handling above 50KHz with normal reverb processing) (http://bugs.openmpt.org/view.php?id=329) [Mod] OpenMPT: Version is now 1.21.01.02 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Snd_rvb.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-12-26 00:27:25 UTC (rev 1478) +++ trunk/OpenMPT/mptrack/version.h 2012-12-26 00:28:39 UTC (rev 1479) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 21 #define VER_MINOR 01 -#define VER_MINORMINOR 01 +#define VER_MINORMINOR 02 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Snd_rvb.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_rvb.cpp 2012-12-26 00:27:25 UTC (rev 1478) +++ trunk/OpenMPT/soundlib/Snd_rvb.cpp 2012-12-26 00:28:39 UTC (rev 1479) @@ -35,7 +35,6 @@ LONG gnRvbLOfsVol = 0; // Internal reverb state -static BOOL g_bRvbDownsample2x = 0; static BOOL g_bLastInPresent = 0; static BOOL g_bLastOutPresent = 0; static int g_nLastRvbIn_xl = 0; @@ -250,19 +249,9 @@ if ((pRvbPreset != spCurrentPreset) || (bReset)) { // Reverb output frequency is half of the dry output rate - FLOAT flOutputFrequency; + FLOAT flOutputFrequency = (FLOAT)CSoundFile::gdwMixingFreq; ENVIRONMENTREVERB rvb; - if (CSoundFile::gdwMixingFreq > 50000) - { - flOutputFrequency = (FLOAT)(CSoundFile::gdwMixingFreq>>1); - g_bRvbDownsample2x = TRUE; - } else - { - flOutputFrequency = (FLOAT)CSoundFile::gdwMixingFreq; - g_bRvbDownsample2x = FALSE; - } - // Reset reverb parameters spCurrentPreset = pRvbPreset; I3dl2_to_Generic(pRvbPreset, &rvb, flOutputFrequency, @@ -274,7 +263,7 @@ + RVBDLY2L_LEN + RVBDLY2R_LEN) / 2); // Store reverb decay time (in samples) for reverb auto-shutdown - gnReverbDecaySamples = (g_bRvbDownsample2x) ? rvb.ReverbDecaySamples * 2 : rvb.ReverbDecaySamples; + gnReverbDecaySamples = rvb.ReverbDecaySamples; // Room attenuation at high frequencies LONG nRoomLP; @@ -392,17 +381,8 @@ lDryVol = 16 - (((16-lDryVol) * lMaxRvbGain) >> 15); X86_ReverbDryMix(MixSoundBuffer, MixReverbBuffer, lDryVol, nSamples); // Downsample 2x + 1st stage of lowpass filter - if (g_bRvbDownsample2x) - { - nIn = X86_ReverbProcessPreFiltering2x(MixReverbBuffer, nSamples); - nOut = nSamples; - if (g_bLastOutPresent) nOut--; - nOut = (nOut+1)>>1; - } else - { - nIn = X86_ReverbProcessPreFiltering1x(MixReverbBuffer, nSamples); - nOut = nIn; - } + nIn = X86_ReverbProcessPreFiltering1x(MixReverbBuffer, nSamples); + nOut = nIn; // Main reverb processing: split into small chunks (needed for short reverb delays) // Reverb Input + Low-Pass stage #2 + Pre-diffusion if (nIn > 0) MMX_ProcessPreDelay(&g_RefDelay, MixReverbBuffer, nIn); @@ -433,14 +413,7 @@ // Adjust nDelayPos, in case nIn != nOut g_RefDelay.nDelayPos = (g_RefDelay.nDelayPos - nOut + nIn) & SNDMIX_REFLECTIONS_DELAY_MASK; // Upsample 2x - if (g_bRvbDownsample2x) - { - MMX_ReverbDCRemoval(MixReverbBuffer, nOut); - X86_ReverbProcessPostFiltering2x(MixReverbBuffer, MixSoundBuffer, nSamples); - } else - { - MMX_ReverbProcessPostFiltering1x(MixReverbBuffer, MixSoundBuffer, nSamples); - } + MMX_ReverbProcessPostFiltering1x(MixReverbBuffer, MixSoundBuffer, nSamples); // Automatically shut down if needed if (gnReverbSend) gnReverbSamples = gnReverbDecaySamples; else if (gnReverbSamples > nSamples) gnReverbSamples -= nSamples; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |