From 8c007789f6ac60e33f3cc26200b8b301755a177a Mon Sep 17 00:00:00 2001 From: Alex Marsev Date: Sat, 20 Feb 2016 13:12:16 +0300 Subject: Deter GPL virus by preprocessor definition --- dll/sanear.props | 1 + src/AudioRenderer.cpp | 8 ++++++++ src/AudioRenderer.h | 8 ++++++++ src/DspTempo2.cpp | 6 ++++++ src/DspTempo2.h | 6 ++++++ src/Settings.cpp | 5 +++++ src/Settings.h | 7 ++++++- 7 files changed, 40 insertions(+), 1 deletion(-) diff --git a/dll/sanear.props b/dll/sanear.props index 3775da9..ac7ef52 100644 --- a/dll/sanear.props +++ b/dll/sanear.props @@ -3,6 +3,7 @@ + SANEAR_GPL_PHASE_VOCODER;%(PreprocessorDefinitions) $(SolutionDir)src\baseclasses;$(SolutionDir)src\soxr\src;$(SolutionDir)src\libbs2b\src;$(SolutionDir)src\soundtouch\include;$(SolutionDir)src\zita-resampler\libs;$(SolutionDir)src\rubberband\rubberband;%(AdditionalIncludeDirectories) diff --git a/src/AudioRenderer.cpp b/src/AudioRenderer.cpp index dc0d7d9..f5b67cc 100644 --- a/src/AudioRenderer.cpp +++ b/src/AudioRenderer.cpp @@ -428,6 +428,7 @@ namespace SaneAudioRenderer bool clearForTimestretch = false; { + #ifdef SANEAR_GPL_PHASE_VOCODER UINT32 timestretchMethod; m_settings->GetTimestretchSettings(×tretchMethod); const bool usePhaseVocoder = (timestretchMethod == ISettings::TIMESTRETCH_METHOD_PHASE_VOCODER); @@ -437,6 +438,7 @@ namespace SaneAudioRenderer { clearForTimestretch = true; } + #endif } m_deviceSettingsSerial = newSettingsSerial; @@ -764,14 +766,20 @@ namespace SaneAudioRenderer const auto outChannels = m_device->GetWaveFormat()->nChannels; const auto outMask = DspMatrix::GetChannelMask(*m_device->GetWaveFormat()); + #ifdef SANEAR_GPL_PHASE_VOCODER UINT32 timestretchMethod; m_settings->GetTimestretchSettings(×tretchMethod); const bool usePhaseVocoder = (timestretchMethod == ISettings::TIMESTRETCH_METHOD_PHASE_VOCODER); + #endif m_dspMatrix.Initialize(inChannels, inMask, outChannels, outMask); m_dspRate.Initialize(m_live || m_externalClock, inRate, outRate, outChannels); + #ifdef SANEAR_GPL_PHASE_VOCODER m_dspTempo1.Initialize(usePhaseVocoder ? 1.0 : m_rate, outRate, outChannels); m_dspTempo2.Initialize(usePhaseVocoder ? m_rate : 1.0, outRate, outChannels); + #else + m_dspTempo.Initialize(m_rate, outRate, outChannels); + #endif m_dspCrossfeed.Initialize(m_settings, outRate, outChannels, outMask); m_dspLimiter.Initialize(outRate, outChannels, m_device->IsExclusive()); m_dspDither.Initialize(m_device->GetDspFormat()); diff --git a/src/AudioRenderer.h b/src/AudioRenderer.h index 6e9e07d..960b476 100644 --- a/src/AudioRenderer.h +++ b/src/AudioRenderer.h @@ -82,8 +82,12 @@ namespace SaneAudioRenderer { f(&m_dspMatrix); f(&m_dspRate); + #ifdef SANEAR_GPL_PHASE_VOCODER f(&m_dspTempo1); f(&m_dspTempo2); + #else + f(&m_dspTempo); + #endif f(&m_dspCrossfeed); f(&m_dspVolume); f(&m_dspBalance); @@ -117,8 +121,12 @@ namespace SaneAudioRenderer DspMatrix m_dspMatrix; DspRate m_dspRate; + #ifdef SANEAR_GPL_PHASE_VOCODER DspTempo m_dspTempo1; DspTempo2 m_dspTempo2; + #else + DspTempo m_dspTempo; + #endif DspCrossfeed m_dspCrossfeed; DspVolume m_dspVolume; DspBalance m_dspBalance; diff --git a/src/DspTempo2.cpp b/src/DspTempo2.cpp index f94f293..78d024f 100644 --- a/src/DspTempo2.cpp +++ b/src/DspTempo2.cpp @@ -1,6 +1,10 @@ #include "pch.h" #include "DspTempo2.h" +#ifndef SANEAR_GPL_PHASE_VOCODER +namespace SaneAudioRenderer { void DspTempo2::ShutNoPublicSymbolsWarning() {} } +#else + namespace SaneAudioRenderer { void DspTempo2::Initialize(double tempo, uint32_t rate, uint32_t channels) @@ -128,3 +132,5 @@ namespace SaneAudioRenderer chunk = std::move(output); } } + +#endif diff --git a/src/DspTempo2.h b/src/DspTempo2.h index faf066d..43bea65 100644 --- a/src/DspTempo2.h +++ b/src/DspTempo2.h @@ -1,5 +1,9 @@ #pragma once +#ifndef SANEAR_GPL_PHASE_VOCODER +namespace SaneAudioRenderer { struct DspTempo2 final { void ShutNoPublicSymbolsWarning(); }; } +#else + #include "DspBase.h" #include @@ -41,3 +45,5 @@ namespace SaneAudioRenderer uint32_t m_channels = 0; }; } + +#endif diff --git a/src/Settings.cpp b/src/Settings.cpp index f22999c..bb79597 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -169,6 +169,11 @@ namespace SaneAudioRenderer return E_INVALIDARG; } + #ifndef SANEAR_GPL_PHASE_VOCODER + if (uTimestretchMethod == TIMESTRETCH_METHOD_PHASE_VOCODER) + return E_NOTIMPL; + #endif + CAutoLock lock(this); if (uTimestretchMethod != m_timestretchMethod) diff --git a/src/Settings.h b/src/Settings.h index 12c3b5a..ddee1a6 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -57,6 +57,11 @@ namespace SaneAudioRenderer BOOL m_ignoreSystemChannelMixer = TRUE; - UINT32 m_timestretchMethod = TIMESTRETCH_METHOD_PHASE_VOCODER; + UINT32 m_timestretchMethod = + #ifdef SANEAR_GPL_PHASE_VOCODER + TIMESTRETCH_METHOD_PHASE_VOCODER; + #else + TIMESTRETCH_METHOD_SOLA; + #endif }; } -- cgit v1.2.3