blob: 1edefffcd77dd69adade18839f9cd2552ebac204 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#pragma once
#include "service.hpp"
#include <QObject>
#include <QThread>
#include <QTimer>
#include <cstdint>
#include <qqmlintegration.h>
namespace caelestia {
class AudioProcessor : public QObject {
Q_OBJECT
public:
explicit AudioProcessor(QObject* parent = nullptr);
~AudioProcessor();
void init();
protected:
uint32_t m_sampleRate;
uint32_t m_chunkSize;
private:
QTimer* m_timer;
Q_INVOKABLE void start();
Q_INVOKABLE void stop();
virtual void process() = 0;
};
class AudioProvider : public Service {
Q_OBJECT
public:
explicit AudioProvider(QObject* parent = nullptr);
~AudioProvider();
protected:
AudioProcessor* m_processor;
void init();
private:
QThread* m_thread;
void start() override;
void stop() override;
};
} // namespace caelestia
|