-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaudiodevice.h
39 lines (27 loc) · 887 Bytes
/
audiodevice.h
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
#pragma once
#include "basedevice.h"
// Qt includes
#include <QAudioDeviceInfo>
// system includes
#include <memory>
// forward declares
class QAudioInput;
class AudioDevice : public BaseDevice
{
Q_OBJECT
public:
explicit AudioDevice(QObject *parent = nullptr);
~AudioDevice() override;
void start() override;
void stop() override;
bool running() const override { return m_private != nullptr; }
int samplerate() const override { return m_samplerate; }
void setSamplerate(int samplerate) override { Q_ASSERT(!running()); m_samplerate = samplerate; }
const auto &device() const { return m_device; }
void setDevice(const QAudioDeviceInfo &device) { Q_ASSERT(!running()); m_device = device; }
private:
class AudioDevicePrivate;
std::unique_ptr<AudioDevicePrivate> m_private;
int m_samplerate;
QAudioDeviceInfo m_device;
};