all repos — mgba @ 686380b6c4d8acf219a704a8932668b11efc47c2

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
16using namespace QGBA;
17
18#ifndef BUILD_SDL
19AudioProcessor::Driver AudioProcessor::s_driver = AudioProcessor::Driver::QT_MULTIMEDIA;
20#else
21AudioProcessor::Driver AudioProcessor::s_driver = AudioProcessor::Driver::SDL;
22#endif
23
24AudioProcessor* AudioProcessor::create() {
25	switch (s_driver) {
26#ifdef BUILD_SDL
27	case Driver::SDL:
28		return new AudioProcessorSDL();
29#endif
30
31#ifdef BUILD_QT_MULTIMEDIA
32	case Driver::QT_MULTIMEDIA:
33		return new AudioProcessorQt();
34#endif
35
36	default:
37#ifdef BUILD_SDL
38		return new AudioProcessorSDL();
39#else
40		return new AudioProcessorQt();
41#endif
42	}
43}
44
45AudioProcessor::AudioProcessor(QObject* parent)
46	: QObject(parent)
47	, m_context(nullptr)
48	, m_samples(2048)
49{
50}
51
52void AudioProcessor::setInput(mCoreThread* input) {
53	m_context = input;
54}
55
56void AudioProcessor::setBufferSamples(int samples) {
57	m_samples = samples;
58}