all repos — mgba @ 893fdd383f3f4f59de31ac617bc8a28d3f8059c6

mGBA Game Boy Advance Emulator

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 mCoreThread;
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	int getBufferSamples() const { return m_samples; }
33	virtual unsigned sampleRate() const = 0;
34
35public slots:
36	virtual void setInput(mCoreThread* input);
37
38	virtual bool start() = 0;
39	virtual void pause() = 0;
40
41	virtual void setBufferSamples(int samples) = 0;
42	virtual void inputParametersChanged() = 0;
43
44	virtual void requestSampleRate(unsigned) = 0;
45
46protected:
47	mCoreThread* input() { return m_context; }
48
49private:
50	mCoreThread* m_context = nullptr;
51	int m_samples = 2048;
52	static Driver s_driver;
53};
54
55}
56
57#endif