src/platform/qt/AudioDevice.h (view raw)
1#ifndef QGBA_AUDIO_DEVICE
2#define QGBA_AUDIO_DEVICE
3
4#include <QAudioFormat>
5#include <QAudioOutput>
6#include <QIODevice>
7#include <QThread>
8
9struct GBAAudio;
10
11namespace QGBA {
12
13class AudioDevice : public QIODevice {
14Q_OBJECT
15
16public:
17 AudioDevice(GBAAudio* audio, QObject* parent = 0);
18
19 void setFormat(const QAudioFormat& format);
20
21 class Thread : public QThread {
22 public:
23 Thread(QObject* parent = 0);
24
25 void setInput(GBAAudio* input);
26
27 protected:
28 void run();
29
30 private:
31 GBAAudio* m_input;
32 };
33
34protected:
35 virtual qint64 readData(char* data, qint64 maxSize);
36 virtual qint64 writeData(const char* data, qint64 maxSize);
37
38private:
39 GBAAudio* m_audio;
40 float m_drift;
41 float m_ratio;
42};
43
44}
45
46#endif