diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-07 15:15:10 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-07 15:15:10 +1000 |
| commit | 2c5801237cfb4eb5686da43dcf6a5fff9baa1f62 (patch) | |
| tree | 64bdbdbf051259586745fc8ae47c33e572ffb03b /plugin/src/Caelestia/beattracker.hpp | |
| parent | plugin: async audio processing (diff) | |
| download | caelestia-shell-2c5801237cfb4eb5686da43dcf6a5fff9baa1f62.tar.gz caelestia-shell-2c5801237cfb4eb5686da43dcf6a5fff9baa1f62.tar.bz2 caelestia-shell-2c5801237cfb4eb5686da43dcf6a5fff9baa1f62.zip | |
plugin/ap: properly buffer data
Run at a stable fps instead of in large chunks
Use one thread for collecting and another for processing
Diffstat (limited to '')
| -rw-r--r-- | plugin/src/Caelestia/beattracker.hpp | 11 |
1 files changed, 5 insertions, 6 deletions
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<double>& 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; |