all repos — mgba @ d0771b78e22e89b5523badee256ec6e15467dc54

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