Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/sanear.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Marsev <alex.marsev@gmail.com>2016-02-20 13:12:16 +0300
committerAlex Marsev <alex.marsev@gmail.com>2016-02-20 13:22:20 +0300
commit8c007789f6ac60e33f3cc26200b8b301755a177a (patch)
tree2aedb6fbdbb5455fe2f3faf9acce617cbb998cb1
parentb728fdcc811cb2043326591e8c335caa0d869586 (diff)
Deter GPL virus by preprocessor definition
-rw-r--r--dll/sanear.props1
-rw-r--r--src/AudioRenderer.cpp8
-rw-r--r--src/AudioRenderer.h8
-rw-r--r--src/DspTempo2.cpp6
-rw-r--r--src/DspTempo2.h6
-rw-r--r--src/Settings.cpp5
-rw-r--r--src/Settings.h7
7 files changed, 40 insertions, 1 deletions
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 @@
<Import Project="$(SolutionDir)base.props" />
<ItemDefinitionGroup>
<ClCompile>
+ <PreprocessorDefinitions>SANEAR_GPL_PHASE_VOCODER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(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)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
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(&timestretchMethod);
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(&timestretchMethod);
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 <RubberBandStretcher.h>
@@ -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
};
}