From: <man...@us...> - 2014-03-07 11:43:29
|
Revision: 3837 http://sourceforge.net/p/modplug/code/3837 Author: manxorist Date: 2014-03-07 11:43:17 +0000 (Fri, 07 Mar 2014) Log Message: ----------- [Ref] DSP: Replace WIN32 types in reverb. [Ref] Replace BOOL with bool in CSoundFile::InitPlayer. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/sounddsp/AGC.cpp trunk/OpenMPT/sounddsp/AGC.h trunk/OpenMPT/sounddsp/DSP.cpp trunk/OpenMPT/sounddsp/DSP.h trunk/OpenMPT/sounddsp/EQ.cpp trunk/OpenMPT/sounddsp/EQ.h trunk/OpenMPT/sounddsp/Reverb.cpp trunk/OpenMPT/sounddsp/Reverb.h trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -1029,7 +1029,7 @@ sndFile.SetEQGains(TrackerSettings::Instance().m_EqSettings.Gains, MAX_EQ_BANDS, TrackerSettings::Instance().m_EqSettings.Freqs, reset?TRUE:FALSE); #endif sndFile.SetDspEffects(TrackerSettings::Instance().MixerDSPMask); - sndFile.InitPlayer(reset?TRUE:FALSE); + sndFile.InitPlayer(reset); } @@ -1044,7 +1044,7 @@ sndFile.SetMixerSettings(TrackerSettings::Instance().GetMixerSettings()); sndFile.SetResamplerSettings(TrackerSettings::Instance().GetResamplerSettings()); UpdateDspEffects(sndFile, false); // reset done in next line - sndFile.InitPlayer(reset?TRUE:FALSE); + sndFile.InitPlayer(reset); } @@ -1332,7 +1332,7 @@ if(!bPatLoop && bPaused) sndFile.m_SongFlags.set(SONG_PAUSED); sndFile.SetRepeatCount((TrackerSettings::Instance().gbLoopSong) ? -1 : 0); - sndFile.InitPlayer(TRUE); + sndFile.InitPlayer(true); sndFile.ResumePlugins(); m_wndToolBar.SetCurrentSong(m_pSndFile); @@ -1430,7 +1430,7 @@ SetPlaybackSoundFile(pSndFile); - m_pSndFile->InitPlayer(TRUE); + m_pSndFile->InitPlayer(true); if(!StartPlayback()) { Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -1020,7 +1020,7 @@ m_SndFile.ResetChannels(); m_SndFile.SetMixerSettings(mixersettings); m_SndFile.SetResamplerSettings(TrackerSettings::Instance().GetResamplerSettings()); - m_SndFile.InitPlayer(TRUE); + m_SndFile.InitPlayer(true); if(!m_dwFileLimit) m_dwFileLimit = Util::MaxValueOfType(m_dwFileLimit) >> 10; m_dwFileLimit <<= 10; Modified: trunk/OpenMPT/sounddsp/AGC.cpp =================================================================== --- trunk/OpenMPT/sounddsp/AGC.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/AGC.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -120,7 +120,7 @@ } -void CAGC::Initialize(BOOL bReset, DWORD MixingFreq) +void CAGC::Initialize(bool bReset, DWORD MixingFreq) //-------------------------------------------------- { if(bReset) Modified: trunk/OpenMPT/sounddsp/AGC.h =================================================================== --- trunk/OpenMPT/sounddsp/AGC.h 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/AGC.h 2014-03-07 11:43:17 UTC (rev 3837) @@ -23,7 +23,7 @@ UINT m_Timeout; public: CAGC(); - void Initialize(BOOL bReset, DWORD MixingFreq); + void Initialize(bool bReset, DWORD MixingFreq); public: void Process(int *MixSoundBuffer, int *RearSoundBuffer, int count, UINT nChannels); void Adjust(UINT oldVol, UINT newVol); Modified: trunk/OpenMPT/sounddsp/DSP.cpp =================================================================== --- trunk/OpenMPT/sounddsp/DSP.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/DSP.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -158,7 +158,7 @@ } -void CDSP::Initialize(BOOL bReset, DWORD MixingFreq, DWORD DSPMask) +void CDSP::Initialize(bool bReset, DWORD MixingFreq, DWORD DSPMask) //----------------------------------------------------------------- { if (!m_Settings.m_nProLogicDelay) m_Settings.m_nProLogicDelay = 20; Modified: trunk/OpenMPT/sounddsp/DSP.h =================================================================== --- trunk/OpenMPT/sounddsp/DSP.h 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/DSP.h 2014-03-07 11:43:17 UTC (rev 3837) @@ -83,7 +83,7 @@ BOOL SetXBassParameters(UINT nDepth, UINT nRange); // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] BOOL SetSurroundParameters(UINT nDepth, UINT nDelay); - void Initialize(BOOL bReset, DWORD MixingFreq, DWORD DSPMask); + void Initialize(bool bReset, DWORD MixingFreq, DWORD DSPMask); void Process(int * MixSoundBuffer, int * MixRearBuffer, int count, UINT nChannels, DWORD DSPMask); private: void ProcessStereoSurround(int * MixSoundBuffer, int count); Modified: trunk/OpenMPT/sounddsp/EQ.cpp =================================================================== --- trunk/OpenMPT/sounddsp/EQ.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/EQ.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -397,7 +397,7 @@ } -void CEQ::Initialize(BOOL bReset, DWORD MixingFreq) +void CEQ::Initialize(bool bReset, DWORD MixingFreq) //------------------------------------------------- { float32 fMixingFreq = (float32)MixingFreq; @@ -406,7 +406,7 @@ { float32 k, k2, r, f; float32 v0, v1; - BOOL b = bReset; + bool b = bReset; f = gEQ[band].CenterFrequency / fMixingFreq; if (f > 0.45f) gEQ[band].Gain = 1; @@ -509,11 +509,11 @@ gEQ[i+MAX_EQ_BANDS].bEnable = false; } } - Initialize(bReset, MixingFreq); + Initialize(bReset?true:false, MixingFreq); } -void CQuadEQ::Initialize(BOOL bReset, DWORD MixingFreq) +void CQuadEQ::Initialize(bool bReset, DWORD MixingFreq) //----------------------------------------------------- { front.Initialize(bReset, MixingFreq); Modified: trunk/OpenMPT/sounddsp/EQ.h =================================================================== --- trunk/OpenMPT/sounddsp/EQ.h 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/EQ.h 2014-03-07 11:43:17 UTC (rev 3837) @@ -39,7 +39,7 @@ public: CEQ(); public: - void Initialize(BOOL bReset, DWORD MixingFreq); + void Initialize(bool bReset, DWORD MixingFreq); 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); @@ -55,7 +55,7 @@ CEQ rear; float EQTempFloatBuffer[MIXBUFFERSIZE * 2]; public: - void Initialize(BOOL bReset, DWORD MixingFreq); + void Initialize(bool bReset, DWORD MixingFreq); void Process(int *frontBuffer, int *rearBuffer, UINT nCount, UINT nChannels); void SetEQGains(const UINT *pGains, UINT nGains, const UINT *pFreqs, BOOL bReset, DWORD MixingFreq); }; Modified: trunk/OpenMPT/sounddsp/Reverb.cpp =================================================================== --- trunk/OpenMPT/sounddsp/Reverb.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/Reverb.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -18,7 +18,7 @@ #pragma warning(disable:4725) // Pentium fdiv bug #pragma warning(disable:4731) // ebp modified -extern void StereoFill(int *pBuffer, UINT nSamples, mixsample_t &lpROfs, mixsample_t &lpLOfs); +extern void StereoFill(int *pBuffer, uint32 nSamples, mixsample_t &lpROfs, mixsample_t &lpLOfs); @@ -67,19 +67,19 @@ // Misc functions -static LONG OnePoleLowPassCoef(LONG scale, float g, float F_c, float F_s); -static LONG mBToLinear(LONG scale, LONG value_mB); -static float mBToLinear(LONG value_mB); +static int32 OnePoleLowPassCoef(int32 scale, float g, float F_c, float F_s); +static int32 mBToLinear(int32 scale, int32 value_mB); +static float mBToLinear(int32 value_mB); struct SNDMIX_REVERB_PROPERTIES { - LONG lRoom; // [-10000, 0] default: -10000 mB - LONG lRoomHF; // [-10000, 0] default: 0 mB + int32 lRoom; // [-10000, 0] default: -10000 mB + int32 lRoomHF; // [-10000, 0] default: 0 mB float flDecayTime; // [0.1, 20.0] default: 1.0 s float flDecayHFRatio; // [0.1, 2.0] default: 0.5 - LONG lReflections; // [-10000, 1000] default: -10000 mB + int32 lReflections; // [-10000, 1000] default: -10000 mB float flReflectionsDelay; // [0.0, 0.3] default: 0.02 s - LONG lReverb; // [-10000, 2000] default: -10000 mB + int32 lReverb; // [-10000, 2000] default: -10000 mB float flReverbDelay; // [0.0, 0.1] default: 0.04 s float flDiffusion; // [0.0, 100.0] default: 100.0 % float flDensity; // [0.0, 100.0] default: 100.0 % @@ -126,7 +126,7 @@ {{ SNDMIX_REVERB_PRESET_UNDERWATER }, "Underwater"}, }; -const char *GetReverbPresetName(UINT nPreset) +const char *GetReverbPresetName(uint32 nPreset) { return (nPreset < NUM_REVERBTYPES) ? gRvbPresets[nPreset].lpszName : NULL; } @@ -138,8 +138,8 @@ typedef struct _REFLECTIONPRESET { - LONG lDelayFactor; - SHORT sGainLL, sGainRR, sGainLR, sGainRL; + int32 lDelayFactor; + int16 sGainLL, sGainRR, sGainLR, sGainRL; } REFLECTIONPRESET, *PREFLECTIONPRESET; const REFLECTIONPRESET gReflectionsPreset[ENVIRONMENT_NUMREFLECTIONS] = @@ -162,18 +162,18 @@ inline long ftol(float f) { return ((long)(f)); } -static VOID I3dl2_to_Generic( +static void I3dl2_to_Generic( const SNDMIX_REVERB_PROPERTIES *pReverb, PENVIRONMENTREVERB pRvb, float flOutputFreq, - LONG lMinRefDelay, - LONG lMaxRefDelay, - LONG lMinRvbDelay, - LONG lMaxRvbDelay, - LONG lTankLength) + int32 lMinRefDelay, + int32 lMaxRefDelay, + int32 lMinRvbDelay, + int32 lMaxRvbDelay, + int32 lTankLength) { float flDelayFactor, flDelayFactorHF, flDecayTimeHF; - LONG lDensity, lTailDiffusion; + int32 lDensity, lTailDiffusion; // Common parameters pRvb->ReverbLevel = pReverb->lReverb; @@ -181,7 +181,7 @@ pRvb->RoomHF = pReverb->lRoomHF; // HACK: Somewhat normalize the reverb output level - LONG lMaxLevel = (pRvb->ReverbLevel > pRvb->ReflectionsLevel) ? pRvb->ReverbLevel : pRvb->ReflectionsLevel; + int32 lMaxLevel = (pRvb->ReverbLevel > pRvb->ReflectionsLevel) ? pRvb->ReverbLevel : pRvb->ReflectionsLevel; if (lMaxLevel < -600) { lMaxLevel += 600; @@ -201,9 +201,9 @@ // Verify reflections and reverb delay parameters float flRefDelay = pReverb->flReflectionsDelay; if (flRefDelay > 0.100f) flRefDelay = 0.100f; - LONG lReverbDelay = ftol(pReverb->flReverbDelay * flOutputFreq); - LONG lReflectionsDelay = ftol(flRefDelay * flOutputFreq); - LONG lReverbDecayTime = ftol(pReverb->flDecayTime * flOutputFreq); + int32 lReverbDelay = ftol(pReverb->flReverbDelay * flOutputFreq); + int32 lReflectionsDelay = ftol(flRefDelay * flOutputFreq); + int32 lReverbDecayTime = ftol(pReverb->flDecayTime * flOutputFreq); if (lReflectionsDelay < lMinRefDelay) { lReverbDelay -= (lMinRefDelay - lReflectionsDelay); @@ -228,7 +228,7 @@ pRvb->ReverbDelay = lReverbDelay; pRvb->ReverbDecaySamples = lReverbDecayTime; // Setup individual reflections delay and gains - for (UINT iRef=0; iRef<ENVIRONMENT_NUMREFLECTIONS; iRef++) + for (uint32 iRef=0; iRef<ENVIRONMENT_NUMREFLECTIONS; iRef++) { PENVIRONMENTREFLECTION pRef = &pRvb->Reflections[iRef]; pRef->Delay = lReflectionsDelay + (gReflectionsPreset[iRef].lDelayFactor * lReverbDelay + 50)/100; @@ -259,8 +259,8 @@ gnRvbROfsVol = 0; // Clear out all reverb state - g_bLastInPresent = FALSE; - g_bLastOutPresent = FALSE; + g_bLastInPresent = false; + g_bLastOutPresent = false; g_nLastRvbIn_xl = g_nLastRvbIn_xr = 0; g_nLastRvbIn_yl = g_nLastRvbIn_yr = 0; g_nLastRvbOut_xl = g_nLastRvbOut_xr = 0; @@ -278,8 +278,8 @@ } -void CReverb::Initialize(BOOL bReset, DWORD MixingFreq) -//----------------------------------------------------- +void CReverb::Initialize(bool bReset, uint32 MixingFreq) +//------------------------------------------------------ { if (m_Settings.m_nReverbType >= NUM_REVERBTYPES) m_Settings.m_nReverbType = 0; static PSNDMIX_REVERB_PROPERTIES spCurrentPreset = NULL; @@ -305,17 +305,17 @@ gnReverbDecaySamples = rvb.ReverbDecaySamples; // Room attenuation at high frequencies - LONG nRoomLP; + int32 nRoomLP; nRoomLP = OnePoleLowPassCoef(32768, mBToLinear(rvb.RoomHF), 5000, flOutputFrequency); - g_RefDelay.nCoeffs[0] = (SHORT)nRoomLP; - g_RefDelay.nCoeffs[1] = (SHORT)nRoomLP; + g_RefDelay.nCoeffs[0] = (int16)nRoomLP; + g_RefDelay.nCoeffs[1] = (int16)nRoomLP; // Pre-Diffusion factor (for both reflections and late reverb) - g_RefDelay.nPreDifCoeffs[0] = (SHORT)(rvb.PreDiffusion*2); - g_RefDelay.nPreDifCoeffs[1] = (SHORT)(rvb.PreDiffusion*2); + g_RefDelay.nPreDifCoeffs[0] = (int16)(rvb.PreDiffusion*2); + g_RefDelay.nPreDifCoeffs[1] = (int16)(rvb.PreDiffusion*2); // Setup individual reflections delay and gains - for (UINT iRef=0; iRef<8; iRef++) + for (uint32 iRef=0; iRef<8; iRef++) { PSWRVBREFLECTION pRef = &g_RefDelay.Reflections[iRef]; pRef->DelayDest = rvb.Reflections[iRef].Delay; @@ -328,7 +328,7 @@ g_LateReverb.nReverbDelay = rvb.ReverbDelay; // Reflections Master Gain - ULONG lReflectionsGain = 0; + uint32 lReflectionsGain = 0; if (rvb.ReflectionsLevel > -9000) { lReflectionsGain = mBToLinear(32768, rvb.ReflectionsLevel); @@ -336,7 +336,7 @@ g_RefDelay.lMasterGain = lReflectionsGain; // Late reverb master gain - ULONG lReverbGain = 0; + uint32 lReverbGain = 0; if (rvb.ReverbLevel > -9000) { lReverbGain = mBToLinear(32768, rvb.ReverbLevel); @@ -344,38 +344,38 @@ g_LateReverb.lMasterGain = lReverbGain; // Late reverb diffusion - ULONG nTailDiffusion = rvb.TankDiffusion; + uint32 nTailDiffusion = rvb.TankDiffusion; if (nTailDiffusion > 0x7f00) nTailDiffusion = 0x7f00; - g_LateReverb.nDifCoeffs[0] = (SHORT)nTailDiffusion; - g_LateReverb.nDifCoeffs[1] = (SHORT)nTailDiffusion; - g_LateReverb.nDifCoeffs[2] = (SHORT)nTailDiffusion; - g_LateReverb.nDifCoeffs[3] = (SHORT)nTailDiffusion; + g_LateReverb.nDifCoeffs[0] = (int16)nTailDiffusion; + g_LateReverb.nDifCoeffs[1] = (int16)nTailDiffusion; + g_LateReverb.nDifCoeffs[2] = (int16)nTailDiffusion; + g_LateReverb.nDifCoeffs[3] = (int16)nTailDiffusion; g_LateReverb.Dif2InGains[0] = 0x7000; g_LateReverb.Dif2InGains[1] = 0x1000; g_LateReverb.Dif2InGains[2] = 0x1000; g_LateReverb.Dif2InGains[3] = 0x7000; // Late reverb decay time - LONG nReverbDecay = rvb.ReverbDecay; + int32 nReverbDecay = rvb.ReverbDecay; if (nReverbDecay < 0) nReverbDecay = 0; if (nReverbDecay > 0x7ff0) nReverbDecay = 0x7ff0; - g_LateReverb.nDecayDC[0] = (SHORT)nReverbDecay; + g_LateReverb.nDecayDC[0] = (int16)nReverbDecay; g_LateReverb.nDecayDC[1] = 0; g_LateReverb.nDecayDC[2] = 0; - g_LateReverb.nDecayDC[3] = (SHORT)nReverbDecay; + g_LateReverb.nDecayDC[3] = (int16)nReverbDecay; // Late Reverb Decay HF float fReverbDamping = rvb.flReverbDamping * rvb.flReverbDamping; - LONG nDampingLowPass; + int32 nDampingLowPass; nDampingLowPass = OnePoleLowPassCoef(32768, fReverbDamping, 5000, flOutputFrequency); if (nDampingLowPass < 0x100) nDampingLowPass = 0x100; if (nDampingLowPass >= 0x7f00) nDampingLowPass = 0x7f00; - g_LateReverb.nDecayLP[0] = (SHORT)nDampingLowPass; + g_LateReverb.nDecayLP[0] = (int16)nDampingLowPass; g_LateReverb.nDecayLP[1] = 0; g_LateReverb.nDecayLP[2] = 0; - g_LateReverb.nDecayLP[3] = (SHORT)nDampingLowPass; + g_LateReverb.nDecayLP[3] = (int16)nDampingLowPass; } if (bReset) { @@ -391,11 +391,11 @@ // [Reverb level 0(quiet)-100(loud)], [type = REVERBTYPE_XXXX] -bool CReverb::SetReverbParameters(UINT nDepth, UINT nType) -//-------------------------------------------------------- +bool CReverb::SetReverbParameters(uint32 nDepth, uint32 nType) +//------------------------------------------------------------ { if (nDepth > 100) nDepth = 100; - UINT gain = (nDepth * 16) / 100; + uint32 gain = (nDepth * 16) / 100; if (gain > 16) gain = 16; if (gain < 1) gain = 1; m_Settings.m_nReverbDepth = gain; @@ -404,8 +404,8 @@ } -int *CReverb::GetReverbSendBuffer(UINT nSamples) -//---------------------------------------------- +int *CReverb::GetReverbSendBuffer(uint32 nSamples) +//------------------------------------------------ { if(!gnReverbSend) { // and we did not clear the buffer yet, do it now because we will get new data @@ -417,8 +417,8 @@ // Reverb -void CReverb::Process(int *MixSoundBuffer, UINT nSamples) -//------------------------------------------------------- +void CReverb::Process(int *MixSoundBuffer, uint32 nSamples) +//--------------------------------------------------------- { if(!(GetProcSupport() & PROCSUPPORT_MMX)) return; if((!gnReverbSend) && (!gnReverbSamples)) @@ -430,23 +430,23 @@ StereoFill(MixReverbBuffer, nSamples, gnRvbROfsVol, gnRvbLOfsVol); } - UINT nIn, nOut; + uint32 nIn, nOut; // Dynamically adjust reverb master gains - LONG lMasterGain; + int32 lMasterGain; lMasterGain = ((g_RefDelay.lMasterGain * m_Settings.m_nReverbDepth) >> 4); if (lMasterGain > 0x7fff) lMasterGain = 0x7fff; - g_RefDelay.ReflectionsGain[0] = (SHORT)lMasterGain; - g_RefDelay.ReflectionsGain[1] = (SHORT)lMasterGain; + g_RefDelay.ReflectionsGain[0] = (int16)lMasterGain; + g_RefDelay.ReflectionsGain[1] = (int16)lMasterGain; lMasterGain = ((g_LateReverb.lMasterGain * m_Settings.m_nReverbDepth) >> 4); if (lMasterGain > 0x10000) lMasterGain = 0x10000; - g_LateReverb.RvbOutGains[0] = (SHORT)((lMasterGain+0x7f) >> 3); // l->l - g_LateReverb.RvbOutGains[1] = (SHORT)((lMasterGain+0xff) >> 4); // r->l - g_LateReverb.RvbOutGains[2] = (SHORT)((lMasterGain+0xff) >> 4); // l->r - g_LateReverb.RvbOutGains[3] = (SHORT)((lMasterGain+0x7f) >> 3); // r->r + g_LateReverb.RvbOutGains[0] = (int16)((lMasterGain+0x7f) >> 3); // l->l + g_LateReverb.RvbOutGains[1] = (int16)((lMasterGain+0xff) >> 4); // r->l + g_LateReverb.RvbOutGains[2] = (int16)((lMasterGain+0xff) >> 4); // l->r + g_LateReverb.RvbOutGains[3] = (int16)((lMasterGain+0x7f) >> 3); // r->r // Process Dry/Wet Mix - LONG lMaxRvbGain = (g_RefDelay.lMasterGain > g_LateReverb.lMasterGain) ? g_RefDelay.lMasterGain : g_LateReverb.lMasterGain; + int32 lMaxRvbGain = (g_RefDelay.lMasterGain > g_LateReverb.lMasterGain) ? g_RefDelay.lMasterGain : g_LateReverb.lMasterGain; if (lMaxRvbGain > 32768) lMaxRvbGain = 32768; - LONG lDryVol = (36 - m_Settings.m_nReverbDepth)>>1; + int32 lDryVol = (36 - m_Settings.m_nReverbDepth)>>1; if (lDryVol < 8) lDryVol = 8; if (lDryVol > 16) lDryVol = 16; lDryVol = 16 - (((16-lDryVol) * lMaxRvbGain) >> 15); @@ -459,15 +459,15 @@ if (nIn > 0) MMX_ProcessPreDelay(&g_RefDelay, MixReverbBuffer, nIn); // Process Reverb Reflections and Late Reverberation int *pRvbOut = MixReverbBuffer; - UINT nRvbSamples = nOut, nCount = 0; + uint32 nRvbSamples = nOut, nCount = 0; while (nRvbSamples > 0) { - UINT nPosRef = g_RefDelay.nRefOutPos & SNDMIX_REVERB_DELAY_MASK; - UINT nPosRvb = (nPosRef - g_LateReverb.nReverbDelay) & SNDMIX_REVERB_DELAY_MASK; - UINT nmax1 = (SNDMIX_REVERB_DELAY_MASK+1) - nPosRef; - UINT nmax2 = (SNDMIX_REVERB_DELAY_MASK+1) - nPosRvb; + uint32 nPosRef = g_RefDelay.nRefOutPos & SNDMIX_REVERB_DELAY_MASK; + uint32 nPosRvb = (nPosRef - g_LateReverb.nReverbDelay) & SNDMIX_REVERB_DELAY_MASK; + uint32 nmax1 = (SNDMIX_REVERB_DELAY_MASK+1) - nPosRef; + uint32 nmax2 = (SNDMIX_REVERB_DELAY_MASK+1) - nPosRvb; nmax1 = (nmax1 < nmax2) ? nmax1 : nmax2; - UINT n = nRvbSamples; + uint32 n = nRvbSamples; if (n > nmax1) n = nmax1; if (n > 64) n = 64; // Reflections output + late reverb delay @@ -497,10 +497,10 @@ } -VOID CReverb::X86_ReverbDryMix(int *pDry, int *pWet, int lDryVol, UINT nSamples) -//------------------------------------------------------------------------------ +void CReverb::X86_ReverbDryMix(int *pDry, int *pWet, int lDryVol, uint32 nSamples) +//-------------------------------------------------------------------------------- { - for (UINT i=0; i<nSamples; i++) + for (uint32 i=0; i<nSamples; i++) { pDry[i*2] += (pWet[i*2]>>4) * lDryVol; pDry[i*2+1] += (pWet[i*2+1]>>4) * lDryVol; @@ -508,13 +508,13 @@ } -UINT CReverb::X86_ReverbProcessPreFiltering2x(int *pWet, UINT nSamples) -//--------------------------------------------------------------------- +uint32 CReverb::X86_ReverbProcessPreFiltering2x(int *pWet, uint32 nSamples) +//------------------------------------------------------------------------- { - UINT nOutSamples = 0; + uint32 nOutSamples = 0; int lowpass = g_RefDelay.nCoeffs[0]; int y1_l = g_nLastRvbIn_yl, y1_r = g_nLastRvbIn_yr; - UINT n = nSamples; + uint32 n = nSamples; if (g_bLastInPresent) { @@ -529,17 +529,17 @@ pWet+=2; n--; nOutSamples = 1; - g_bLastInPresent = FALSE; + g_bLastInPresent = false; } if (n & 1) { n--; g_nLastRvbIn_xl = pWet[n*2]; g_nLastRvbIn_xr = pWet[n*2+1]; - g_bLastInPresent = TRUE; + g_bLastInPresent = true; } n >>= 1; - for (UINT i=0; i<n; i++) + for (uint32 i=0; i<n; i++) { int x1_l = pWet[i*4]; int x2_l = pWet[i*4+2]; @@ -558,13 +558,13 @@ } -UINT CReverb::X86_ReverbProcessPreFiltering1x(int *pWet, UINT nSamples) -//--------------------------------------------------------------------- +uint32 CReverb::X86_ReverbProcessPreFiltering1x(int *pWet, uint32 nSamples) +//------------------------------------------------------------------------- { int lowpass = g_RefDelay.nCoeffs[0]; int y1_l = g_nLastRvbIn_yl, y1_r = g_nLastRvbIn_yr; - for (UINT i=0; i<nSamples; i++) + for (uint32 i=0; i<nSamples; i++) { int x_l = pWet[i*2] >> 12; int x_r = pWet[i*2+1] >> 12; @@ -579,10 +579,10 @@ } -VOID CReverb::X86_ReverbProcessPostFiltering2x(const int *pRvb, int *pDry, UINT nSamples) -//--------------------------------------------------------------------------------------- +void CReverb::X86_ReverbProcessPostFiltering2x(const int *pRvb, int *pDry, uint32 nSamples) +//----------------------------------------------------------------------------------------- { - UINT n0 = nSamples, n; + uint32 n0 = nSamples, n; int x1_l = g_nLastRvbOut_xl, x1_r = g_nLastRvbOut_xr; if (g_bLastOutPresent) @@ -591,10 +591,10 @@ pDry[1] += x1_r; pDry += 2; n0--; - g_bLastOutPresent = FALSE; + g_bLastOutPresent = false; } n = n0 >> 1; - for (UINT i=0; i<n; i++) + for (uint32 i=0; i<n; i++) { int x_l = pRvb[i*2], x_r = pRvb[i*2+1]; pDry[i*4] += (x_l + x1_l)>>1; @@ -611,7 +611,7 @@ pDry[n*4+1] += (x_r + x1_r)>>1; x1_l = x_l; x1_r = x_r; - g_bLastOutPresent = TRUE; + g_bLastOutPresent = true; } g_nLastRvbOut_xl = x1_l; g_nLastRvbOut_xr = x1_r; @@ -621,8 +621,8 @@ #define DCR_AMOUNT 9 // Stereo Add + DC removal -VOID CReverb::MMX_ReverbProcessPostFiltering1x(const int *pRvb, int *pDry, UINT nSamples) -//--------------------------------------------------------------------------------------- +void CReverb::MMX_ReverbProcessPostFiltering1x(const int *pRvb, int *pDry, uint32 nSamples) +//----------------------------------------------------------------------------------------- { __int64 nDCRRvb_X1 = gnDCRRvb_X1; __int64 nDCRRvb_Y1 = gnDCRRvb_Y1; @@ -659,8 +659,8 @@ } -VOID CReverb::MMX_ReverbDCRemoval(int *pBuffer, UINT nSamples) -//------------------------------------------------------------ +void CReverb::MMX_ReverbDCRemoval(int *pBuffer, uint32 nSamples) +//-------------------------------------------------------------- { __int64 nDCRRvb_X1 = gnDCRRvb_X1; __int64 nDCRRvb_Y1 = gnDCRRvb_Y1; @@ -702,8 +702,8 @@ // 3. Insert the result in the reflections delay buffer // -VOID CReverb::MMX_ProcessPreDelay(PSWRVBREFDELAY pPreDelay, const int *pIn, UINT nSamples) -//---------------------------------------------------------------------------------------- +void CReverb::MMX_ProcessPreDelay(PSWRVBREFDELAY pPreDelay, const int *pIn, uint32 nSamples) +//------------------------------------------------------------------------------------------ { _asm { mov eax, pPreDelay @@ -776,8 +776,8 @@ } DUMMYREFARRAY, *PDUMMYREFARRAY; -VOID CReverb::MMX_ProcessReflections(PSWRVBREFDELAY pPreDelay, short int *pRefOut, int *pOut, UINT nSamples) -//---------------------------------------------------------------------------------------------------------- +void CReverb::MMX_ProcessReflections(PSWRVBREFDELAY pPreDelay, short int *pRefOut, int *pOut, uint32 nSamples) +//------------------------------------------------------------------------------------------------------------ { _asm { // First stage @@ -902,8 +902,8 @@ // Late reverberation (with SW reflections) // -VOID CReverb::MMX_ProcessLateReverb(PSWLATEREVERB pReverb, short int *pRefOut, int *pMixOut, UINT nSamples) -//--------------------------------------------------------------------------------------------------------- +void CReverb::MMX_ProcessLateReverb(PSWLATEREVERB pReverb, short int *pRefOut, int *pMixOut, uint32 nSamples) +//----------------------------------------------------------------------------------------------------------- { _asm { push ebp @@ -1012,12 +1012,12 @@ // (1-gcos(w)-sqrt(2g(1-cos w) - g2(1-(cos w)^2))) / (1-g) -static LONG OnePoleLowPassCoef(LONG scale, float g, float F_c, float F_s) -//---------------------------------------------------------------- +static int32 OnePoleLowPassCoef(int32 scale, float g, float F_c, float F_s) +//------------------------------------------------------------------------- { float cosw; // cos(2*PI*Fc/Fs) float scale_over_1mg; // scale / (1.0f - g); - LONG result; + int32 result; if (g > 0.999999f) return 0; _asm { @@ -1066,7 +1066,7 @@ } -static LONG mBToLinear(LONG scale, LONG value_mB) +static int32 mBToLinear(int32 scale, int32 value_mB) { // factor = log2(10)/(100*20) const float _factor = 3.321928094887362304f / (100.0f * 20.0f); @@ -1093,7 +1093,7 @@ } -static float mBToLinear(LONG value_mB) +static float mBToLinear(int32 value_mB) { // factor = log2(10)/(100*20) const float _factor = 3.321928094887362304f / (100.0f * 20.0f); Modified: trunk/OpenMPT/sounddsp/Reverb.h =================================================================== --- trunk/OpenMPT/sounddsp/Reverb.h 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/sounddsp/Reverb.h 2014-03-07 11:43:17 UTC (rev 3837) @@ -25,22 +25,22 @@ typedef struct _SWRVBREFLECTION { - ULONG Delay, DelayDest; - SHORT Gains[4]; // g_ll, g_rl, g_lr, g_rr + uint32 Delay, DelayDest; + int16 Gains[4]; // g_ll, g_rl, g_lr, g_rr } SWRVBREFLECTION, *PSWRVBREFLECTION; typedef struct _SWRVBREFDELAY { - ULONG nDelayPos, nPreDifPos, nRefOutPos; - LONG lMasterGain; // reflections linear master gain - SHORT nCoeffs[2]; // room low-pass coefficients - SHORT History[2]; // room low-pass history - SHORT nPreDifCoeffs[2]; // prediffusion coefficients - SHORT ReflectionsGain[2]; // master reflections gain + uint32 nDelayPos, nPreDifPos, nRefOutPos; + int32 lMasterGain; // reflections linear master gain + int16 nCoeffs[2]; // room low-pass coefficients + int16 History[2]; // room low-pass history + int16 nPreDifCoeffs[2]; // prediffusion coefficients + int16 ReflectionsGain[2]; // master reflections gain SWRVBREFLECTION Reflections[8]; // Up to 8 SW Reflections - short int RefDelayBuffer[(SNDMIX_REFLECTIONS_DELAY_MASK+1)*2]; // reflections delay buffer - short int PreDifBuffer[(SNDMIX_PREDIFFUSION_DELAY_MASK+1)*2]; // pre-diffusion - short int RefOut[(SNDMIX_REVERB_DELAY_MASK+1)*2]; // stereo output of reflections + int16 RefDelayBuffer[(SNDMIX_REFLECTIONS_DELAY_MASK+1)*2]; // reflections delay buffer + int16 PreDifBuffer[(SNDMIX_PREDIFFUSION_DELAY_MASK+1)*2]; // pre-diffusion + int16 RefOut[(SNDMIX_REVERB_DELAY_MASK+1)*2]; // stereo output of reflections } SWRVBREFDELAY, *PSWRVBREFDELAY; @@ -67,42 +67,42 @@ typedef struct _SWLATEREVERB { - ULONG nReverbDelay; // Reverb delay (in samples) - ULONG nDelayPos; // Delay line position - SHORT nDifCoeffs[4]; // Reverb diffusion - SHORT nDecayDC[4]; // Reverb DC decay - SHORT nDecayLP[4]; // Reverb HF decay - SHORT LPHistory[4]; // Low-pass history - SHORT Dif2InGains[4]; // 2nd diffuser input gains - SHORT RvbOutGains[4]; // 4x2 Reverb output gains - LONG lMasterGain; // late reverb master gain - LONG lDummyAlign; + uint32 nReverbDelay; // Reverb delay (in samples) + uint32 nDelayPos; // Delay line position + int16 nDifCoeffs[4]; // Reverb diffusion + int16 nDecayDC[4]; // Reverb DC decay + int16 nDecayLP[4]; // Reverb HF decay + int16 LPHistory[4]; // Low-pass history + int16 Dif2InGains[4]; // 2nd diffuser input gains + int16 RvbOutGains[4]; // 4x2 Reverb output gains + int32 lMasterGain; // late reverb master gain + int32 lDummyAlign; // Tank Delay lines - short int Diffusion1[(RVBDLY_MASK+1)*2]; // {dif1_l, dif1_r} - short int Diffusion2[(RVBDLY_MASK+1)*2]; // {dif2_l, dif2_r} - short int Delay1[(RVBDLY_MASK+1)*2]; // {dly1_l, dly1_r} - short int Delay2[(RVBDLY_MASK+1)*2]; // {dly2_l, dly2_r} + int16 Diffusion1[(RVBDLY_MASK+1)*2]; // {dif1_l, dif1_r} + int16 Diffusion2[(RVBDLY_MASK+1)*2]; // {dif2_l, dif2_r} + int16 Delay1[(RVBDLY_MASK+1)*2]; // {dly1_l, dly1_r} + int16 Delay2[(RVBDLY_MASK+1)*2]; // {dly2_l, dly2_r} } SWLATEREVERB, *PSWLATEREVERB; #define ENVIRONMENT_NUMREFLECTIONS 8 typedef struct _ENVIRONMENTREFLECTION { - SHORT GainLL, GainRR, GainLR, GainRL; // +/- 32K scale - ULONG Delay; // In samples + int16 GainLL, GainRR, GainLR, GainRL; // +/- 32K scale + uint32 Delay; // In samples } ENVIRONMENTREFLECTION, *PENVIRONMENTREFLECTION; typedef struct _ENVIRONMENTREVERB { - LONG ReverbLevel; // Late reverb gain (mB) - LONG ReflectionsLevel; // Master reflections gain (mB) - LONG RoomHF; // Room gain HF (mB) - ULONG ReverbDecay; // Reverb tank decay (0-7fff scale) - LONG PreDiffusion; // Reverb pre-diffusion amount (+/- 32K scale) - LONG TankDiffusion; // Reverb tank diffusion (+/- 32K scale) - ULONG ReverbDelay; // Reverb delay (in samples) - float flReverbDamping; // HF tank gain [0.0, 1.0] - LONG ReverbDecaySamples;// Reverb decay time (in samples) + int32 ReverbLevel; // Late reverb gain (mB) + int32 ReflectionsLevel; // Master reflections gain (mB) + int32 RoomHF; // Room gain HF (mB) + uint32 ReverbDecay; // Reverb tank decay (0-7fff scale) + int32 PreDiffusion; // Reverb pre-diffusion amount (+/- 32K scale) + int32 TankDiffusion; // Reverb tank diffusion (+/- 32K scale) + uint32 ReverbDelay; // Reverb delay (in samples) + float flReverbDamping; // HF tank gain [0.0, 1.0] + int32 ReverbDecaySamples;// Reverb decay time (in samples) ENVIRONMENTREFLECTION Reflections[ENVIRONMENT_NUMREFLECTIONS]; } ENVIRONMENTREVERB, *PENVIRONMENTREVERB; @@ -112,8 +112,8 @@ //=================== { public: - UINT m_nReverbDepth; - UINT m_nReverbType; + uint32 m_nReverbDepth; + uint32 m_nReverbType; public: CReverbSettings(); }; @@ -134,14 +134,14 @@ private: - UINT gnReverbSend; + uint32 gnReverbSend; - UINT gnReverbSamples; - UINT gnReverbDecaySamples; + uint32 gnReverbSamples; + uint32 gnReverbDecaySamples; // Internal reverb state - BOOL g_bLastInPresent; - BOOL g_bLastOutPresent; + bool g_bLastInPresent; + bool g_bLastOutPresent; int g_nLastRvbIn_xl; int g_nLastRvbIn_xr; int g_nLastRvbIn_yl; @@ -158,31 +158,31 @@ public: CReverb(); public: - void Initialize(BOOL bReset, DWORD MixingFreq); + void Initialize(bool bReset, uint32 MixingFreq); // can be called multiple times or never (if no data is sent to reverb) - int *GetReverbSendBuffer(UINT nSamples); + int *GetReverbSendBuffer(uint32 nSamples); // call once after all data has been sent. - void Process(int *MixSoundBuffer, UINT nSamples); + void Process(int *MixSoundBuffer, uint32 nSamples); // [Reverb level 0(quiet)-100(loud)], [REVERBTYPE_XXXX] - bool SetReverbParameters(UINT nDepth, UINT nType); + bool SetReverbParameters(uint32 nDepth, uint32 nType); private: void Shutdown(); // Pre/Post resampling and filtering - UINT X86_ReverbProcessPreFiltering1x(int *pWet, UINT nSamples); - UINT X86_ReverbProcessPreFiltering2x(int *pWet, UINT nSamples); - VOID MMX_ReverbProcessPostFiltering1x(const int *pRvb, int *pDry, UINT nSamples); - VOID X86_ReverbProcessPostFiltering2x(const int *pRvb, int *pDry, UINT nSamples); - VOID MMX_ReverbDCRemoval(int *pBuffer, UINT nSamples); - VOID X86_ReverbDryMix(int *pDry, int *pWet, int lDryVol, UINT nSamples); + uint32 X86_ReverbProcessPreFiltering1x(int *pWet, uint32 nSamples); + uint32 X86_ReverbProcessPreFiltering2x(int *pWet, uint32 nSamples); + void MMX_ReverbProcessPostFiltering1x(const int *pRvb, int *pDry, uint32 nSamples); + void X86_ReverbProcessPostFiltering2x(const int *pRvb, int *pDry, uint32 nSamples); + void MMX_ReverbDCRemoval(int *pBuffer, uint32 nSamples); + void X86_ReverbDryMix(int *pDry, int *pWet, int lDryVol, uint32 nSamples); // Process pre-diffusion and pre-delay - VOID MMX_ProcessPreDelay(PSWRVBREFDELAY pPreDelay, const int *pIn, UINT nSamples); + void MMX_ProcessPreDelay(PSWRVBREFDELAY pPreDelay, const int *pIn, uint32 nSamples); // Process reflections - VOID MMX_ProcessReflections(PSWRVBREFDELAY pPreDelay, short int *pRefOut, int *pMixOut, UINT nSamples); + void MMX_ProcessReflections(PSWRVBREFDELAY pPreDelay, short int *pRefOut, int *pMixOut, uint32 nSamples); // Process Late Reverb (SW Reflections): stereo reflections output, 32-bit reverb output, SW reverb gain - VOID MMX_ProcessLateReverb(PSWLATEREVERB pReverb, short int *pRefOut, int *pMixOut, UINT nSamples); + void MMX_ProcessLateReverb(PSWLATEREVERB pReverb, short int *pRefOut, int *pMixOut, uint32 nSamples); }; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -1033,7 +1033,7 @@ #endif #endif m_MixerSettings.DSPMask = DSPMask; - InitPlayer(FALSE); + InitPlayer(false); } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/soundlib/Sndfile.h 2014-03-07 11:43:17 UTC (rev 3837) @@ -730,7 +730,7 @@ // Mixer Config void SetMixerSettings(const MixerSettings &mixersettings); void SetResamplerSettings(const CResamplerSettings &resamplersettings); - void InitPlayer(BOOL bReset=FALSE); + void InitPlayer(bool bReset=false); void SetDspEffects(DWORD DSPMask); DWORD GetSampleRate() { return m_MixerSettings.gdwMixingFreq; } #ifndef NO_EQ Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2014-03-07 02:32:49 UTC (rev 3836) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2014-03-07 11:43:17 UTC (rev 3837) @@ -79,7 +79,7 @@ (mixersettings.MixerFlags != m_MixerSettings.MixerFlags)) reset = true; m_MixerSettings = mixersettings; - InitPlayer(reset?TRUE:FALSE); + InitPlayer(reset); } @@ -91,7 +91,7 @@ } -void CSoundFile::InitPlayer(BOOL bReset) +void CSoundFile::InitPlayer(bool bReset) //-------------------------------------- { if(bReset) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |