From: <man...@us...> - 2013-05-23 14:43:18
|
Revision: 2177 http://sourceforge.net/p/modplug/code/2177 Author: manxorist Date: 2013-05-23 14:43:05 +0000 (Thu, 23 May 2013) Log Message: ----------- [Ref] Various fixes regarding interactions of ENABLE_ASM, ENABLE_X86 and NO_REVERB build settings. [Ref] Also disable more code if !ENABLE_ASM. [Fix] Make EQ compile in all cases. Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/sounddsp/EQ.cpp trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Mmx_mix.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/common/BuildSettings.h 2013-05-23 14:43:05 UTC (rev 2177) @@ -150,6 +150,14 @@ +// fixing stuff up + +#if !defined(ENABLE_MMX) && !defined(NO_REVERB) +#define NO_REVERB // reverb requires mmx +#endif + + + #if MPT_COMPILER_MSVC #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-05-23 14:43:05 UTC (rev 2177) @@ -125,10 +125,11 @@ CPropertyPage::OnInitDialog(); if(TrackerSettings::Instance().m_MixerSettings.MixerFlags & SNDMIX_SOFTPANNING) CheckDlgButton(IDC_CHECK2, MF_CHECKED); - if(TrackerSettings::Instance().m_MixerSettings.MixerFlags & SNDMIX_ENABLEMMX) CheckDlgButton(IDC_CHECK3, MF_CHECKED); if(m_SoundDeviceFlags & SNDDEV_OPTIONS_EXCLUSIVE) CheckDlgButton(IDC_CHECK4, MF_CHECKED); if(m_SoundDeviceFlags & SNDDEV_OPTIONS_BOOSTTHREADPRIORITY) CheckDlgButton(IDC_CHECK5, MF_CHECKED); // Multimedia extensions +#ifdef ENABLE_ASM + if(TrackerSettings::Instance().m_MixerSettings.MixerFlags & SNDMIX_ENABLEMMX) CheckDlgButton(IDC_CHECK3, MF_CHECKED); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK3), (CSoundFile::GetSysInfo() & PROCSUPPORT_MMX) ? TRUE : FALSE); if(CSoundFile::GetSysInfo() & PROCSUPPORT_SSE) { @@ -137,6 +138,9 @@ { SetDlgItemText(IDC_CHECK3, _T("Enable 3DNow! acceleration")); } +#else + ::ShowWindow(::GetDlgItem(m_hWnd, IDC_CHECK3), SW_HIDE); +#endif // Sampling Rate UpdateSampleRates(m_nSoundDevice); @@ -441,8 +445,10 @@ void COptionsSoundcard::OnOK() //---------------------------- { +#ifdef ENABLE_ASM + if(IsDlgButtonChecked(IDC_CHECK3)) TrackerSettings::Instance().m_MixerSettings.MixerFlags |= SNDMIX_ENABLEMMX; else TrackerSettings::Instance().m_MixerSettings.MixerFlags &= ~SNDMIX_ENABLEMMX; +#endif if(IsDlgButtonChecked(IDC_CHECK2)) TrackerSettings::Instance().m_MixerSettings.MixerFlags |= SNDMIX_SOFTPANNING; else TrackerSettings::Instance().m_MixerSettings.MixerFlags &= ~SNDMIX_SOFTPANNING; - if(IsDlgButtonChecked(IDC_CHECK3)) TrackerSettings::Instance().m_MixerSettings.MixerFlags |= SNDMIX_ENABLEMMX; else TrackerSettings::Instance().m_MixerSettings.MixerFlags &= ~SNDMIX_ENABLEMMX; m_SoundDeviceFlags = 0; if(IsDlgButtonChecked(IDC_CHECK4)) m_SoundDeviceFlags |= SNDDEV_OPTIONS_EXCLUSIVE; if(IsDlgButtonChecked(IDC_CHECK5)) m_SoundDeviceFlags |= SNDDEV_OPTIONS_BOOSTTHREADPRIORITY; @@ -787,7 +793,9 @@ if (IsDlgButtonChecked(IDC_CHECK4)) dwQuality |= SNDDSP_SURROUND; if (IsDlgButtonChecked(IDC_CHECK5)) dwQuality |= SNDDSP_NOISEREDUCTION; #endif +#ifndef NO_REVERB if (IsDlgButtonChecked(IDC_CHECK6)) dwQuality |= SNDDSP_REVERB; +#endif dwSrcMode = m_CbnResampling.GetCurSel(); #ifndef NO_DSP Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-05-23 14:43:05 UTC (rev 2177) @@ -867,6 +867,8 @@ AddDocTemplate(m_pModTemplate); // Initialize Audio +#ifdef ENABLE_ASM + // rough heuristic to select less cpu consuming defaults for old CPUs DWORD sysinfo = CSoundFile::GetSysInfo(); if(sysinfo & PROCSUPPORT_MMX) { @@ -877,6 +879,10 @@ { TrackerSettings::Instance().m_ResamplerSettings.SrcMode = SRCMODE_POLYPHASE; } +#else + // just use a sane default + TrackerSettings::Instance().m_ResamplerSettings.SrcMode = SRCMODE_POLYPHASE; +#endif // Load Midi Library if (m_szConfigFileName[0]) ImportMidiConfig(m_szConfigFileName); Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2013-05-23 14:43:05 UTC (rev 2177) @@ -673,7 +673,9 @@ int32 y0 = 0, xmax, poshi; uint64 posincr, posfrac; +#ifdef ENABLE_ASM DWORD sysinfo = CSoundFile::GetSysInfo(); +#endif if (len <= 0) return; smplsize = (uFlags & CHN_16BIT) ? 2 : 1; Modified: trunk/OpenMPT/sounddsp/EQ.cpp =================================================================== --- trunk/OpenMPT/sounddsp/EQ.cpp 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/sounddsp/EQ.cpp 2013-05-23 14:43:05 UTC (rev 2177) @@ -17,14 +17,22 @@ #define EQ_BANDWIDTH 2.0 #define EQ_ZERO 0.000001 +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); +extern void C_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); +extern void C_FloatToMonoMix(const float *pIn, int *pOut, UINT nCount, const float _f2ic); + +#ifdef ENABLE_X86 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); +#endif #ifdef ENABLE_SSE extern void SSE_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); #endif + #ifdef ENABLE_3DNOW extern void AMD_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); extern void AMD_FloatToMonoMix(const float *pIn, int *pOut, UINT nCount, const float _f2ic); @@ -325,19 +333,27 @@ void CEQ::ProcessMono(int *pbuffer, float *MixFloatBuffer, UINT nCount, CSoundFilePlayConfig &config) -//---------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- { +#ifdef ENABLE_X86 X86_MonoMixToFloat(pbuffer, MixFloatBuffer, nCount, config.getIntToFloat()); +#else + C_MonoMixToFloat(pbuffer, MixFloatBuffer, nCount, config.getIntToFloat()); +#endif for (UINT b=0; b<MAX_EQ_BANDS; b++) { if ((gEQ[b].bEnable) && (gEQ[b].Gain != 1.0f)) EQFilter(&gEQ[b], MixFloatBuffer, nCount); } +#ifdef ENABLE_X86 X86_FloatToMonoMix(MixFloatBuffer, pbuffer, nCount, config.getFloatToInt()); +#else + C_FloatToMonoMix(MixFloatBuffer, pbuffer, nCount, config.getFloatToInt()); +#endif } void CEQ::ProcessStereo(int *pbuffer, float *MixFloatBuffer, UINT nCount, CSoundFilePlayConfig &config, DWORD SoundSetupFlags, DWORD SysInfoFlags) -//------------------------------------------------------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------------------------------------------------------ { #ifdef ENABLE_SSE @@ -388,7 +404,15 @@ #endif // ENABLE_3DNOW { + + UNREFERENCED_PARAMETER(SoundSetupFlags); + UNREFERENCED_PARAMETER(SysInfoFlags); + +#ifdef ENABLE_X86 X86_StereoMixToFloat(pbuffer, MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, nCount, config.getIntToFloat()); +#else + C_StereoMixToFloat(pbuffer, MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, nCount, config.getIntToFloat()); +#endif for (UINT bl=0; bl<MAX_EQ_BANDS; bl++) { @@ -399,7 +423,12 @@ if ((gEQ[br].bEnable) && (gEQ[br].Gain != 1.0f)) EQFilter(&gEQ[br], MixFloatBuffer+MIXBUFFERSIZE, nCount); } +#ifdef ENABLE_X86 X86_FloatToStereoMix(MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, pbuffer, nCount, config.getFloatToInt()); +#else + C_FloatToStereoMix(MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, pbuffer, nCount, config.getFloatToInt()); +#endif + } } Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-23 14:43:05 UTC (rev 2177) @@ -1754,6 +1754,7 @@ VOID CSoundFile::StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount) //----------------------------------------------------------------------------------------- { +#ifdef ENABLE_ASM if(m_MixerSettings.MixerFlags & SNDMIX_ENABLEMMX) { #ifdef ENABLE_SSE @@ -1771,17 +1772,19 @@ } #endif // ENABLE_3DNOW } +#endif // ENABLE_ASM #ifdef ENABLE_X86 X86_StereoMixToFloat(pSrc, pOut1, pOut2, nCount, m_PlayConfig.getIntToFloat()); -#else +#else // !ENABLE_X86 C_StereoMixToFloat(pSrc, pOut1, pOut2, nCount, m_PlayConfig.getIntToFloat()); -#endif +#endif // ENABLE_X86 } VOID CSoundFile::FloatToStereoMix(const float *pIn1, const float *pIn2, int *pOut, UINT nCount) //--------------------------------------------------------------------------------------------- { +#ifdef ENABLE_ASM if(m_MixerSettings.MixerFlags & SNDMIX_ENABLEMMX) { #ifdef ENABLE_3DNOW @@ -1792,11 +1795,12 @@ } #endif // ENABLE_3DNOW } +#endif // ENABLE_ASM #ifdef ENABLE_X86 X86_FloatToStereoMix(pIn1, pIn2, pOut, nCount, m_PlayConfig.getFloatToInt()); -#else +#else // !ENABLE_X86 C_FloatToStereoMix(pIn1, pIn2, pOut, nCount, m_PlayConfig.getFloatToInt()); -#endif +#endif // ENABLE_X86 } Modified: trunk/OpenMPT/soundlib/Mmx_mix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmx_mix.cpp 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/soundlib/Mmx_mix.cpp 2013-05-23 14:43:05 UTC (rev 2177) @@ -24,6 +24,7 @@ #include "Sndfile.h" +#ifdef ENABLE_ASM DWORD CSoundFile::GetSysInfo() //---------------------------- { @@ -83,6 +84,7 @@ return 0; #endif } +#endif //////////////////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2013-05-23 14:43:05 UTC (rev 2177) @@ -242,11 +242,13 @@ #define DNA_NOTEFADE 2 +#ifdef ENABLE_ASM #define PROCSUPPORT_CPUID 0x01 #define PROCSUPPORT_MMX 0x02 // Processor supports MMX instructions #define PROCSUPPORT_MMXEX 0x04 // Processor supports AMD MMX extensions #define PROCSUPPORT_3DNOW 0x08 // Processor supports AMD 3DNow! instructions #define PROCSUPPORT_SSE 0x10 // Processor supports SSE instructions +#endif // Module flags @@ -294,14 +296,19 @@ #define SNDDSP_MEGABASS 0x02 // bass expansion #define SNDDSP_SURROUND 0x08 // surround mix #endif // NO_DSP +#ifndef NO_REVERB #define SNDDSP_REVERB 0x20 // apply reverb +#endif // NO_REVERB #ifndef NO_EQ #define SNDDSP_EQ 0x80 // apply EQ #endif // NO_EQ #define SNDMIX_SOFTPANNING 0x10 // soft panning mode (this is forced with mixmode RC3 and later) + // Misc Flags (can safely be turned on or off) +#ifdef ENABLE_ASM #define SNDMIX_ENABLEMMX 0x08 // use MMX-accelerated code +#endif //#define SNDMIX_NOBACKWARDJUMPS 0x40000 // stop when jumping back in the order (currently unused as it seems) #define SNDMIX_MAXDEFAULTPAN 0x80000 // Used by the MOD loader (currently unused) Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-05-23 14:43:05 UTC (rev 2177) @@ -402,7 +402,11 @@ #endif //---------------------- { +#ifdef ENABLE_ASM gdwSysInfo = GetSysInfo(); +#else + gdwSysInfo = 0; +#endif MemsetZero(MixSoundBuffer); MemsetZero(MixRearBuffer); #ifndef NO_REVERB @@ -887,7 +891,9 @@ void CSoundFile::SetDspEffects(DWORD DSPMask) //------------------------------------------- { +#ifdef ENABLE_ASM if(!(GetSysInfo() & PROCSUPPORT_MMX)) DSPMask &= ~SNDDSP_REVERB; +#endif m_MixerSettings.DSPMask = DSPMask; InitPlayer(FALSE); } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-05-22 23:51:36 UTC (rev 2176) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-05-23 14:43:05 UTC (rev 2177) @@ -594,7 +594,9 @@ void InitPlayer(BOOL bReset=FALSE); void SetDspEffects(DWORD DSPMask); DWORD GetSampleRate() { return m_MixerSettings.gdwMixingFreq; } +#ifdef ENABLE_ASM static DWORD GetSysInfo(); +#endif #ifndef NO_EQ void SetEQGains(const UINT *pGains, UINT nBands, const UINT *pFreqs=NULL, BOOL bReset=FALSE) { m_EQ.SetEQGains(pGains, nBands, pFreqs, bReset, m_MixerSettings.gdwMixingFreq); } // 0=-12dB, 32=+12dB #endif // NO_EQ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |