zenilib: zenilib/jni/external/sdl/src/audio/SDL_sysaudio.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_sysaudio.h
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "SDL_config.h"
22
23 #ifndef _SDL_sysaudio_h
24 #define _SDL_sysaudio_h
25
26 #include "SDL_mutex.h"
27 #include "SDL_thread.h"
28
29 /* The SDL audio driver */
30 typedef struct SDL_AudioDevice SDL_AudioDevice;
31 #define _THIS SDL_AudioDevice *_this
32
33 /* Used by audio targets during DetectDevices() */
34 typedef void (*SDL_AddAudioDevice)(const char *name);
35
36 typedef struct SDL_AudioDriverImpl
37 {
38 void (*DetectDevices) (int iscapture, SDL_AddAudioDevice addfn);
39 int (*OpenDevice) (_THIS, const char *devname, int iscapture);
40 void (*ThreadInit) (_THIS); /* Called by audio thread at start */
41 void (*WaitDevice) (_THIS);
42 void (*PlayDevice) (_THIS);
43 Uint8 *(*GetDeviceBuf) (_THIS);
44 void (*WaitDone) (_THIS);
45 void (*CloseDevice) (_THIS);
46 void (*LockDevice) (_THIS);
47 void (*UnlockDevice) (_THIS);
48 void (*Deinitialize) (void);
49
50 /* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */
51
52 /* Some flags to push duplicate code into the core and reduce #ifdefs. */
53 int ProvidesOwnCallbackThread;
54 int SkipMixerLock; /* !!! FIXME: do we need this anymore? */
55 int HasCaptureSupport;
56 int OnlyHasDefaultOutputDevice;
57 int OnlyHasDefaultInputDevice;
58 } SDL_AudioDriverImpl;
59
60
61 typedef struct SDL_AudioDriver
62 {
63 /* * * */
64 /* The name of this audio driver */
65 const char *name;
66
67 /* * * */
68 /* The description of this audio driver */
69 const char *desc;
70
71 SDL_AudioDriverImpl impl;
72
73 char **outputDevices;
74 int outputDeviceCount;
75
76 char **inputDevices;
77 int inputDeviceCount;
78 } SDL_AudioDriver;
79
80
81 /* Streamer */
82 typedef struct
83 {
84 Uint8 *buffer;
85 int max_len; /* the maximum length in bytes */
86 int read_pos, write_pos; /* the position of the write and read heads in bytes */
87 } SDL_AudioStreamer;
88
89
90 /* Define the SDL audio driver structure */
91 struct SDL_AudioDevice
92 {
93 /* * * */
94 /* Data common to all devices */
95
96 /* The current audio specification (shared with audio thread) */
97 SDL_AudioSpec spec;
98
99 /* An audio conversion block for audio format emulation */
100 SDL_AudioCVT convert;
101
102 /* The streamer, if sample rate conversion necessitates it */
103 int use_streamer;
104 SDL_AudioStreamer streamer;
105
106 /* Current state flags */
107 int iscapture;
108 int enabled;
109 int paused;
110 int opened;
111
112 /* Fake audio buffer for when the audio hardware is busy */
113 Uint8 *fake_stream;
114
115 /* A semaphore for locking the mixing buffers */
116 SDL_mutex *mixer_lock;
117
118 /* A thread to feed the audio device */
119 SDL_Thread *thread;
120 SDL_threadID threadid;
121
122 /* * * */
123 /* Data private to this driver */
124 struct SDL_PrivateAudioData *hidden;
125 };
126 #undef _THIS
127
128 typedef struct AudioBootStrap
129 {
130 const char *name;
131 const char *desc;
132 int (*init) (SDL_AudioDriverImpl * impl);
133 int demand_only; /* 1==request explicitly, or it won't be available. */
134 } AudioBootStrap;
135
136 #endif /* _SDL_sysaudio_h */
137
138 /* vi: set ts=4 sw=4 expandtab: */
SDL_AudioDevice::hidden
struct SDL_PrivateAudioData * hidden
Definition: SDL_sysaudio.h:124
SDL_AudioDriverImpl::CloseDevice
void(* CloseDevice)(_THIS)
Definition: SDL_sysaudio.h:45
SDL_AudioDevice::mixer_lock
SDL_mutex * mixer_lock
Definition: SDL_sysaudio.h:116
SDL_AudioStreamer::buffer
Uint8 * buffer
Definition: SDL_sysaudio.h:84
SDL_AudioDriver::name
const char * name
Definition: SDL_sysaudio.h:65
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
SDL_AudioStreamer::max_len
int max_len
Definition: SDL_sysaudio.h:85
SDL_AddAudioDevice
void(* SDL_AddAudioDevice)(const char *name)
Definition: SDL_sysaudio.h:34
SDL_threadID
unsigned long SDL_threadID
Definition: SDL_thread.h:49
SDL_AudioDriverImpl::WaitDevice
void(* WaitDevice)(_THIS)
Definition: SDL_sysaudio.h:41
AudioBootStrap::name
const char * name
Definition: SDL_sysaudio.h:130
SDL_AudioDriverImpl::HasCaptureSupport
int HasCaptureSupport
Definition: SDL_sysaudio.h:55
SDL_AudioDriver::inputDeviceCount
int inputDeviceCount
Definition: SDL_sysaudio.h:77
AudioBootStrap
struct AudioBootStrap AudioBootStrap
SDL_AudioDevice::opened
int opened
Definition: SDL_sysaudio.h:110
SDL_AudioDriverImpl::ProvidesOwnCallbackThread
int ProvidesOwnCallbackThread
Definition: SDL_sysaudio.h:53
SDL_AudioSpec
Definition: SDL_audio.h:165
SDL_AudioDevice::threadid
SDL_threadID threadid
Definition: SDL_sysaudio.h:120
SDL_AudioStreamer::write_pos
int write_pos
Definition: SDL_sysaudio.h:86
SDL_AudioDevice::spec
SDL_AudioSpec spec
Definition: SDL_sysaudio.h:97
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
SDL_AudioDevice::iscapture
int iscapture
Definition: SDL_sysaudio.h:107
SDL_AudioDriverImpl::WaitDone
void(* WaitDone)(_THIS)
Definition: SDL_sysaudio.h:44
SDL_AudioDriverImpl::OpenDevice
int(* OpenDevice)(_THIS, const char *devname, int iscapture)
Definition: SDL_sysaudio.h:39
SDL_PrivateAudioData
Definition: SDL_alsa_audio.h:33
SDL_config.h
SDL_AudioDevice::use_streamer
int use_streamer
Definition: SDL_sysaudio.h:103
SDL_AudioCVT
Definition: SDL_audio.h:197
SDL_AudioDriver
struct SDL_AudioDriver SDL_AudioDriver
SDL_AudioDriverImpl::PlayDevice
void(* PlayDevice)(_THIS)
Definition: SDL_sysaudio.h:42
SDL_AudioDriver::outputDevices
char ** outputDevices
Definition: SDL_sysaudio.h:73
SDL_AudioDriverImpl::DetectDevices
void(* DetectDevices)(int iscapture, SDL_AddAudioDevice addfn)
Definition: SDL_sysaudio.h:38
AudioBootStrap
Definition: SDL_sysaudio.h:128
SDL_AudioDriverImpl::OnlyHasDefaultOutputDevice
int OnlyHasDefaultOutputDevice
Definition: SDL_sysaudio.h:56
int
int
Definition: SDL_systhread.c:37
SDL_AudioDriver::desc
const char * desc
Definition: SDL_sysaudio.h:69
SDL_AudioDriverImpl
struct SDL_AudioDriverImpl SDL_AudioDriverImpl
SDL_AudioDriverImpl
Definition: SDL_sysaudio.h:36
_THIS
#define _THIS
Definition: SDL_sysaudio.h:31
SDL_AudioDriverImpl::SkipMixerLock
int SkipMixerLock
Definition: SDL_sysaudio.h:54
SDL_AudioDriverImpl::Deinitialize
void(* Deinitialize)(void)
Definition: SDL_sysaudio.h:48
SDL_AudioStreamer
Definition: SDL_sysaudio.h:82
SDL_AudioDevice::fake_stream
Uint8 * fake_stream
Definition: SDL_sysaudio.h:113
SDL_AudioDevice::streamer
SDL_AudioStreamer streamer
Definition: SDL_sysaudio.h:104
SDL_mutex
struct SDL_mutex SDL_mutex
Definition: SDL_mutex.h:59
SDL_AudioDriverImpl::ThreadInit
void(* ThreadInit)(_THIS)
Definition: SDL_sysaudio.h:40
SDL_AudioDriverImpl::LockDevice
void(* LockDevice)(_THIS)
Definition: SDL_sysaudio.h:46
SDL_AudioDriver::impl
SDL_AudioDriverImpl impl
Definition: SDL_sysaudio.h:71
SDL_AudioDevice
Definition: SDL_sysaudio.h:91
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
AudioBootStrap::init
int(* init)(SDL_AudioDriverImpl *impl)
Definition: SDL_sysaudio.h:132
SDL_AudioDevice::paused
int paused
Definition: SDL_sysaudio.h:109
SDL_AudioDriver::inputDevices
char ** inputDevices
Definition: SDL_sysaudio.h:76
SDL_AudioDriver::outputDeviceCount
int outputDeviceCount
Definition: SDL_sysaudio.h:74
AudioBootStrap::demand_only
int demand_only
Definition: SDL_sysaudio.h:133
SDL_Thread
Definition: SDL_thread_c.h:48
AudioBootStrap::desc
const char * desc
Definition: SDL_sysaudio.h:131
SDL_AudioDriverImpl::OnlyHasDefaultInputDevice
int OnlyHasDefaultInputDevice
Definition: SDL_sysaudio.h:57
SDL_AudioDevice::thread
SDL_Thread * thread
Definition: SDL_sysaudio.h:119
SDL_AudioDevice::enabled
int enabled
Definition: SDL_sysaudio.h:108
SDL_AudioDevice::convert
SDL_AudioCVT convert
Definition: SDL_sysaudio.h:100
SDL_AudioDriverImpl::UnlockDevice
void(* UnlockDevice)(_THIS)
Definition: SDL_sysaudio.h:47
SDL_AudioDriver
Definition: SDL_sysaudio.h:61