From: <man...@us...> - 2013-03-25 20:21:06
|
Revision: 1688 http://sourceforge.net/p/modplug/code/1688 Author: manxorist Date: 2013-03-25 20:20:56 +0000 (Mon, 25 Mar 2013) Log Message: ----------- [Ref] Add NO_DSP compile time setting, make NO_AGC actually compile and replace ENABLE_EQ with the negated NO_EQ instead. Disable corresponding GUI widgest in options dialog when these features are disabled. Modified Paths: -------------- trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/sounddsp/DSP.cpp trunk/OpenMPT/sounddsp/DSP.h trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/common/stdafx.h 2013-03-25 20:20:56 UTC (rev 1688) @@ -95,9 +95,15 @@ #endif // ENABLE_ASM -// Enable the built-in equalizer. -#define ENABLE_EQ +// Disable built-in miscellaneous DSP effects (surround, mega bass, noise reduction) +//#define NO_DSP +// Disable the built-in equalizer. +//#define NO_EQ + +// Disable the built-in automatic gain control +//#define NO_AGC + // Define to build without ASIO support; makes build possible without ASIO SDK. //#define NO_ASIO Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-25 20:20:56 UTC (rev 1688) @@ -914,8 +914,10 @@ gpSoundDevice->Configure(m_hWnd, NUM_AUDIO_BUFFERS, TrackerSettings::Instance().m_nBufferLength, fulOptions); gbStopSent = FALSE; m_pSndFile->SetResamplingMode(TrackerSettings::Instance().m_nSrcMode); - m_pSndFile->UPDATEDSPEFFECTS(); + UpdateDspEffects(); +#ifndef NO_AGC m_pSndFile->SetAGC(TrackerSettings::Instance().m_dwQuality & QUALITY_AGC); +#endif if (!gpSoundDevice->Open(nDevNo, &WaveFormat.Format)) return -1; return 0; } @@ -1117,6 +1119,32 @@ } +void CMainFrame::UpdateDspEffects() +//--------------------------------- +{ + CSoundFile::SetDspEffects( +#ifndef NO_DSP + TrackerSettings::Instance().m_dwQuality & QUALITY_SURROUND, +#else + FALSE, +#endif + TrackerSettings::Instance().m_dwQuality & QUALITY_REVERB, +#ifndef NO_DSP + TrackerSettings::Instance().m_dwQuality & QUALITY_MEGABASS, + TrackerSettings::Instance().m_dwQuality & QUALITY_NOISEREDUCTION, +#else + FALSE, + FALSE, +#endif +#ifndef NO_EQ + TrackerSettings::Instance().m_dwQuality & QUALITY_EQ +#else + FALSE +#endif + ); +} + + void CMainFrame::UpdateAudioParameters(BOOL bReset) //------------------------------------------------- { @@ -1140,9 +1168,13 @@ else CSoundFile::gdwSoundSetup &= ~SNDMIX_MUTECHNMODE; CSoundFile::SetResamplingMode(TrackerSettings::Instance().m_nSrcMode); - CSoundFile::UPDATEDSPEFFECTS(); + UpdateDspEffects(); +#ifndef NO_AGC CSoundFile::SetAGC(TrackerSettings::Instance().m_dwQuality & QUALITY_AGC); +#endif +#ifndef NO_EQ CSoundFile::SetEQGains( TrackerSettings::Instance().m_EqSettings.Gains, MAX_EQ_BANDS, TrackerSettings::Instance().m_EqSettings.Freqs, bReset ); +#endif if (bReset) { CSoundFile::SetMixerSettings(TrackerSettings::Instance().m_MixerSettings); @@ -1310,7 +1342,12 @@ pSndFile->SetupITBidiMode(); if(m_pSndFile != nullptr || (m_dwStatus & MODSTATUS_PLAYING)) PauseMod(); - if(m_pSndFile != nullptr && (pSndFile != m_pSndFile || !m_pSndFile->GetTotalSampleCount())) CSoundFile::m_AGC.Reset(); + if(m_pSndFile != nullptr && (pSndFile != m_pSndFile || !m_pSndFile->GetTotalSampleCount())) + { +#ifndef NO_AGC + CSoundFile::m_AGC.Reset(); +#endif + } m_pSndFile = pSndFile; m_pModPlaying = pModDoc; m_hFollowSong = hPat; @@ -1684,8 +1721,10 @@ CriticalSection cs; CSoundFile::SetMixerSettings(TrackerSettings::Instance().m_MixerSettings); CSoundFile::SetResamplingMode(TrackerSettings::Instance().m_nSrcMode); - CSoundFile::UPDATEDSPEFFECTS(); + UpdateDspEffects(); +#ifndef NO_AGC CSoundFile::SetAGC(TrackerSettings::Instance().m_dwQuality & QUALITY_AGC); +#endif } PostMessage(WM_MOD_INVALIDATEPATTERNS, HINT_MPTSETUP); } @@ -1829,13 +1868,17 @@ COptionsColors colors; COptionsPlayer playerdlg; CMidiSetupDlg mididlg(TrackerSettings::Instance().m_dwMidiSetup, TrackerSettings::Instance().m_nMidiDevice); +#ifndef NO_EQ CEQSetupDlg eqdlg(&TrackerSettings::Instance().m_EqSettings); +#endif CAutoSaverGUI autosavedlg(m_pAutoSaver); //rewbs.AutoSaver CUpdateSetupDlg updatedlg; dlg.AddPage(&general); dlg.AddPage(&sounddlg); dlg.AddPage(&playerdlg); +#ifndef NO_EQ dlg.AddPage(&eqdlg); +#endif dlg.AddPage(&keyboard); dlg.AddPage(&colors); dlg.AddPage(&mididlg); @@ -2007,7 +2050,9 @@ { gdwIdleTime = 0; // After 15 seconds of inactivity, we reset the AGC +#ifndef NO_AGC CSoundFile::m_AGC.Reset(); +#endif gdwPlayLatency = 0; } } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-25 20:20:56 UTC (rev 1688) @@ -121,12 +121,18 @@ #define SOUNDSETUP_SECONDARY 0x40 #define SOUNDSETUP_RESTARTMASK SOUNDSETUP_SECONDARY +#ifndef NO_DSP #define QUALITY_NOISEREDUCTION 0x01 #define QUALITY_MEGABASS 0x02 #define QUALITY_SURROUND 0x08 +#endif #define QUALITY_REVERB 0x20 +#ifndef NO_AGC #define QUALITY_AGC 0x40 +#endif +#ifndef NO_EQ #define QUALITY_EQ 0x80 +#endif #define NUM_VUMETER_PENS 32 @@ -290,12 +296,6 @@ #define DeleteGDIObject(h) if (h) { ::DeleteObject(h); h = NULL; } -#define UPDATEDSPEFFECTS() SetDspEffects(\ - TrackerSettings::Instance().m_dwQuality & QUALITY_SURROUND,\ - TrackerSettings::Instance().m_dwQuality & QUALITY_REVERB,\ - TrackerSettings::Instance().m_dwQuality & QUALITY_MEGABASS,\ - TrackerSettings::Instance().m_dwQuality & QUALITY_NOISEREDUCTION,\ - TrackerSettings::Instance().m_dwQuality & QUALITY_EQ) #include "mainbar.h" #include "TrackerSettings.h" @@ -367,6 +367,7 @@ // Low-Level Audio public: + static void UpdateDspEffects(); static void UpdateAudioParameters(BOOL bReset=FALSE); static void EnableLowLatencyMode(BOOL bOn=TRUE); static void CalcStereoVuMeters(int *, unsigned long, unsigned long); Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-03-25 20:20:56 UTC (rev 1688) @@ -706,7 +706,9 @@ // -! NEW_FEATURE#0024 { m_pSndFile->gnBitsPerSample = 24; +#ifndef NO_AGC m_pSndFile->SetAGC(FALSE); +#endif if (oldVol > 128) m_pSndFile->SetMasterVolume(128); } else { Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-03-25 20:20:56 UTC (rev 1688) @@ -500,19 +500,42 @@ m_CbnResampling.SetCurSel(TrackerSettings::Instance().m_nSrcMode); } // Effects +#ifndef NO_DSP if (dwQuality & QUALITY_MEGABASS) CheckDlgButton(IDC_CHECK1, MF_CHECKED); +#else + GetDlgItem(IDC_CHECK1)->ShowWindow(SW_HIDE); +#endif +#ifndef NO_AGC if (dwQuality & QUALITY_AGC) CheckDlgButton(IDC_CHECK2, MF_CHECKED); +#else + GetDlgItem(IDC_CHECK2)->ShowWindow(SW_HIDE); +#endif +#ifndef NO_DSP if (dwQuality & QUALITY_SURROUND) CheckDlgButton(IDC_CHECK4, MF_CHECKED); if (dwQuality & QUALITY_NOISEREDUCTION) CheckDlgButton(IDC_CHECK5, MF_CHECKED); +#else + GetDlgItem(IDC_CHECK4)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_CHECK5)->ShowWindow(SW_HIDE); +#endif +#ifndef NO_EQ if (CSoundFile::GetSysInfo() & SYSMIX_SLOWCPU) ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK3), FALSE); else if (dwQuality & QUALITY_EQ) CheckDlgButton(IDC_CHECK3, MF_CHECKED); +#else + GetDlgItem(IDC_CHECK3)->ShowWindow(SW_HIDE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK3), FALSE); +#endif +#ifndef NO_DSP // Bass Expansion m_SbXBassDepth.SetRange(0,4); m_SbXBassDepth.SetPos(8-CSoundFile::m_DSP.m_Settings.m_nXBassDepth); m_SbXBassRange.SetRange(0,4); m_SbXBassRange.SetPos(4 - (CSoundFile::m_DSP.m_Settings.m_nXBassRange - 1) / 5); +#else + m_SbXBassDepth.ShowWindow(SW_HIDE); + m_SbXBassRange.ShowWindow(SW_HIDE); +#endif // Reverb m_SbReverbDepth.SetRange(1, 16); m_SbReverbDepth.SetPos(CSoundFile::m_nReverbDepth); @@ -537,6 +560,7 @@ { if (dwQuality & QUALITY_REVERB) CheckDlgButton(IDC_CHECK6, MF_CHECKED); } +#ifndef NO_DSP // Surround { UINT n = CSoundFile::m_DSP.m_Settings.m_nProLogicDepth; @@ -547,6 +571,10 @@ m_SbSurroundDelay.SetRange(0, 8); m_SbSurroundDelay.SetPos((CSoundFile::m_DSP.m_Settings.m_nProLogicDelay-5)/5); } +#else + m_SbSurroundDepth.ShowWindow(SW_HIDE); + m_SbSurroundDelay.ShowWindow(SW_HIDE); +#endif //rewbs.resamplerConf OnResamplerChanged(); @@ -654,14 +682,23 @@ DWORD dwQuality = 0; DWORD dwSrcMode = 0; +#ifndef NO_DSP if (IsDlgButtonChecked(IDC_CHECK1)) dwQuality |= QUALITY_MEGABASS; +#endif +#ifndef NO_AGC if (IsDlgButtonChecked(IDC_CHECK2)) dwQuality |= QUALITY_AGC; +#endif +#ifndef NO_EQ if (IsDlgButtonChecked(IDC_CHECK3)) dwQuality |= QUALITY_EQ; +#endif +#ifndef NO_DSP if (IsDlgButtonChecked(IDC_CHECK4)) dwQuality |= QUALITY_SURROUND; if (IsDlgButtonChecked(IDC_CHECK5)) dwQuality |= QUALITY_NOISEREDUCTION; +#endif if (IsDlgButtonChecked(IDC_CHECK6)) dwQuality |= QUALITY_REVERB; dwSrcMode = m_CbnResampling.GetCurSel(); +#ifndef NO_DSP // Bass Expansion { UINT nXBassDepth = 8-m_SbXBassDepth.GetPos(); @@ -673,12 +710,14 @@ CSoundFile::m_DSP.m_Settings.m_nXBassDepth = nXBassDepth; CSoundFile::m_DSP.m_Settings.m_nXBassRange = nXBassRange; } +#endif // Reverb { // Reverb depth is dynamically changed UINT nReverbType = m_CbnReverbPreset.GetItemData(m_CbnReverbPreset.GetCurSel()); if (nReverbType < NUM_REVERBTYPES) CSoundFile::gnReverbType = nReverbType; } +#ifndef NO_DSP // Surround { UINT nProLogicDepth = m_SbSurroundDepth.GetPos(); @@ -686,6 +725,7 @@ CSoundFile::m_DSP.m_Settings.m_nProLogicDepth = nProLogicDepth; CSoundFile::m_DSP.m_Settings.m_nProLogicDelay = nProLogicDelay; } +#endif // Notify CMainFrame CMainFrame *pParent = CMainFrame::GetMainFrame(); //rewbs.resamplerConf @@ -912,8 +952,10 @@ void CEQSetupDlg::UpdateEQ(BOOL bReset) //------------------------------------- { +#ifndef NO_EQ CriticalSection cs; CSoundFile::SetEQGains( m_pEqPreset->Gains, MAX_EQ_BANDS, m_pEqPreset->Freqs, bReset); +#endif } Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-03-25 20:20:56 UTC (rev 1688) @@ -68,8 +68,10 @@ m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); // Default value will be overridden m_nBufferLength = 50; +#ifndef NO_EQ // Default EQ settings MemCopy(m_EqSettings, CEQSetupDlg::gEQPresets[0]); +#endif // MIDI Setup m_nMidiDevice = 0; @@ -416,14 +418,19 @@ // Effects Settings +#ifndef NO_DSP CSoundFile::m_DSP.m_Settings.m_nXBassDepth = CMainFrame::GetPrivateProfileLong("Effects", "XBassDepth", CSoundFile::m_DSP.m_Settings.m_nXBassDepth, iniFile); CSoundFile::m_DSP.m_Settings.m_nXBassRange = CMainFrame::GetPrivateProfileLong("Effects", "XBassRange", CSoundFile::m_DSP.m_Settings.m_nXBassRange, iniFile); +#endif CSoundFile::m_nReverbDepth = CMainFrame::GetPrivateProfileLong("Effects", "ReverbDepth", CSoundFile::m_nReverbDepth, iniFile); CSoundFile::gnReverbType = CMainFrame::GetPrivateProfileLong("Effects", "ReverbType", CSoundFile::gnReverbType, iniFile); +#ifndef NO_DSP CSoundFile::m_DSP.m_Settings.m_nProLogicDepth = CMainFrame::GetPrivateProfileLong("Effects", "ProLogicDepth", CSoundFile::m_DSP.m_Settings.m_nProLogicDepth, iniFile); CSoundFile::m_DSP.m_Settings.m_nProLogicDelay = CMainFrame::GetPrivateProfileLong("Effects", "ProLogicDelay", CSoundFile::m_DSP.m_Settings.m_nProLogicDelay, iniFile); +#endif +#ifndef NO_EQ // EQ Settings GetPrivateProfileStruct("Effects", "EQ_Settings", &m_EqSettings, sizeof(EQPreset), iniFile); GetPrivateProfileStruct("Effects", "EQ_User1", &CEQSetupDlg::gUserPresets[0], sizeof(EQPreset), iniFile); @@ -435,6 +442,7 @@ StringFixer::SetNullTerminator(CEQSetupDlg::gUserPresets[1].szName); StringFixer::SetNullTerminator(CEQSetupDlg::gUserPresets[2].szName); StringFixer::SetNullTerminator(CEQSetupDlg::gUserPresets[3].szName); +#endif // Auto saver settings @@ -561,12 +569,16 @@ dwSZSIZE = sizeof(m_szKbdFile); RegQueryValueEx(key, "Key_Config_File", NULL, &dwREG_SZ, (LPBYTE)m_szKbdFile, &dwSZSIZE); +#ifndef NO_DSP RegQueryValueEx(key, "XBassDepth", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::m_DSP.m_Settings.m_nXBassDepth, &dwDWORDSize); RegQueryValueEx(key, "XBassRange", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::m_DSP.m_Settings.m_nXBassRange, &dwDWORDSize); +#endif RegQueryValueEx(key, "ReverbDepth", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::m_nReverbDepth, &dwDWORDSize); RegQueryValueEx(key, "ReverbType", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::gnReverbType, &dwDWORDSize); +#ifndef NO_DSP RegQueryValueEx(key, "ProLogicDepth", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::m_DSP.m_Settings.m_nProLogicDepth, &dwDWORDSize); RegQueryValueEx(key, "ProLogicDelay", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::m_DSP.m_Settings.m_nProLogicDelay, &dwDWORDSize); +#endif RegQueryValueEx(key, "StereoSeparation", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::m_nStereoSeparation, &dwDWORDSize); RegQueryValueEx(key, "MixChannels", NULL, &dwREG_DWORD, (LPBYTE)&CSoundFile::m_nMaxMixChannels, &dwDWORDSize); RegQueryValueEx(key, "WaveDevice", NULL, &dwREG_DWORD, (LPBYTE)&m_nWaveDevice, &dwDWORDSize); @@ -589,12 +601,14 @@ RegQueryValueEx(key, "ChannelMode", NULL, &dwREG_DWORD, (LPBYTE)&m_nChannels, &dwDWORDSize); RegQueryValueEx(key, "MidiImportSpeed", NULL, &dwREG_DWORD, (LPBYTE)&midiImportSpeed, &dwDWORDSize); RegQueryValueEx(key, "MidiImportPatLen", NULL, &dwREG_DWORD, (LPBYTE)&midiImportPatternLen, &dwDWORDSize); +#ifndef NO_EQ // EQ LoadRegistryEQ(key, "EQ_Settings", &m_EqSettings); LoadRegistryEQ(key, "EQ_User1", &CEQSetupDlg::gUserPresets[0]); LoadRegistryEQ(key, "EQ_User2", &CEQSetupDlg::gUserPresets[1]); LoadRegistryEQ(key, "EQ_User3", &CEQSetupDlg::gUserPresets[2]); LoadRegistryEQ(key, "EQ_User4", &CEQSetupDlg::gUserPresets[3]); +#endif //rewbs.resamplerConf dwDWORDSize = sizeof(m_MixerSettings.gbWFIRType); @@ -778,18 +792,24 @@ // Older versions of OpenMPT 1.18+ will look for this file if this entry is missing, so removing this entry after having read it is kind of backwards compatible. WritePrivateProfileString("Paths", "Key_Config_File", nullptr, iniFile); +#ifndef NO_DSP CMainFrame::WritePrivateProfileLong("Effects", "XBassDepth", CSoundFile::m_DSP.m_Settings.m_nXBassDepth, iniFile); CMainFrame::WritePrivateProfileLong("Effects", "XBassRange", CSoundFile::m_DSP.m_Settings.m_nXBassRange, iniFile); +#endif CMainFrame::WritePrivateProfileLong("Effects", "ReverbDepth", CSoundFile::m_nReverbDepth, iniFile); CMainFrame::WritePrivateProfileLong("Effects", "ReverbType", CSoundFile::gnReverbType, iniFile); +#ifndef NO_DSP CMainFrame::WritePrivateProfileLong("Effects", "ProLogicDepth", CSoundFile::m_DSP.m_Settings.m_nProLogicDepth, iniFile); CMainFrame::WritePrivateProfileLong("Effects", "ProLogicDelay", CSoundFile::m_DSP.m_Settings.m_nProLogicDelay, iniFile); +#endif +#ifndef NO_EQ WritePrivateProfileStruct("Effects", "EQ_Settings", &m_EqSettings, sizeof(EQPreset), iniFile); WritePrivateProfileStruct("Effects", "EQ_User1", &CEQSetupDlg::gUserPresets[0], sizeof(EQPreset), iniFile); WritePrivateProfileStruct("Effects", "EQ_User2", &CEQSetupDlg::gUserPresets[1], sizeof(EQPreset), iniFile); WritePrivateProfileStruct("Effects", "EQ_User3", &CEQSetupDlg::gUserPresets[2], sizeof(EQPreset), iniFile); WritePrivateProfileStruct("Effects", "EQ_User4", &CEQSetupDlg::gUserPresets[3], sizeof(EQPreset), iniFile); +#endif if(CMainFrame::m_pAutoSaver != nullptr) { Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2013-03-25 20:20:56 UTC (rev 1688) @@ -168,7 +168,9 @@ DWORD m_dwSoundSetup, m_dwRate, m_dwQuality, m_nSrcMode, m_nBitsPerSample, m_nPreAmp, gbLoopSong, m_nChannels; LONG m_nWaveDevice; // use the SNDDEV_GET_NUMBER and SNDDEV_GET_TYPE macros to decode DWORD m_nBufferLength; +#ifndef NO_EQ EQPreset m_EqSettings; +#endif // MIDI Setup LONG m_nMidiDevice; Modified: trunk/OpenMPT/sounddsp/DSP.cpp =================================================================== --- trunk/OpenMPT/sounddsp/DSP.cpp 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/sounddsp/DSP.cpp 2013-03-25 20:20:56 UTC (rev 1688) @@ -15,17 +15,18 @@ #include <math.h> +#ifndef NO_DSP + + // Bass Expansion #define DEFAULT_XBASS_RANGE 14 // (x+2)*20 Hz (320Hz) #define DEFAULT_XBASS_DEPTH 6 // 1+(3>>(x-4)) (+6dB) - //////////////////////////////////////////////////////////////////// // DSP Effects internal state - extern VOID MPPASMCALL X86_InitMixBuffer(int *pBuffer, UINT nSamples); static VOID MPPASMCALL X86_StereoDCRemoval(int *, UINT count, LONG *nDCRFlt_Y1l, LONG *nDCRFlt_X1l, LONG *nDCRFlt_Y1r, LONG *nDCRFlt_X1r); @@ -509,3 +510,5 @@ } +#endif // NO_DSP + Modified: trunk/OpenMPT/sounddsp/DSP.h =================================================================== --- trunk/OpenMPT/sounddsp/DSP.h 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/sounddsp/DSP.h 2013-03-25 20:20:56 UTC (rev 1688) @@ -12,6 +12,8 @@ #pragma once +#ifndef NO_DSP + // Buffer Sizes #define SURROUNDBUFFERSIZE 2048 // 50ms @ 48kHz @@ -89,3 +91,4 @@ void ProcessQuadSurround(int * MixSoundBuffer, int * MixRearBuffer, int count); }; +#endif // NO_DSP Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2013-03-25 20:20:56 UTC (rev 1688) @@ -275,16 +275,24 @@ // Global Options (Renderer) #define SNDMIX_REVERSESTEREO 0x0001 // swap L/R audio channels +#ifndef NO_DSP #define SNDMIX_NOISEREDUCTION 0x0002 // reduce hiss (do not use, it's just a simple low-pass filter) +#endif // NO_DSP +#ifndef NO_AGC #define SNDMIX_AGC 0x0004 // automatic gain control +#endif // ~NO_AGC #define SNDMIX_NORESAMPLING 0x0008 // force no resampling // SNDMIX_NOLINEARSRCMODE is the default //#define SNDMIX_HQRESAMPLER 0x0010 //rewbs.resamplerConf: renamed SNDMIX_HQRESAMPLER to SNDMIX_SPLINESRCMODE #define SNDMIX_SPLINESRCMODE 0x0010 // cubic resampling (?) +#ifndef NO_DSP #define SNDMIX_MEGABASS 0x0020 // bass expansion #define SNDMIX_SURROUND 0x0040 // surround mix +#endif // NO_DSP #define SNDMIX_REVERB 0x0080 // apply reverb +#ifndef NO_EQ #define SNDMIX_EQ 0x0100 // apply EQ +#endif // NO_EQ #define SNDMIX_SOFTPANNING 0x0200 // soft panning mode (this is forced with mixmode RC3 and later) //#define SNDMIX_ULTRAHQSRCMODE 0x0400 //rewbs.resamplerConf: renamed SNDMIX_ULTRAHQSRCMODE to SNDMIX_POLYPHASESRCMODE #define SNDMIX_POLYPHASESRCMODE 0x0400 // polyphase resampling Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-25 20:20:56 UTC (rev 1688) @@ -916,13 +916,16 @@ //------------------------------------------------------------------------------------------ { CriticalSection cs; - - DWORD d = gdwSoundSetup & ~(SNDMIX_SURROUND | SNDMIX_REVERB | SNDMIX_MEGABASS | SNDMIX_NOISEREDUCTION | SNDMIX_EQ); - if (bSurround) d |= SNDMIX_SURROUND; - if ((bReverb) && (gdwSysInfo & SYSMIX_ENABLEMMX)) d |= SNDMIX_REVERB; - if (bMegaBass) d |= SNDMIX_MEGABASS; - if (bNR) d |= SNDMIX_NOISEREDUCTION; - if (bEQ) d |= SNDMIX_EQ; + DWORD d = gdwSoundSetup; + if ((bReverb) && (gdwSysInfo & SYSMIX_ENABLEMMX)) d |= SNDMIX_REVERB; else d &= ~SNDMIX_REVERB; +#ifndef NO_DSP + if (bSurround) d |= SNDMIX_SURROUND; else d &= ~SNDMIX_SURROUND; + if (bMegaBass) d |= SNDMIX_MEGABASS; else d &= ~SNDMIX_MEGABASS; + if (bNR) d |= SNDMIX_NOISEREDUCTION; else d &= ~SNDMIX_NOISEREDUCTION; +#endif +#ifndef NO_EQ + if (bEQ) d |= SNDMIX_EQ; else d &= ~SNDMIX_EQ; +#endif gdwSoundSetup = d; InitPlayer(FALSE); return TRUE; @@ -956,14 +959,17 @@ { if (nVol < 1) nVol = 1; if (nVol > 0x200) nVol = 0x200; // x4 maximum +#ifndef NO_AGC if ((nVol < m_nMasterVolume) && (nVol) && (gdwSoundSetup & SNDMIX_AGC) && (adjustAGC)) { m_AGC.Adjust(m_nMasterVolume, nVol); } +#endif m_nMasterVolume = nVol; } +#ifndef NO_AGC void CSoundFile::SetAGC(BOOL b) //----------------------------- { @@ -976,6 +982,7 @@ } } else gdwSoundSetup &= ~SNDMIX_AGC; } +#endif UINT CSoundFile::GetCurrentPos() const Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-03-25 20:20:56 UTC (rev 1688) @@ -231,9 +231,15 @@ bool m_bITBidiMode; // Process bidi loops like Impulse Tracker (see Fastmix.cpp for an explanation) public: // Static Members +#ifndef NO_DSP static CDSP m_DSP; +#endif +#ifndef NO_EQ static CEQ m_EQ; +#endif +#ifndef NO_AGC static CAGC m_AGC; +#endif static UINT m_nReverbDepth, gnReverbType; static UINT m_nStereoSeparation; static UINT m_nMaxMixChannels; @@ -478,22 +484,21 @@ static MixerSettings GetMixerSettings(); static BOOL InitPlayer(BOOL bReset=FALSE); static BOOL SetWaveConfig(UINT nRate,UINT nBits,UINT nChannels,BOOL bMMX=FALSE); - static BOOL SetDspEffects(BOOL bSurround,BOOL bReverb,BOOL xbass,BOOL dolbynr=FALSE,BOOL bEQ=FALSE); + static BOOL SetDspEffects(BOOL bSurround,BOOL bReverb,BOOL xbass,BOOL dolbynr,BOOL bEQ); static BOOL SetResamplingMode(UINT nMode); // SRCMODE_XXXX static DWORD GetSampleRate() { return gdwMixingFreq; } static DWORD GetBitsPerSample() { return gnBitsPerSample; } static DWORD InitSysInfo(); static DWORD GetSysInfo() { return gdwSysInfo; } static void EnableMMX(bool b) { if (b) gdwSoundSetup |= SNDMIX_ENABLEMMX; else gdwSoundSetup &= ~SNDMIX_ENABLEMMX; } - // AGC - static BOOL GetAGC() { return (gdwSoundSetup & SNDMIX_AGC) ? TRUE : FALSE; } +#ifndef NO_AGC static void SetAGC(BOOL b); +#endif // [Reverb level 0(quiet)-100(loud)], [REVERBTYPE_XXXX] static BOOL SetReverbParameters(UINT nDepth, UINT nType); -#ifdef ENABLE_EQ - // EQ - static void SetEQGains(const UINT *pGains, UINT nBands, const UINT *pFreqs=NULL, BOOL bReset=FALSE) { m_EQ.SetEQGains(pGains, nBands, pFreqs, bReset, gdwMixingFreq); } // 0=-12dB, 32=+12dB -#endif +#ifndef NO_EQ + static void SetEQGains(const UINT *pGains, UINT nBands, const UINT *pFreqs=NULL, BOOL bReset=FALSE) { m_EQ.SetEQGains(pGains, nBands, pFreqs, bReset, gdwMixingFreq); } // 0=-12dB, 32=+12dB +#endif // NO_EQ // Float <-> Int conversion routines /*static */VOID StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount); /*static */VOID FloatToStereoMix(const float *pIn1, const float *pIn2, int *pOut, UINT nCount); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-25 18:58:54 UTC (rev 1687) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-25 20:20:56 UTC (rev 1688) @@ -35,9 +35,15 @@ DWORD CSoundFile::gdwMixingFreq = 44100; DWORD CSoundFile::gnBitsPerSample = 16; // Mixing data initialized in +#ifndef NO_DSP CDSP CSoundFile::m_DSP; +#endif +#ifndef NO_EQ CEQ CSoundFile::m_EQ; +#endif +#ifndef NO_AGC CAGC CSoundFile::m_AGC; +#endif double CSoundFile::gdWFIRCutoff = 0.97; //default value BYTE CSoundFile::gbWFIRType = 7; //WFIR_KAISER4T; //default value UINT CSoundFile::gnVolumeRampUpSamples = 42; //default value @@ -90,7 +96,7 @@ // Log tables for pre-amp // Pre-amp (or more precisely: Pre-attenuation) depends on the number of channels, // Which this table takes care of. -const UINT PreAmpTable[16] = +static const UINT PreAmpTable[16] = { 0x60, 0x60, 0x60, 0x70, // 0-7 0x80, 0x88, 0x90, 0x98, // 8-15 @@ -98,13 +104,15 @@ 0xB0, 0xB4, 0xB8, 0xBC, // 24-31 }; -const UINT PreAmpAGCTable[16] = +#ifndef NO_AGC +static const UINT PreAmpAGCTable[16] = { 0x60, 0x60, 0x60, 0x64, 0x68, 0x70, 0x78, 0x80, 0x84, 0x88, 0x8C, 0x90, 0x92, 0x94, 0x96, 0x98, }; +#endif typedef CTuning::RATIOTYPE RATIOTYPE; @@ -170,8 +178,10 @@ #ifndef NO_REVERB InitializeReverb(bReset); #endif +#ifndef NO_DSP m_DSP.Initialize(bReset, gdwMixingFreq, gdwSoundSetup); -#ifdef ENABLE_EQ +#endif +#ifndef NO_EQ m_EQ.Initialize(bReset, gdwMixingFreq); #endif return TRUE; @@ -333,9 +343,11 @@ } } +#ifndef NO_DSP m_DSP.Process(MixSoundBuffer, MixRearBuffer, lCount, gdwSoundSetup, gnChannels); +#endif -#ifdef ENABLE_EQ +#ifndef NO_EQ // Graphic Equalizer if (gdwSoundSetup & SNDMIX_EQ) { @@ -344,7 +356,7 @@ else m_EQ.ProcessMono(MixSoundBuffer, lCount, m_pConfig); } -#endif // ENABLE_EQ +#endif // NO_EQ nStat++; @@ -1691,7 +1703,11 @@ if (m_pConfig->getUseGlobalPreAmp()) { - UINT attenuation = (gdwSoundSetup & SNDMIX_AGC) ? PreAmpAGCTable[nchn32 >> 1] : PreAmpTable[nchn32 >> 1]; + UINT attenuation = +#ifndef NO_AGC + (gdwSoundSetup & SNDMIX_AGC) ? PreAmpAGCTable[nchn32 >> 1] : +#endif + PreAmpTable[nchn32 >> 1]; if(attenuation < 1) attenuation = 1; nMasterVol = (mastervol << 7) / attenuation; } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |