From: <man...@us...> - 2013-05-01 11:38:48
|
Revision: 2001 http://sourceforge.net/p/modplug/code/2001 Author: manxorist Date: 2013-05-01 11:38:40 +0000 (Wed, 01 May 2013) Log Message: ----------- [Ref] Remove X86_ name tag from most mixing helper functions: Move C implementations to their own C_ functions and expose untagged functions which select the proper one based on compile-time setting. [Ref] Add some missing C implementations. Modified Paths: -------------- trunk/OpenMPT/sounddsp/Reverb.cpp trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Mmx_mix.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/Waveform.cpp Modified: trunk/OpenMPT/sounddsp/Reverb.cpp =================================================================== --- trunk/OpenMPT/sounddsp/Reverb.cpp 2013-05-01 00:33:53 UTC (rev 2000) +++ trunk/OpenMPT/sounddsp/Reverb.cpp 2013-05-01 11:38:40 UTC (rev 2001) @@ -18,7 +18,7 @@ #pragma warning(disable:4725) // Pentium fdiv bug #pragma warning(disable:4731) // ebp modified -extern VOID X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); +extern void StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); @@ -403,7 +403,7 @@ UINT nIn, nOut; if ((!gnReverbSend) && (!gnReverbSamples)) return; - if (!gnReverbSend) X86_StereoFill(MixReverbBuffer, nSamples, &gnRvbROfsVol, &gnRvbLOfsVol); + if (!gnReverbSend) StereoFill(MixReverbBuffer, nSamples, &gnRvbROfsVol, &gnRvbLOfsVol); if (!(sysinfo & PROCSUPPORT_MMX)) return; // Dynamically adjust reverb master gains LONG lMasterGain; Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-01 00:33:53 UTC (rev 2000) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-01 11:38:40 UTC (rev 2001) @@ -461,12 +461,12 @@ // extern void X86_StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount, const float _i2fc); extern void X86_FloatToStereoMix(const float *pIn1, const float *pIn2, int *pOut, UINT nCount, const float _f2ic); -extern void X86_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); -extern void X86_FloatToMonoMix(const float *pIn, int *pOut, UINT nCount, const float _f2ic); +extern void C_StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount, const float _i2fc); +extern void C_FloatToStereoMix(const float *pIn1, const float *pIn2, int *pOut, UINT nCount, const float _f2ic); -void X86_InitMixBuffer(int *pBuffer, UINT nSamples); -void X86_EndChannelOfs(ModChannel *pChannel, int *pBuffer, UINT nSamples); -void X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); +void InitMixBuffer(int *pBuffer, UINT nSamples); +void EndChannelOfs(ModChannel *pChannel, int *pBuffer, UINT nSamples); +void StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); #ifdef ENABLE_3DNOW @@ -1452,7 +1452,7 @@ if (!count) return 0; BOOL bSurround; bool ITPingPongMode = IsITPingPongMode(); - if (m_MixerSettings.gnChannels > 2) X86_InitMixBuffer(MixRearBuffer, count*2); + if (m_MixerSettings.gnChannels > 2) InitMixBuffer(MixRearBuffer, count*2); nchused = nchmixed = 0; for (UINT nChn=0; nChn<m_nMixChannels; nChn++) { @@ -1524,7 +1524,7 @@ pOfsL = &pPlugin->nVolDecayL; if (!(pPlugin->dwFlags & SNDMIXPLUGINSTATE::psfMixReady)) { - X86_StereoFill(pbuffer, count, pOfsR, pOfsL); + StereoFill(pbuffer, count, pOfsR, pOfsL); pPlugin->dwFlags |= SNDMIXPLUGINSTATE::psfMixReady; } } @@ -1534,7 +1534,7 @@ { if (!m_Reverb.gnReverbSend) { - X86_StereoFill(MixReverbBuffer, count, &m_Reverb.gnRvbROfsVol, &m_Reverb.gnRvbLOfsVol); + StereoFill(MixReverbBuffer, count, &m_Reverb.gnRvbROfsVol, &m_Reverb.gnRvbLOfsVol); } m_Reverb.gnReverbSend += count; pOfsR = &m_Reverb.gnRvbROfsVol; @@ -1558,7 +1558,7 @@ pChannel->nPos = 0; pChannel->nPosLo = 0; pChannel->nRampLength = 0; - X86_EndChannelOfs(pChannel, pbuffer, nsamples); + EndChannelOfs(pChannel, pbuffer, nsamples); *pOfsR += pChannel->nROfs; *pOfsL += pChannel->nLOfs; pChannel->nROfs = pChannel->nLOfs = 0; @@ -1677,7 +1677,7 @@ } else if (pState->nVolDecayR|pState->nVolDecayL) { - X86_StereoFill(pState->pMixBuffer, nCount, &pState->nVolDecayR, &pState->nVolDecayL); + StereoFill(pState->pMixBuffer, nCount, &pState->nVolDecayR, &pState->nVolDecayL); StereoMixToFloat(pState->pMixBuffer, pState->pOutBufferL, pState->pOutBufferR, nCount); } else { @@ -1786,7 +1786,6 @@ VOID CSoundFile::StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount) //----------------------------------------------------------------------------------------- { - if(m_MixerSettings.MixerFlags & SNDMIX_ENABLEMMX) { #ifdef ENABLE_SSE @@ -1804,9 +1803,11 @@ } #endif // ENABLE_3DNOW } - +#ifdef ENABLE_X86 X86_StereoMixToFloat(pSrc, pOut1, pOut2, nCount, m_PlayConfig.getIntToFloat()); - +#else + C_StereoMixToFloat(pSrc, pOut1, pOut2, nCount, m_PlayConfig.getIntToFloat()); +#endif } @@ -1823,59 +1824,21 @@ } #endif // ENABLE_3DNOW } +#ifdef ENABLE_X86 X86_FloatToStereoMix(pIn1, pIn2, pOut, nCount, m_PlayConfig.getFloatToInt()); +#else + C_FloatToStereoMix(pIn1, pIn2, pOut, nCount, m_PlayConfig.getFloatToInt()); +#endif } -VOID CSoundFile::MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount) -//------------------------------------------------------------------------ -{ - if(m_MixerSettings.MixerFlags & SNDMIX_ENABLEMMX) - { -#ifdef ENABLE_SSE - if(gdwSysInfo & PROCSUPPORT_SSE) - { - SSE_MonoMixToFloat(pSrc, pOut, nCount, m_PlayConfig.getIntToFloat()); - return; - } -#endif // ENABLE_SSE -#ifdef ENABLE_3DNOW - if(gdwSysInfo & PROCSUPPORT_3DNOW) - { - AMD_MonoMixToFloat(pSrc, pOut, nCount, m_PlayConfig.getIntToFloat()); - return; - } -#endif // ENABLE_3DNOW - } - X86_MonoMixToFloat(pSrc, pOut, nCount, m_PlayConfig.getIntToFloat()); +#pragma warning (disable:4100) -} - -VOID CSoundFile::FloatToMonoMix(const float *pIn, int *pOut, UINT nCount) -//----------------------------------------------------------------------- +#ifdef ENABLE_X86 +static DWORD X86_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//-------------------------------------------------------------------------- { - if(m_MixerSettings.MixerFlags & SNDMIX_ENABLEMMX) - { -#ifdef ENABLE_3DNOW - if(gdwSysInfo & PROCSUPPORT_3DNOW) - { - AMD_FloatToMonoMix(pIn, pOut, nCount, m_PlayConfig.getFloatToInt()); - return; - } -#endif // ENABLE_3DNOW - } - X86_FloatToMonoMix(pIn, pOut, nCount, m_PlayConfig.getFloatToInt()); -} - - -#pragma warning (disable:4100) - -// Clip and convert to 8 bit -DWORD X86_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//------------------------------------------------------------------- -{ -#ifdef ENABLE_X86 DWORD result; _asm { mov ebx, lp16 // ebx = 8-bit buffer @@ -1908,7 +1871,12 @@ mov result, eax } return result; -#else +} +#endif + +static DWORD C_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//------------------------------------------------------------------------ +{ uint8 * p = (uint8*)lp16; for(DWORD i=0; i<lSampleCount; i++) { @@ -1918,15 +1886,24 @@ p[i] = (uint8)((v >> (24-MIXING_ATTENUATION))+0x80); // unsigned } return lSampleCount * 1; -#endif } +// Clip and convert to 8 bit +DWORD Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//--------------------------------------------------------------- +{ + #ifdef ENABLE_X86 + X86_Convert32To8(lp16, pBuffer, lSampleCount); + #else + C_Convert32To8(lp16, pBuffer, lSampleCount); + #endif +} -// Clip and convert to 16 bit -DWORD X86_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//-------------------------------------------------------------------- + +#ifdef ENABLE_X86 +static DWORD X86_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//--------------------------------------------------------------------------- { -#ifdef ENABLE_X86 DWORD result; _asm { mov ebx, lp16 // ebx = 16-bit buffer @@ -1959,7 +1936,12 @@ mov result, eax } return result; -#else +} +#endif + +static DWORD C_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//------------------------------------------------------------------------- +{ int16 * p = (int16*)lp16; for(DWORD i=0; i<lSampleCount; i++) { @@ -1969,15 +1951,24 @@ p[i] = (int16)(v >> (16-MIXING_ATTENUATION)); } return lSampleCount * 2; -#endif } +// Clip and convert to 16 bit +DWORD Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//---------------------------------------------------------------- +{ + #ifdef ENABLE_X86 + X86_Convert32To16(lp16, pBuffer, lSampleCount); + #else + C_Convert32To16(lp16, pBuffer, lSampleCount); + #endif +} -// Clip and convert to 24 bit -DWORD X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//-------------------------------------------------------------------- + +#ifdef ENABLE_X86 +static DWORD X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//--------------------------------------------------------------------------- { -#ifdef ENABLE_X86 DWORD result; _asm { mov ebx, lp16 // ebx = 8-bit buffer @@ -2012,7 +2003,12 @@ mov result, eax } return result; -#else +} +#endif + +static DWORD C_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//------------------------------------------------------------------------- +{ uint8 * p = (uint8*)lp16; for(DWORD i=0; i<lSampleCount; i++) { @@ -2031,15 +2027,24 @@ #endif } return lSampleCount * 3; -#endif } +// Clip and convert to 24 bit +DWORD Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +{ + #ifdef ENABLE_X86 + X86_Convert32To24(lp16, pBuffer, lSampleCount); + #else + C_Convert32To24(lp16, pBuffer, lSampleCount); + #endif +} -// Clip and convert to 32 bit -DWORD X86_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//-------------------------------------------------------------------- + + +#ifdef ENABLE_X86 +static DWORD X86_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//--------------------------------------------------------------------------- { -#ifdef ENABLE_X86 DWORD result; _asm { mov ebx, lp16 // ebx = 32-bit buffer @@ -2071,7 +2076,12 @@ mov result, eax } return result; -#else +} +#endif + +static DWORD C_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//------------------------------------------------------------------------- +{ int32 * p = (int32*)lp16; for(DWORD i=0; i<lSampleCount; i++) { @@ -2081,10 +2091,20 @@ p[i] = v << MIXING_ATTENUATION; } return lSampleCount * 4; -#endif } +// Clip and convert to 32 bit +DWORD Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) +//---------------------------------------------------------------- +{ + #ifdef ENABLE_X86 + X86_Convert32To32(lp16, pBuffer, lSampleCount); + #else + C_Convert32To32(lp16, pBuffer, lSampleCount); + #endif +} + // convert to 32 bit floats and do NOT clip to [-1,1] DWORD Convert32ToFloat32(LPVOID lpBuffer, int *pBuffer, DWORD lSampleCount) //------------------------------------------------------------------------- @@ -2099,8 +2119,8 @@ } -void X86_InitMixBuffer(int *pBuffer, UINT nSamples) -//------------------------------------------------- +void InitMixBuffer(int *pBuffer, UINT nSamples) +//--------------------------------------------- { memset(pBuffer, 0, nSamples * sizeof(int)); } @@ -2163,10 +2183,10 @@ #endif -void X86_InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames) -//------------------------------------------------------------------------ +#ifdef ENABLE_X86 +static void X86_InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames) +//------------------------------------------------------------------------------- { -#ifdef ENABLE_X86 _asm { mov ecx, nFrames // ecx = framecount mov esi, pFrontBuf // esi = front buffer @@ -2191,7 +2211,12 @@ jnz interleaveloop pop ebp } -#else +} +#endif + +static void C_InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames) +//----------------------------------------------------------------------------- +{ // copy backwards as we are writing back into FrontBuf for(int i=nFrames-1; i>=0; i--) { @@ -2200,12 +2225,22 @@ pFrontBuf[i*4+1] = pFrontBuf[i*2+1]; pFrontBuf[i*4+0] = pFrontBuf[i*2+0]; } -#endif } +void InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames) +//-------------------------------------------------------------------- +{ + #ifdef ENABLE_X86 + X86_InterleaveFrontRear(pFrontBuf, pRearBuf, nFrames); + #else + C_InterleaveFrontRear(pFrontBuf, pRearBuf, nFrames); + #endif +} -VOID X86_MonoFromStereo(int *pMixBuf, UINT nSamples) -//-------------------------------------------------- + +#ifdef ENABLE_X86 +static void X86_MonoFromStereo(int *pMixBuf, UINT nSamples) +//--------------------------------------------------------- { _asm { mov ecx, nSamples @@ -2223,15 +2258,36 @@ jnz stloop } } +#endif +static void C_MonoFromStereo(int *pMixBuf, UINT nSamples) +//------------------------------------------------------- +{ + for(UINT i=0; i<nSamples; ++i) + { + pMixBuf[i] = (pMixBuf[i*2] + pMixBuf[i*2+1]) / 2; + } +} + +void MonoFromStereo(int *pMixBuf, UINT nSamples) +//---------------------------------------------- +{ + #ifdef ENABLE_X86 + X86_MonoFromStereo(pMixBuf, nSamples); + #else + C_MonoFromStereo(pMixBuf, nSamples); + #endif +} + + #define OFSDECAYSHIFT 8 #define OFSDECAYMASK 0xFF -void X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs) -//---------------------------------------------------------------------------- +#ifdef ENABLE_X86 +static void X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs) +//----------------------------------------------------------------------------------- { -#ifdef ENABLE_X86 _asm { mov edi, pBuffer mov ecx, nSamples @@ -2299,13 +2355,19 @@ mov [esi], eax mov [edi], edx } -#else // c implementation taken from libmodplug +} +#endif + +// c implementation taken from libmodplug +static void C_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs) +//--------------------------------------------------------------------------------- +{ int rofs = *lpROfs; int lofs = *lpLOfs; if ((!rofs) && (!lofs)) { - X86_InitMixBuffer(pBuffer, nSamples*2); + InitMixBuffer(pBuffer, nSamples*2); return; } for (UINT i=0; i<nSamples; i++) @@ -2319,16 +2381,24 @@ } *lpROfs = rofs; *lpLOfs = lofs; -#endif } +void StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs) +//------------------------------------------------------------------------ +{ + #ifdef ENABLE_X86 + X86_StereoFill(pBuffer, nSamples, lpROfs, lpLOfs); + #else + C_StereoFill(pBuffer, nSamples, lpROfs, lpLOfs); + #endif +} -typedef struct ModChannel ModChannel_; -void X86_EndChannelOfs(ModChannel *pChannel, int *pBuffer, UINT nSamples) -//----------------------------------------------------------------------- +#ifdef ENABLE_X86 +typedef ModChannel ModChannel_; +static void X86_EndChannelOfs(ModChannel *pChannel, int *pBuffer, UINT nSamples) +//------------------------------------------------------------------------------ { -#ifdef ENABLE_X86 _asm { mov esi, pChannel mov edi, pBuffer @@ -2365,7 +2435,14 @@ mov dword ptr [esi+ModChannel_.nROfs], eax mov dword ptr [esi+ModChannel_.nLOfs], edx } -#else // c implementation taken from libmodplug +} +#endif + +// c implementation taken from libmodplug +static void C_EndChannelOfs(ModChannel *pChannel, int *pBuffer, UINT nSamples) +//---------------------------------------------------------------------------- +{ + int rofs = pChannel->nROfs; int lofs = pChannel->nLOfs; @@ -2381,6 +2458,14 @@ } pChannel->nROfs = rofs; pChannel->nLOfs = lofs; -#endif } +void EndChannelOfs(ModChannel *pChannel, int *pBuffer, UINT nSamples) +//------------------------------------------------------------------- +{ + #ifdef ENABLE_X86 + X86_EndChannelOfs(pChannel, pBuffer, nSamples); + #else + C_EndChannelOfs(pChannel, pBuffer, nSamples); + #endif +} Modified: trunk/OpenMPT/soundlib/Mmx_mix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmx_mix.cpp 2013-05-01 00:33:53 UTC (rev 2000) +++ trunk/OpenMPT/soundlib/Mmx_mix.cpp 2013-05-01 11:38:40 UTC (rev 2001) @@ -27,6 +27,7 @@ DWORD CSoundFile::GetSysInfo() //---------------------------- { +#ifdef ENABLE_X86 static unsigned int fProcessorExtensions = 0; static bool bMMXChecked = false; @@ -78,6 +79,9 @@ bMMXChecked = true; } return fProcessorExtensions; +#else + return 0; +#endif } @@ -285,6 +289,8 @@ // Convert floating-point mix to integer + +#ifdef ENABLE_X86 void X86_FloatToStereoMix(const float *pIn1, const float *pIn2, int *pOut, UINT nCount, const float _f2ic) //-------------------------------------------------------------------------------------------------------- { @@ -309,8 +315,22 @@ fstp st(0) } } +#endif +void C_FloatToStereoMix(const float *pIn1, const float *pIn2, int *pOut, UINT nCount, const float _f2ic) +//------------------------------------------------------------------------------------------------------ +{ + for(UINT i=0; i<nCount; ++i) + { + *pOut++ = (int)(*pIn1++ * _f2ic); + *pOut++ = (int)(*pIn2++ * _f2ic); + } +} + + // Convert integer mix to floating-point + +#ifdef ENABLE_X86 void X86_StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount, const float _i2fc) //---------------------------------------------------------------------------------------------------- { @@ -335,8 +355,20 @@ fstp st(0) } } +#endif +void C_StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount, const float _i2fc) +//-------------------------------------------------------------------------------------------------- +{ + for(UINT i=0; i<nCount; ++i) + { + *pOut1++ = *pSrc++ * _i2fc; + *pOut2++ = *pSrc++ * _i2fc; + } +} + +#ifdef ENABLE_X86 void X86_FloatToMonoMix(const float *pIn, int *pOut, UINT nCount, const float _f2ic) //---------------------------------------------------------------------------------- { @@ -357,8 +389,19 @@ fstp st(0) } } +#endif +void C_FloatToMonoMix(const float *pIn, int *pOut, UINT nCount, const float _f2ic) +//-------------------------------------------------------------------------------- +{ + for(UINT i=0; i<nCount; ++i) + { + *pOut++ = (int)(*pIn++ * _f2ic); + } +} + +#ifdef ENABLE_X86 void X86_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc) //----------------------------------------------------------------------------------- { @@ -379,3 +422,13 @@ fstp st(0) } } +#endif + +void C_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc) +//--------------------------------------------------------------------------------- +{ + for(UINT i=0; i<nCount; ++i) + { + *pOut++ = *pSrc++ * _i2fc; + } +} Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-05-01 00:33:53 UTC (rev 2000) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-05-01 11:38:40 UTC (rev 2001) @@ -35,17 +35,17 @@ typedef DWORD (* LPCONVERTPROC)(LPVOID, int *, DWORD); -extern DWORD X86_Convert32To8(LPVOID lpBuffer, int *, DWORD nSamples); -extern DWORD X86_Convert32To16(LPVOID lpBuffer, int *, DWORD nSamples); -extern DWORD X86_Convert32To24(LPVOID lpBuffer, int *, DWORD nSamples); -extern DWORD X86_Convert32To32(LPVOID lpBuffer, int *, DWORD nSamples); +extern DWORD Convert32To8(LPVOID lpBuffer, int *, DWORD nSamples); +extern DWORD Convert32To16(LPVOID lpBuffer, int *, DWORD nSamples); +extern DWORD Convert32To24(LPVOID lpBuffer, int *, DWORD nSamples); +extern DWORD Convert32To32(LPVOID lpBuffer, int *, DWORD nSamples); extern DWORD Convert32ToFloat32(LPVOID lpBuffer, int *pBuffer, DWORD lSampleCount); #ifdef ENABLE_X86 extern VOID X86_Dither(int *pBuffer, UINT nSamples, UINT nBits); #endif -extern VOID X86_InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames); -extern VOID X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); -extern VOID X86_MonoFromStereo(int *pMixBuf, UINT nSamples); +extern void InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames); +extern void StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); +extern void MonoFromStereo(int *pMixBuf, UINT nSamples); // Log tables for pre-amp // Pre-amp (or more precisely: Pre-attenuation) depends on the number of channels, @@ -193,10 +193,10 @@ lSampleSize = m_MixerSettings.gnChannels; switch(m_MixerSettings.m_SampleFormat) { - case SampleFormatUnsigned8: pCvt = X86_Convert32To8 ; break; - case SampleFormatInt16: pCvt = X86_Convert32To16; break; - case SampleFormatInt24: pCvt = X86_Convert32To24; break; - case SampleFormatInt32: pCvt = X86_Convert32To32; break; + case SampleFormatUnsigned8: pCvt = Convert32To8 ; break; + case SampleFormatInt16: pCvt = Convert32To16; break; + case SampleFormatInt24: pCvt = Convert32To24; break; + case SampleFormatInt32: pCvt = Convert32To32; break; case SampleFormatFloat32: pCvt = Convert32ToFloat32; break; } lSampleSize *= m_MixerSettings.GetBitsPerSample()/8; @@ -265,7 +265,7 @@ #endif // NO_REVERB // Resetting sound buffer - X86_StereoFill(MixSoundBuffer, lCount, &gnDryROfsVol, &gnDryLOfsVol); + StereoFill(MixSoundBuffer, lCount, &gnDryROfsVol, &gnDryLOfsVol); ASSERT(lCount<=MIXBUFFERSIZE); // ensure MIXBUFFERSIZE really is our max buffer size if (m_MixerSettings.gnChannels >= 2) @@ -293,7 +293,7 @@ #endif // NO_REVERB if (nMaxPlugins) ProcessPlugins(lCount); - X86_MonoFromStereo(MixSoundBuffer, lCount); + MonoFromStereo(MixSoundBuffer, lCount); // Apply global volume if (m_PlayConfig.getGlobalVolumeAppliesToMaster()) @@ -337,7 +337,7 @@ // Multichannel if (m_MixerSettings.gnChannels > 2) { - X86_InterleaveFrontRear(MixSoundBuffer, MixRearBuffer, lCount); + InterleaveFrontRear(MixSoundBuffer, MixRearBuffer, lCount); lTotalSampleCount *= 2; } Modified: trunk/OpenMPT/soundlib/Waveform.cpp =================================================================== --- trunk/OpenMPT/soundlib/Waveform.cpp 2013-05-01 00:33:53 UTC (rev 2000) +++ trunk/OpenMPT/soundlib/Waveform.cpp 2013-05-01 11:38:40 UTC (rev 2001) @@ -56,9 +56,9 @@ #ifdef ENABLE_X86 extern void X86_Dither(int *pBuffer, UINT nSamples, UINT nBits); #endif -extern DWORD X86_Convert32To8(LPVOID lpBuffer, int *, DWORD nSamples); -extern DWORD X86_Convert32To16(LPVOID lpBuffer, int *, DWORD nSamples); -extern DWORD X86_Convert32To24(LPVOID lpBuffer, int *, DWORD nSamples); +extern DWORD Convert32To8(LPVOID lpBuffer, int *, DWORD nSamples); +extern DWORD Convert32To16(LPVOID lpBuffer, int *, DWORD nSamples); +extern DWORD Convert32To24(LPVOID lpBuffer, int *, DWORD nSamples); UINT CSoundFile::Normalize24BitBuffer(LPBYTE pbuffer, UINT dwSize, DWORD lmax24, DWORD dwByteInc) //----------------------------------------------------------------------------------------------- @@ -73,9 +73,9 @@ X86_Dither(tempbuf, nbuf, 8 * dwByteInc); switch(dwByteInc) { - case 2: X86_Convert32To16(pbuffer, tempbuf, nbuf); break; - case 3: X86_Convert32To24(pbuffer, tempbuf, nbuf); break; - default: X86_Convert32To8(pbuffer, tempbuf, nbuf); + case 2: Convert32To16(pbuffer, tempbuf, nbuf); break; + case 3: Convert32To24(pbuffer, tempbuf, nbuf); break; + default: Convert32To8(pbuffer, tempbuf, nbuf); break; } n -= nbuf; pbuffer += dwByteInc * nbuf; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |