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 16 using namespace QGBA; 17 18 #ifndef BUILD_SDL 19 AudioProcessor::Driver AudioProcessor::s_driver = AudioProcessor::Driver::QT_MULTIMEDIA; 20 #else 21 AudioProcessor::Driver AudioProcessor::s_driver = AudioProcessor::Driver::SDL; 22 #endif 23 create()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 AudioProcessor(QObject * parent)45AudioProcessor::AudioProcessor(QObject* parent) 46 : QObject(parent) 47 { 48 } 49 ~AudioProcessor()50AudioProcessor::~AudioProcessor() { 51 stop(); 52 } 53 setInput(std::shared_ptr<CoreController> input)54void AudioProcessor::setInput(std::shared_ptr<CoreController> input) { 55 m_context = input; 56 } 57 stop()58void AudioProcessor::stop() { 59 m_context.reset(); 60 } 61 setBufferSamples(int samples)62void AudioProcessor::setBufferSamples(int samples) { 63 m_samples = samples; 64 } 65