changeset 199:28850f3cf65b

Reject troublesome sample rates
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 06 Feb 2018 21:11:43 +0000
parents 3fcced536a9e
children ca1d5e02355b
files plugins/ChromagramPlugin.cpp plugins/ConstantQSpectrogram.cpp
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChromagramPlugin.cpp	Mon Feb 05 19:07:29 2018 +0000
+++ b/plugins/ChromagramPlugin.cpp	Tue Feb 06 21:11:43 2018 +0000
@@ -216,6 +216,11 @@
     if (channels < getMinChannelCount() ||
 	channels > getMaxChannelCount()) return false;
 
+    if (m_inputSampleRate > 384000) {
+        std::cerr << "ChromagramPlugin::initialise: Maximum input sample rate is 384000" << std::endl;
+        return false;
+    }
+
     m_chromagram = new Chromagram(m_config);
     m_binsums = vector<double>(m_config.BPO);
 
--- a/plugins/ConstantQSpectrogram.cpp	Mon Feb 05 19:07:29 2018 +0000
+++ b/plugins/ConstantQSpectrogram.cpp	Tue Feb 06 21:11:43 2018 +0000
@@ -213,6 +213,11 @@
     if (channels < getMinChannelCount() ||
 	channels > getMaxChannelCount()) return false;
 
+    if (m_inputSampleRate > 384000) {
+        std::cerr << "ConstantQSpectrogram::initialise: Maximum input sample rate is 384000" << std::endl;
+        return false;
+    }
+
     setupConfig();
 
     m_cq = new ConstantQ(m_config);