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 <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/log.h>
14
15#include <SDL.h>
16// Altivec sometimes defines this
17#ifdef vector
18#undef vector
19#endif
20#ifdef bool
21#undef bool
22#define bool _Bool
23#endif
24
25mLOG_DECLARE_CATEGORY(SDL_AUDIO);
26
27struct mSDLAudio {
28 // Input
29 size_t samples;
30 unsigned sampleRate;
31
32 // State
33 SDL_AudioSpec desiredSpec;
34 SDL_AudioSpec obtainedSpec;
35#if SDL_VERSION_ATLEAST(2, 0, 0)
36 SDL_AudioDeviceID deviceId;
37#endif
38
39 struct mCore* core;
40 struct mCoreSync* sync;
41};
42
43struct mCoreThread;
44bool mSDLInitAudio(struct mSDLAudio* context, struct mCoreThread*);
45void mSDLDeinitAudio(struct mSDLAudio* context);
46void mSDLPauseAudio(struct mSDLAudio* context);
47void mSDLResumeAudio(struct mSDLAudio* context);
48
49CXX_GUARD_END
50
51#endif