diff options
author | Alex Marsev <alex.marsev@gmail.com> | 2015-08-03 20:30:05 +0300 |
---|---|---|
committer | Alex Marsev <alex.marsev@gmail.com> | 2015-08-03 20:30:05 +0300 |
commit | 1c9cae8d2493fa7fa198a167b39785e8f14f257c (patch) | |
tree | bbd2f1e1411ee45b21a6b75091a08ce11ed17e06 | |
parent | 662a7e29a59d7cc0a82f59a1544ea8cbe38bbf64 (diff) |
Don't show DspDither as active when it's not used
-rwxr-xr-x | src/DspDither.cpp | 12 | ||||
-rwxr-xr-x | src/DspDither.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/DspDither.cpp b/src/DspDither.cpp index c8682b0..7c9cbba 100755 --- a/src/DspDither.cpp +++ b/src/DspDither.cpp @@ -5,7 +5,8 @@ namespace SaneAudioRenderer {
void DspDither::Initialize(DspFormat outputFormat)
{
- m_active = (outputFormat == DspFormat::Pcm16);
+ m_enabled = (outputFormat == DspFormat::Pcm16);
+ m_active = m_enabled;
for (size_t i = 0; i < 18; i++)
{
@@ -17,13 +18,18 @@ namespace SaneAudioRenderer bool DspDither::Active()
{
- return m_active;
+ return m_enabled && m_active;
}
void DspDither::Process(DspChunk& chunk)
{
- if (!m_active || chunk.IsEmpty() || chunk.GetFormatSize() <= DspFormatSize(DspFormat::Pcm16))
+ if (!m_enabled || chunk.IsEmpty() || chunk.GetFormatSize() <= DspFormatSize(DspFormat::Pcm16))
+ {
+ m_active = false;
return;
+ }
+
+ m_active = true;
DspChunk::ToFloat(chunk);
diff --git a/src/DspDither.h b/src/DspDither.h index 6fe5422..48f7294 100755 --- a/src/DspDither.h +++ b/src/DspDither.h @@ -24,6 +24,7 @@ namespace SaneAudioRenderer private:
+ bool m_enabled = false;
bool m_active = false;
std::array<float, 18> m_previous;
std::array<std::minstd_rand, 18> m_generator;
|