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