src/platform/qt/AudioDevice.h (view raw)
1/* Copyright (c) 2013-2014 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_AUDIO_DEVICE
7#define QGBA_AUDIO_DEVICE
8#include <QAudioFormat>
9#include <QIODevice>
10
11struct GBAThread;
12
13namespace QGBA {
14
15class AudioDevice : public QIODevice {
16Q_OBJECT
17
18public:
19 AudioDevice(QObject* parent = nullptr);
20
21 void setInput(GBAThread* input);
22 void setFormat(const QAudioFormat& format);
23
24protected:
25 virtual qint64 readData(char* data, qint64 maxSize) override;
26 virtual qint64 writeData(const char* data, qint64 maxSize) override;
27
28private:
29 GBAThread* m_context;
30 float m_drift;
31 float m_ratio;
32};
33
34}
35
36#endif