summaryrefslogtreecommitdiff
path: root/Detector.hpp
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2018-02-16 15:17:14 +0000
committerhibby <d@vehibberd.com>2018-02-16 15:17:14 +0000
commit37f727ac0746fd85504aa46c1f023c09b3eff33a (patch)
treec8a7ce04545040a8f161ba279528730bd9a3e6ab /Detector.hpp
parentd63dd8d081a6fcd0715cd13f26df59fb831769d2 (diff)
New upstream version 1.8.0+repackupstream/1.8.0+repack
Diffstat (limited to 'Detector.hpp')
-rw-r--r--Detector.hpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/Detector.hpp b/Detector.hpp
index 355dff15..c4cbf340 100644
--- a/Detector.hpp
+++ b/Detector.hpp
@@ -1,8 +1,6 @@
#ifndef DETECTOR_HPP__
#define DETECTOR_HPP__
-
#include "AudioDevice.hpp"
-
#include <QScopedArrayPointer>
//
@@ -22,21 +20,23 @@ public:
//
// we down sample by a factor of 4
//
- // the framesPerSignal argument is the number after down sampling
+ // the samplesPerFFT argument is the number after down sampling
//
- Detector (unsigned frameRate, unsigned periodLengthInSeconds, unsigned framesPerSignal, unsigned downSampleFactor = 4u, QObject * parent = 0);
-
- Q_SIGNAL void framesWritten (qint64) const;
+ Detector (unsigned frameRate, unsigned periodLengthInSeconds, unsigned downSampleFactor = 4u, QObject * parent = 0);
+ void setPeriod(unsigned p) {m_period=p;}
bool reset () override;
+ Q_SIGNAL void framesWritten (qint64) const;
+ Q_SLOT void setBlockSize (unsigned);
+
protected:
- qint64 readData (char * /* data */, qint64 /* maxSize */)
+ qint64 readData (char * /* data */, qint64 /* maxSize */) override
{
return -1; // we don't produce data
}
- qint64 writeData (char const * data, qint64 maxSize);
+ qint64 writeData (char const * data, qint64 maxSize) override;
private:
void clear (); // discard buffer contents
@@ -45,8 +45,9 @@ private:
unsigned m_frameRate;
unsigned m_period;
unsigned m_downSampleFactor;
- qint32 m_framesPerSignal; // after any down sampling
- bool m_starting;
+ qint32 m_samplesPerFFT; // after any down sampling
+ qint32 m_ns;
+ static size_t const max_buffer_size {7 * 512};
QScopedArrayPointer<short> m_buffer; // de-interleaved sample buffer
// big enough for all the
// samples for one increment of