all repos — mgba @ e9a2b2a57c4f478fb3600fe9d87e1b97804d73de

mGBA Game Boy Advance Emulator

src/platform/qt/AudioProcessorSDL.cpp (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#include "AudioProcessorSDL.h"
 7
 8extern "C" {
 9#include "gba-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}