From: <man...@us...> - 2013-06-06 18:09:31
|
Revision: 2308 http://sourceforge.net/p/modplug/code/2308 Author: manxorist Date: 2013-06-06 18:09:24 +0000 (Thu, 06 Jun 2013) Log Message: ----------- [Ref] The equalizer uses the MixFloatBuffer solely for temporal storage of the MixSoundBuffer and does not interact at all with general floating point mixing of plugins. There is thus no reason to apply the mixlevels-specific floating point normalizaton which is stored in CSoundFilePlayConfig. Instead, always normalize floating point values to nominal -1.0...1.0 range in equalizer now. Modified Paths: -------------- trunk/OpenMPT/sounddsp/EQ.cpp trunk/OpenMPT/sounddsp/EQ.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/sounddsp/EQ.cpp =================================================================== --- trunk/OpenMPT/sounddsp/EQ.cpp 2013-06-06 05:02:26 UTC (rev 2307) +++ trunk/OpenMPT/sounddsp/EQ.cpp 2013-06-06 18:09:24 UTC (rev 2308) @@ -309,34 +309,32 @@ #endif -void CEQ::ProcessMono(int *pbuffer, float *MixFloatBuffer, UINT nCount, CSoundFilePlayConfig &config) -//--------------------------------------------------------------------------------------------------- +void CEQ::ProcessMono(int *pbuffer, float *MixFloatBuffer, UINT nCount) +//--------------------------------------------------------------------- { - MonoMixToFloat(pbuffer, MixFloatBuffer, nCount, config.getIntToFloat()); + MonoMixToFloat(pbuffer, MixFloatBuffer, nCount, 1.0f/static_cast<float>(MIXING_CLIPMAX)); for (UINT b=0; b<MAX_EQ_BANDS; b++) { if ((gEQ[b].bEnable) && (gEQ[b].Gain != 1.0f)) EQFilter(&gEQ[b], MixFloatBuffer, nCount); } - FloatToMonoMix(MixFloatBuffer, pbuffer, nCount, config.getFloatToInt()); + FloatToMonoMix(MixFloatBuffer, pbuffer, nCount, static_cast<float>(MIXING_CLIPMAX)); } -void CEQ::ProcessStereo(int *pbuffer, float *MixFloatBuffer, UINT nCount, CSoundFilePlayConfig &config) -//----------------------------------------------------------------------------------------------------- +void CEQ::ProcessStereo(int *pbuffer, float *MixFloatBuffer, UINT nCount) +//----------------------------------------------------------------------- { #ifdef ENABLE_SSE #ifdef ENABLE_MMX - // Still allow the check, because the user can turn this on/off - if(GetProcSupport() & PROCSUPPORT_SSE) { int sse_state, sse_eqstate; - MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, config.getIntToFloat()); + MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, 1.0f/static_cast<float>(MIXING_CLIPMAX)); _asm stmxcsr sse_state; - sse_eqstate = sse_state | 0xFF80; + sse_eqstate = sse_state | 0xFF80; // set flush-to-zero, denormals-are-zero, round-to-zero, mask all exception, leave flags alone _asm ldmxcsr sse_eqstate; for (UINT b=0; b<MAX_EQ_BANDS; b++) { @@ -345,7 +343,7 @@ } _asm ldmxcsr sse_state; - FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, config.getFloatToInt()); + FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, static_cast<float>(MIXING_CLIPMAX)); } else @@ -354,11 +352,9 @@ #ifdef ENABLE_3DNOW - // We still perform the MMX check because the user can enable/disable this - if(GetProcSupport() & PROCSUPPORT_3DNOW) { - MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, config.getIntToFloat()); + MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, 1.0f/static_cast<float>(MIXING_CLIPMAX)); for (UINT b=0; b<MAX_EQ_BANDS; b++) { @@ -367,14 +363,14 @@ AMD_StereoEQ(&gEQ[b], &gEQ[b+MAX_EQ_BANDS], MixFloatBuffer, nCount); } - FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, config.getFloatToInt()); + FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, static_cast<float>(MIXING_CLIPMAX)); } else #endif // ENABLE_3DNOW { - StereoMixToFloat(pbuffer, MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, nCount, config.getIntToFloat()); + StereoMixToFloat(pbuffer, MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, nCount, 1.0f/static_cast<float>(MIXING_CLIPMAX)); for (UINT bl=0; bl<MAX_EQ_BANDS; bl++) { @@ -385,7 +381,7 @@ if ((gEQ[br].bEnable) && (gEQ[br].Gain != 1.0f)) EQFilter(&gEQ[br], MixFloatBuffer+MIXBUFFERSIZE, nCount); } - FloatToStereoMix(MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, pbuffer, nCount, config.getFloatToInt()); + FloatToStereoMix(MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, pbuffer, nCount, static_cast<float>(MIXING_CLIPMAX)); } } Modified: trunk/OpenMPT/sounddsp/EQ.h =================================================================== --- trunk/OpenMPT/sounddsp/EQ.h 2013-06-06 05:02:26 UTC (rev 2307) +++ trunk/OpenMPT/sounddsp/EQ.h 2013-06-06 18:09:24 UTC (rev 2308) @@ -12,9 +12,6 @@ #pragma once -#include "../soundlib/SoundFilePlayConfig.h" - - #define MAX_EQ_BANDS 6 typedef struct ALIGN(4) _EQBANDSTRUCT @@ -41,11 +38,10 @@ EQBANDSTRUCT gEQ[MAX_EQ_BANDS*2]; public: CEQ(); - ~CEQ() {} public: void Initialize(BOOL bReset, DWORD MixingFreq); - void ProcessStereo(int *pbuffer, float *MixFloatBuffer, UINT nCount, CSoundFilePlayConfig &config); - void ProcessMono(int *pbuffer, float *MixFloatBuffer, UINT nCount, CSoundFilePlayConfig &config); + void ProcessStereo(int *pbuffer, float *MixFloatBuffer, UINT nCount); + void ProcessMono(int *pbuffer, float *MixFloatBuffer, UINT nCount); void SetEQGains(const UINT *pGains, UINT nGains, const UINT *pFreqs, BOOL bReset, DWORD MixingFreq); }; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-06 05:02:26 UTC (rev 2307) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-06 18:09:24 UTC (rev 2308) @@ -339,9 +339,9 @@ if (m_MixerSettings.DSPMask & SNDDSP_EQ) { if (m_MixerSettings.gnChannels >= 2) - m_EQ.ProcessStereo(MixSoundBuffer, MixFloatBuffer, lCount, m_PlayConfig); + m_EQ.ProcessStereo(MixSoundBuffer, MixFloatBuffer, lCount); else - m_EQ.ProcessMono(MixSoundBuffer, MixFloatBuffer, lCount, m_PlayConfig); + m_EQ.ProcessMono(MixSoundBuffer, MixFloatBuffer, lCount); } #endif // NO_EQ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |