From 2c5801237cfb4eb5686da43dcf6a5fff9baa1f62 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 7 Sep 2025 15:15:10 +1000 Subject: plugin/ap: properly buffer data Run at a stable fps instead of in large chunks Use one thread for collecting and another for processing --- plugin/src/Caelestia/beattracker.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'plugin/src/Caelestia/beattracker.hpp') diff --git a/plugin/src/Caelestia/beattracker.hpp b/plugin/src/Caelestia/beattracker.hpp index edb9c0c..a490f9d 100644 --- a/plugin/src/Caelestia/beattracker.hpp +++ b/plugin/src/Caelestia/beattracker.hpp @@ -7,12 +7,12 @@ namespace caelestia { -class BeatWorker : public AudioWorker { +class BeatProcessor : public AudioProcessor { Q_OBJECT public: - explicit BeatWorker(uint_t sampleRate = 44100, uint_t hopSize = 512, QObject* parent = nullptr); - ~BeatWorker(); + explicit BeatProcessor(AudioProvider* provider, QObject* parent = nullptr); + ~BeatProcessor(); signals: void beat(smpl_t bpm); @@ -22,8 +22,7 @@ private: fvec_t* m_in; fvec_t* m_out; - void processData() override; - void consumeData() override; + void processChunk(const QVector& chunk) override; }; class BeatTracker : public AudioProvider { @@ -34,7 +33,7 @@ class BeatTracker : public AudioProvider { Q_PROPERTY(smpl_t bpm READ bpm NOTIFY bpmChanged) public: - explicit BeatTracker(uint_t sampleRate = 44100, uint_t hopSize = 512, QObject* parent = nullptr); + explicit BeatTracker(int sampleRate = 44100, int chunkSize = 512, QObject* parent = nullptr); [[nodiscard]] smpl_t bpm() const; -- cgit v1.2.3-freya