all repos — mgba @ 7149dd3102a6bbb7f73cae7da0c01dc784b0f601

mGBA Game Boy Advance Emulator

src/platform/qt/AudioProcessorSDL.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 "AudioProcessorSDL.h"
 7
 8extern "C" {
 9#include "gba/supervisor/thread.h"
10}
11
12using namespace QGBA;
13
14AudioProcessorSDL::AudioProcessorSDL(QObject* parent)
15	: AudioProcessor(parent)
16	, m_audio()
17{
18}
19
20AudioProcessorSDL::~AudioProcessorSDL() {
21	GBASDLDeinitAudio(&m_audio);
22}
23
24void AudioProcessorSDL::start() {
25	if (m_audio.thread) {
26		GBASDLResumeAudio(&m_audio);
27	} else {
28		if (!m_audio.samples) {
29			m_audio.samples = input()->audioBuffers;
30		}
31		GBASDLInitAudio(&m_audio, input());
32	}
33}
34
35void AudioProcessorSDL::pause() {
36	GBASDLPauseAudio(&m_audio);
37}
38
39void AudioProcessorSDL::setBufferSamples(int samples) {
40	AudioProcessor::setBufferSamples(samples);
41	m_audio.samples = samples;
42	if (m_audio.thread) {
43		GBASDLDeinitAudio(&m_audio);
44		GBASDLInitAudio(&m_audio, input());
45	}
46}
47
48void AudioProcessorSDL::inputParametersChanged() {
49}