-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevicedialog.h
61 lines (51 loc) · 1.6 KB
/
devicedialog.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef DEVICEDIALOG_H
#define DEVICEDIALOG_H
#include <mutex>
#include <QDialog>
#include <QTimer>
#include "RtAudio.h"
#include "definitions.h"
namespace Ui {
class DeviceDialog;
}
class DeviceDialog : public QDialog
{
Q_OBJECT
public:
DeviceDialog(RtAudio::Api api, RtAudio::DeviceInfo deviceInfo, QWidget *parent = nullptr);
~DeviceDialog();
private slots:
void onDeviceSettingsChanged();
void onActivateDeviceCheckBoxToggled(bool);
void onRunTimer();
private:
Ui::DeviceDialog *ui;
RtAudio m_rtAudio;
RtAudio::DeviceInfo m_deviceInfo;
QTimer m_runTimer;
struct RuntimeData {
// Setup
unsigned int inChannelCount=0;
unsigned int outChannelCount=0;
unsigned int sampleRate=0;
unsigned int bufferSize=0;
// UI => callback
double sinFrequency;
double sinAmplitude;
// Callback => UI
std::vector<float> inChannelsAmplitude;
std::vector<float> inChannelsAverageAmplitude;
std::vector<float> inChannelsPeakAmplitude;
unsigned int lastErrorStatus=0;
};
std::mutex m_runtimeDataMutex;
RuntimeData m_runtimeData;
friend int cRtAudioCallback(void* outputBuffer, void* inputBuffer,
unsigned int nFrames, double streamTime,
RtAudioStreamStatus status, void* userData);
int rtAudioCallback(void* outputBuffer, void* inputBuffer,
unsigned int nFrames, double streamTime,
RtAudioStreamStatus status);
void updateRuntimeWidgets();
};
#endif // DEVICEDIALOG_H