all repos — mgba @ 9c5852e89ea26959c7a1872c7cee8d02e11d2317

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};
35
36bool GBASDLInitAudio(struct GBASDLAudio* context, struct GBAThread* threadContext);
37void GBASDLDeinitAudio(struct GBASDLAudio* context);
38void GBASDLPauseAudio(struct GBASDLAudio* context);
39void GBASDLResumeAudio(struct GBASDLAudio* context);
40
41#endif