diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-06 15:41:19 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-06 15:41:19 +1000 |
| commit | c99e05026f918a44dd43ba58ceaa15ecdd9bb7ad (patch) | |
| tree | 6452562f778c47e69cdd5900c41e1e3b72d88350 /plugin/src/Caelestia/beattracker.cpp | |
| parent | plugin: namespace everything (diff) | |
| download | caelestia-shell-c99e05026f918a44dd43ba58ceaa15ecdd9bb7ad.tar.gz caelestia-shell-c99e05026f918a44dd43ba58ceaa15ecdd9bb7ad.tar.bz2 caelestia-shell-c99e05026f918a44dd43ba58ceaa15ecdd9bb7ad.zip | |
plugin: abstract service + ref
Diffstat (limited to 'plugin/src/Caelestia/beattracker.cpp')
| -rw-r--r-- | plugin/src/Caelestia/beattracker.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/plugin/src/Caelestia/beattracker.cpp b/plugin/src/Caelestia/beattracker.cpp index 433ffab..aeca64b 100644 --- a/plugin/src/Caelestia/beattracker.cpp +++ b/plugin/src/Caelestia/beattracker.cpp @@ -1,5 +1,6 @@ #include "beattracker.hpp" +#include "service.hpp" #include <QAudioSource> #include <QDebug> #include <QIODevice> @@ -10,13 +11,12 @@ namespace caelestia { BeatTracker::BeatTracker(uint_t sampleRate, uint_t hopSize, QObject* parent) - : QObject(parent) + : Service(parent) , m_tempo(new_aubio_tempo("default", 1024, hopSize, sampleRate)) , m_in(new_fvec(hopSize)) , m_out(new_fvec(2)) , m_hopSize(hopSize) - , m_bpm(120) - , m_refCount(0) { + , m_bpm(120) { QAudioFormat format; format.setSampleRate(static_cast<int>(sampleRate)); format.setChannelCount(1); @@ -39,25 +39,6 @@ smpl_t BeatTracker::bpm() const { return m_bpm; } -int BeatTracker::refCount() const { - return m_refCount; -} - -void BeatTracker::setRefCount(int refCount) { - if (m_refCount == refCount) { - return; - } - - m_refCount = refCount; - emit refCountChanged(); - - if (m_refCount == 0) { - stop(); - } else if (!m_device) { - start(); - } -} - void BeatTracker::start() { m_device = m_source->start(); connect(m_device, &QIODevice::readyRead, this, &BeatTracker::process); |