all repos — mgba @ 50402c830729f2ba5a6fc3e6facfd8b258f7f97d

mGBA Game Boy Advance Emulator

src/platform/sdl/sdl-audio.h (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#ifndef SDL_AUDIO_H
 7#define SDL_AUDIO_H
 8
 9#include "util/common.h"
10
11#include <SDL.h>
12
13#include "gba/audio.h"
14
15struct GBASDLAudio {
16	// Input
17	size_t samples;
18	unsigned sampleRate;
19
20	// State
21	SDL_AudioSpec desiredSpec;
22	SDL_AudioSpec obtainedSpec;
23#if RESAMPLE_LIBRARY != RESAMPLE_BLIP_BUF
24	float ratio;
25#endif
26#if RESAMPLE_LIBRARY == RESAMPLE_NN
27	float drift;
28#endif
29#if SDL_VERSION_ATLEAST(2, 0, 0)
30	SDL_AudioDeviceID deviceId;
31#endif
32
33	struct GBAThread* thread;
34	struct GBA* gba;
35};
36
37bool GBASDLInitAudio(struct GBASDLAudio* context, struct GBAThread* threadContext);
38void GBASDLDeinitAudio(struct GBASDLAudio* context);
39void GBASDLPauseAudio(struct GBASDLAudio* context);
40void GBASDLResumeAudio(struct GBASDLAudio* context);
41
42#endif