src/platform/qt/AudioProcessor.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_PROCESSOR
7#define QGBA_AUDIO_PROCESSOR
8#include <QObject>
9
10struct GBAThread;
11
12namespace QGBA {
13
14class AudioProcessor : public QObject {
15Q_OBJECT
16
17public:
18 enum class Driver {
19#ifdef BUILD_QT_MULTIMEDIA
20 QT_MULTIMEDIA = 0,
21#endif
22#ifdef BUILD_SDL
23 SDL = 1,
24#endif
25 };
26
27 static AudioProcessor* create();
28 static void setDriver(Driver driver) { s_driver = driver; }
29
30 AudioProcessor(QObject* parent = nullptr);
31
32 virtual void setInput(GBAThread* input);
33 int getBufferSamples() const { return m_samples; }
34
35public slots:
36 virtual void start() = 0;
37 virtual void pause() = 0;
38
39 virtual void setBufferSamples(int samples) = 0;
40 virtual void inputParametersChanged() = 0;
41
42 virtual unsigned sampleRate() const = 0;
43
44protected:
45 GBAThread* input() { return m_context; }
46
47private:
48 GBAThread* m_context;
49 int m_samples;
50 static Driver s_driver;
51};
52
53}
54
55#endif