zenilib  0.5.3.0
 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 */
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 */
43  Uint8 *(*GetDeviceBuf) (_THIS);
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. */
54  int SkipMixerLock; /* !!! FIXME: do we need this anymore? */
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 
72 
73  char **outputDevices;
75 
76  char **inputDevices;
79 
80 
81 /* Streamer */
82 typedef struct
83 {
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 */
88 
89 
90 /* Define the SDL audio driver structure */
92 {
93  /* * * */
94  /* Data common to all devices */
95 
96  /* The current audio specification (shared with audio thread) */
98 
99  /* An audio conversion block for audio format emulation */
101 
102  /* The streamer, if sample rate conversion necessitates it */
105 
106  /* Current state flags */
108  int enabled;
109  int paused;
110  int opened;
111 
112  /* Fake audio buffer for when the audio hardware is busy */
114 
115  /* A semaphore for locking the mixing buffers */
117 
118  /* A thread to feed the audio device */
121 
122  /* * * */
123  /* Data private to this driver */
125 };
126 #undef _THIS
127 
128 typedef struct AudioBootStrap
129 {
130  const char *name;
131  const char *desc;
133  int demand_only; /* 1==request explicitly, or it won't be available. */
135 
136 #endif /* _SDL_sysaudio_h */
137 
138 /* vi: set ts=4 sw=4 expandtab: */
struct SDL_PrivateAudioData * hidden
Definition: SDL_sysaudio.h:124
void(* CloseDevice)(_THIS)
Definition: SDL_sysaudio.h:45
SDL_mutex * mixer_lock
Definition: SDL_sysaudio.h:116
const char * name
Definition: SDL_sysaudio.h:65
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
void(* SDL_AddAudioDevice)(const char *name)
Definition: SDL_sysaudio.h:34
unsigned long SDL_threadID
Definition: SDL_thread.h:49
void(* WaitDevice)(_THIS)
Definition: SDL_sysaudio.h:41
const char * name
Definition: SDL_sysaudio.h:130
struct AudioBootStrap AudioBootStrap
SDL_threadID threadid
Definition: SDL_sysaudio.h:120
SDL_AudioSpec spec
Definition: SDL_sysaudio.h:97
EGLImageKHR EGLint * name
Definition: eglext.h:284
void(* WaitDone)(_THIS)
Definition: SDL_sysaudio.h:44
int(* OpenDevice)(_THIS, const char *devname, int iscapture)
Definition: SDL_sysaudio.h:39
struct SDL_AudioDriver SDL_AudioDriver
void(* PlayDevice)(_THIS)
Definition: SDL_sysaudio.h:42
char ** outputDevices
Definition: SDL_sysaudio.h:73
void(* DetectDevices)(int iscapture, SDL_AddAudioDevice addfn)
Definition: SDL_sysaudio.h:38
int
Definition: SDL_systhread.c:37
const char * desc
Definition: SDL_sysaudio.h:69
struct SDL_AudioDriverImpl SDL_AudioDriverImpl
#define _THIS
Definition: SDL_sysaudio.h:31
void(* Deinitialize)(void)
Definition: SDL_sysaudio.h:48
Uint8 * fake_stream
Definition: SDL_sysaudio.h:113
SDL_AudioStreamer streamer
Definition: SDL_sysaudio.h:104
struct SDL_mutex SDL_mutex
Definition: SDL_mutex.h:59
void(* ThreadInit)(_THIS)
Definition: SDL_sysaudio.h:40
void(* LockDevice)(_THIS)
Definition: SDL_sysaudio.h:46
SDL_AudioDriverImpl impl
Definition: SDL_sysaudio.h:71
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
int(* init)(SDL_AudioDriverImpl *impl)
Definition: SDL_sysaudio.h:132
char ** inputDevices
Definition: SDL_sysaudio.h:76
const char * desc
Definition: SDL_sysaudio.h:131
SDL_Thread * thread
Definition: SDL_sysaudio.h:119
SDL_AudioCVT convert
Definition: SDL_sysaudio.h:100
void(* UnlockDevice)(_THIS)
Definition: SDL_sysaudio.h:47