all repos — mgba @ e17e4fd19003209ff9db1f0ac1394e463c7b4a47

mGBA Game Boy Advance Emulator

src/platform/qt/AudioProcessor.cpp (view raw)

 1/* Copyright (c) 2013-2015 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#include "AudioProcessor.h"
 7
 8#ifdef BUILD_SDL
 9#include "AudioProcessorSDL.h"
10#endif
11
12#ifdef BUILD_QT_MULTIMEDIA
13#include "AudioProcessorQt.h"
14#endif
15
16extern "C" {
17#include "gba/supervisor/thread.h"
18}
19
20using namespace QGBA;
21
22#ifndef BUILD_SDL
23AudioProcessor::Driver AudioProcessor::s_driver = AudioProcessor::Driver::QT_MULTIMEDIA;
24#else
25AudioProcessor::Driver AudioProcessor::s_driver = AudioProcessor::Driver::SDL;
26#endif
27
28AudioProcessor* AudioProcessor::create() {
29	switch (s_driver) {
30#ifdef BUILD_SDL
31	case Driver::SDL:
32		return new AudioProcessorSDL();
33#endif
34
35#ifdef BUILD_QT_MULTIMEDIA
36	case Driver::QT_MULTIMEDIA:
37		return new AudioProcessorQt();
38#endif
39
40	default:
41#ifdef BUILD_SDL
42		return new AudioProcessorSDL();
43#else
44		return new AudioProcessorQt();
45#endif
46	}
47}
48
49AudioProcessor::AudioProcessor(QObject* parent)
50	: QObject(parent)
51	, m_context(nullptr)
52	, m_samples(GBA_AUDIO_SAMPLES)
53{
54}
55
56void AudioProcessor::setInput(GBAThread* input) {
57	m_context = input;
58}
59
60void AudioProcessor::setBufferSamples(int samples) {
61	m_samples = samples;
62}