Mercurial > sdl-ios-xcode
annotate touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/include/SDL_audio.h @ 4677:31607094315c
Added Iphone project. Iphone multi-touch is now functional.
author | jimtla |
---|---|
date | Sat, 31 Jul 2010 01:24:50 +0400 |
parents | |
children |
rev | line source |
---|---|
4677
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
1 /* |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
3 Copyright (C) 1997-2010 Sam Lantinga |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
4 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
9 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
14 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
18 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
19 Sam Lantinga |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
20 slouken@libsdl.org |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
21 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
22 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
23 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
24 * \file SDL_audio.h |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
25 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
26 * Access to the raw audio mixing buffer for the SDL library. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
27 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
28 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
29 #ifndef _SDL_audio_h |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
30 #define _SDL_audio_h |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
31 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
32 #include "SDL_stdinc.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
33 #include "SDL_error.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
34 #include "SDL_endian.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
35 #include "SDL_mutex.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
36 #include "SDL_thread.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
37 #include "SDL_rwops.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
38 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
39 #include "begin_code.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
40 /* Set up for C function definitions, even when using C++ */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
41 #ifdef __cplusplus |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
42 /* *INDENT-OFF* */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
43 extern "C" { |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
44 /* *INDENT-ON* */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
45 #endif |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
46 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
47 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
48 * \brief Audio format flags. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
49 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
50 * These are what the 16 bits in SDL_AudioFormat currently mean... |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
51 * (Unspecified bits are always zero). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
52 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
53 * \verbatim |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
54 ++-----------------------sample is signed if set |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
55 || |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
56 || ++-----------sample is bigendian if set |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
57 || || |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
58 || || ++---sample is float if set |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
59 || || || |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
60 || || || +---sample bit size---+ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
61 || || || | | |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
62 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
63 \endverbatim |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
64 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
65 * There are macros in SDL 1.3 and later to query these bits. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
66 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
67 typedef Uint16 SDL_AudioFormat; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
68 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
69 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
70 * \name Audio flags |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
71 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
72 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
73 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
74 #define SDL_AUDIO_MASK_BITSIZE (0xFF) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
75 #define SDL_AUDIO_MASK_DATATYPE (1<<8) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
76 #define SDL_AUDIO_MASK_ENDIAN (1<<12) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
77 #define SDL_AUDIO_MASK_SIGNED (1<<15) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
78 #define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
79 #define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
80 #define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
81 #define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
82 #define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
83 #define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
84 #define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
85 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
86 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
87 * \name Audio format flags |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
88 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
89 * Defaults to LSB byte order. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
90 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
91 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
92 #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
93 #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
94 #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
95 #define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
96 #define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
97 #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
98 #define AUDIO_U16 AUDIO_U16LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
99 #define AUDIO_S16 AUDIO_S16LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
100 /*@}*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
101 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
102 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
103 * \name int32 support |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
104 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
105 * New to SDL 1.3. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
106 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
107 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
108 #define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
109 #define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
110 #define AUDIO_S32 AUDIO_S32LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
111 /*@}*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
112 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
113 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
114 * \name float32 support |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
115 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
116 * New to SDL 1.3. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
117 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
118 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
119 #define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
120 #define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
121 #define AUDIO_F32 AUDIO_F32LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
122 /*@}*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
123 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
124 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
125 * \name Native audio byte ordering |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
126 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
127 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
128 #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
129 #define AUDIO_U16SYS AUDIO_U16LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
130 #define AUDIO_S16SYS AUDIO_S16LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
131 #define AUDIO_S32SYS AUDIO_S32LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
132 #define AUDIO_F32SYS AUDIO_F32LSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
133 #else |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
134 #define AUDIO_U16SYS AUDIO_U16MSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
135 #define AUDIO_S16SYS AUDIO_S16MSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
136 #define AUDIO_S32SYS AUDIO_S32MSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
137 #define AUDIO_F32SYS AUDIO_F32MSB |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
138 #endif |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
139 /*@}*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
140 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
141 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
142 * \name Allow change flags |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
143 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
144 * Which audio format changes are allowed when opening a device. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
145 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
146 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
147 #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
148 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
149 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
150 #define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
151 /*@}*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
152 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
153 /*@}*//*Audio flags*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
154 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
155 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
156 * This function is called when the audio device needs more data. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
157 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
158 * \param userdata An application-specific parameter saved in |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
159 * the SDL_AudioSpec structure |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
160 * \param stream A pointer to the audio data buffer. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
161 * \param len The length of that buffer in bytes. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
162 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
163 * Once the callback returns, the buffer will no longer be valid. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
164 * Stereo samples are stored in a LRLRLR ordering. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
165 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
166 typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
167 int len); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
168 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
169 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
170 * The calculated values in this structure are calculated by SDL_OpenAudio(). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
171 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
172 typedef struct SDL_AudioSpec |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
173 { |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
174 int freq; /**< DSP frequency -- samples per second */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
175 SDL_AudioFormat format; /**< Audio data format */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
176 Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
177 Uint8 silence; /**< Audio buffer silence value (calculated) */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
178 Uint16 samples; /**< Audio buffer size in samples (power of 2) */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
179 Uint16 padding; /**< Necessary for some compile environments */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
180 Uint32 size; /**< Audio buffer size in bytes (calculated) */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
181 SDL_AudioCallback callback; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
182 void *userdata; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
183 } SDL_AudioSpec; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
184 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
185 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
186 struct SDL_AudioCVT; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
187 typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
188 SDL_AudioFormat format); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
189 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
190 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
191 * A structure to hold a set of audio conversion filters and buffers. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
192 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
193 typedef struct SDL_AudioCVT |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
194 { |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
195 int needed; /**< Set to 1 if conversion possible */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
196 SDL_AudioFormat src_format; /**< Source audio format */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
197 SDL_AudioFormat dst_format; /**< Target audio format */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
198 double rate_incr; /**< Rate conversion increment */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
199 Uint8 *buf; /**< Buffer to hold entire audio data */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
200 int len; /**< Length of original audio buffer */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
201 int len_cvt; /**< Length of converted audio buffer */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
202 int len_mult; /**< buffer must be len*len_mult big */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
203 double len_ratio; /**< Given len, final size is len*len_ratio */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
204 SDL_AudioFilter filters[10]; /**< Filter list */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
205 int filter_index; /**< Current audio conversion function */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
206 } SDL_AudioCVT; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
207 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
208 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
209 /* Function prototypes */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
210 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
211 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
212 * \name Driver discovery functions |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
213 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
214 * These functions return the list of built in audio drivers, in the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
215 * order that they are normally initialized by default. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
216 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
217 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
218 extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
219 extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
220 /*@}*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
221 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
222 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
223 * \name Initialization and cleanup |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
224 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
225 * \internal These functions are used internally, and should not be used unless |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
226 * you have a specific need to specify the audio driver you want to |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
227 * use. You should normally use SDL_Init() or SDL_InitSubSystem(). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
228 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
229 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
230 extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
231 extern DECLSPEC void SDLCALL SDL_AudioQuit(void); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
232 /*@}*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
233 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
234 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
235 * This function returns the name of the current audio driver, or NULL |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
236 * if no driver has been initialized. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
237 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
238 extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
239 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
240 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
241 * This function opens the audio device with the desired parameters, and |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
242 * returns 0 if successful, placing the actual hardware parameters in the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
243 * structure pointed to by \c obtained. If \c obtained is NULL, the audio |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
244 * data passed to the callback function will be guaranteed to be in the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
245 * requested format, and will be automatically converted to the hardware |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
246 * audio format if necessary. This function returns -1 if it failed |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
247 * to open the audio device, or couldn't set up the audio thread. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
248 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
249 * When filling in the desired audio spec structure, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
250 * - \c desired->freq should be the desired audio frequency in samples-per- |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
251 * second. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
252 * - \c desired->format should be the desired audio format. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
253 * - \c desired->samples is the desired size of the audio buffer, in |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
254 * samples. This number should be a power of two, and may be adjusted by |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
255 * the audio driver to a value more suitable for the hardware. Good values |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
256 * seem to range between 512 and 8096 inclusive, depending on the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
257 * application and CPU speed. Smaller values yield faster response time, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
258 * but can lead to underflow if the application is doing heavy processing |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
259 * and cannot fill the audio buffer in time. A stereo sample consists of |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
260 * both right and left channels in LR ordering. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
261 * Note that the number of samples is directly related to time by the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
262 * following formula: \code ms = (samples*1000)/freq \endcode |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
263 * - \c desired->size is the size in bytes of the audio buffer, and is |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
264 * calculated by SDL_OpenAudio(). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
265 * - \c desired->silence is the value used to set the buffer to silence, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
266 * and is calculated by SDL_OpenAudio(). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
267 * - \c desired->callback should be set to a function that will be called |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
268 * when the audio device is ready for more data. It is passed a pointer |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
269 * to the audio buffer, and the length in bytes of the audio buffer. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
270 * This function usually runs in a separate thread, and so you should |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
271 * protect data structures that it accesses by calling SDL_LockAudio() |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
272 * and SDL_UnlockAudio() in your code. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
273 * - \c desired->userdata is passed as the first parameter to your callback |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
274 * function. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
275 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
276 * The audio device starts out playing silence when it's opened, and should |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
277 * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
278 * for your audio callback function to be called. Since the audio driver |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
279 * may modify the requested size of the audio buffer, you should allocate |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
280 * any local mixing buffers after you open the audio device. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
281 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
282 extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
283 SDL_AudioSpec * obtained); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
284 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
285 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
286 * SDL Audio Device IDs. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
287 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
288 * A successful call to SDL_OpenAudio() is always device id 1, and legacy |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
289 * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
290 * always returns devices >= 2 on success. The legacy calls are good both |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
291 * for backwards compatibility and when you don't care about multiple, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
292 * specific, or capture devices. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
293 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
294 typedef Uint32 SDL_AudioDeviceID; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
295 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
296 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
297 * Get the number of available devices exposed by the current driver. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
298 * Only valid after a successfully initializing the audio subsystem. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
299 * Returns -1 if an explicit list of devices can't be determined; this is |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
300 * not an error. For example, if SDL is set up to talk to a remote audio |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
301 * server, it can't list every one available on the Internet, but it will |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
302 * still allow a specific host to be specified to SDL_OpenAudioDevice(). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
303 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
304 * In many common cases, when this function returns a value <= 0, it can still |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
305 * successfully open the default device (NULL for first argument of |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
306 * SDL_OpenAudioDevice()). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
307 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
308 extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
309 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
310 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
311 * Get the human-readable name of a specific audio device. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
312 * Must be a value between 0 and (number of audio devices-1). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
313 * Only valid after a successfully initializing the audio subsystem. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
314 * The values returned by this function reflect the latest call to |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
315 * SDL_GetNumAudioDevices(); recall that function to redetect available |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
316 * hardware. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
317 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
318 * The string returned by this function is UTF-8 encoded, read-only, and |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
319 * managed internally. You are not to free it. If you need to keep the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
320 * string for any length of time, you should make your own copy of it, as it |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
321 * will be invalid next time any of several other SDL functions is called. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
322 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
323 extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
324 int iscapture); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
325 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
326 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
327 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
328 * Open a specific audio device. Passing in a device name of NULL requests |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
329 * the most reasonable default (and is equivalent to calling SDL_OpenAudio()). |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
330 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
331 * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
332 * some drivers allow arbitrary and driver-specific strings, such as a |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
333 * hostname/IP address for a remote audio server, or a filename in the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
334 * diskaudio driver. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
335 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
336 * \return 0 on error, a valid device ID that is >= 2 on success. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
337 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
338 * SDL_OpenAudio(), unlike this function, always acts on device ID 1. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
339 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
340 extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
341 *device, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
342 int iscapture, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
343 const |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
344 SDL_AudioSpec * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
345 desired, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
346 SDL_AudioSpec * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
347 obtained, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
348 int |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
349 allowed_changes); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
350 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
351 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
352 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
353 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
354 * \name Audio state |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
355 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
356 * Get the current audio state. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
357 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
358 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
359 typedef enum |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
360 { |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
361 SDL_AUDIO_STOPPED = 0, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
362 SDL_AUDIO_PLAYING, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
363 SDL_AUDIO_PAUSED |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
364 } SDL_AudioStatus; |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
365 extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
366 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
367 extern DECLSPEC SDL_AudioStatus SDLCALL |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
368 SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
369 /*@}*//*Audio State*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
370 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
371 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
372 * \name Pause audio functions |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
373 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
374 * These functions pause and unpause the audio callback processing. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
375 * They should be called with a parameter of 0 after opening the audio |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
376 * device to start playing sound. This is so you can safely initialize |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
377 * data for your callback function after opening the audio device. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
378 * Silence will be written to the audio device during the pause. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
379 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
380 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
381 extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
382 extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
383 int pause_on); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
384 /*@}*//*Pause audio functions*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
385 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
386 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
387 * This function loads a WAVE from the data source, automatically freeing |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
388 * that source if \c freesrc is non-zero. For example, to load a WAVE file, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
389 * you could do: |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
390 * \code |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
391 * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
392 * \endcode |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
393 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
394 * If this function succeeds, it returns the given SDL_AudioSpec, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
395 * filled with the audio data format of the wave data, and sets |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
396 * \c *audio_buf to a malloc()'d buffer containing the audio data, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
397 * and sets \c *audio_len to the length of that audio buffer, in bytes. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
398 * You need to free the audio buffer with SDL_FreeWAV() when you are |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
399 * done with it. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
400 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
401 * This function returns NULL and sets the SDL error message if the |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
402 * wave file cannot be opened, uses an unknown data format, or is |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
403 * corrupt. Currently raw and MS-ADPCM WAVE files are supported. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
404 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
405 extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
406 int freesrc, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
407 SDL_AudioSpec * spec, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
408 Uint8 ** audio_buf, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
409 Uint32 * audio_len); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
410 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
411 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
412 * Loads a WAV from a file. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
413 * Compatibility convenience function. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
414 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
415 #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
416 SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
417 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
418 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
419 * This function frees data previously allocated with SDL_LoadWAV_RW() |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
420 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
421 extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
422 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
423 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
424 * This function takes a source format and rate and a destination format |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
425 * and rate, and initializes the \c cvt structure with information needed |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
426 * by SDL_ConvertAudio() to convert a buffer of audio data from one format |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
427 * to the other. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
428 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
429 * \return -1 if the format conversion is not supported, 0 if there's |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
430 * no conversion needed, or 1 if the audio filter is set up. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
431 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
432 extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
433 SDL_AudioFormat src_format, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
434 Uint8 src_channels, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
435 int src_rate, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
436 SDL_AudioFormat dst_format, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
437 Uint8 dst_channels, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
438 int dst_rate); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
439 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
440 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
441 * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(), |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
442 * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
443 * audio data in the source format, this function will convert it in-place |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
444 * to the desired format. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
445 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
446 * The data conversion may expand the size of the audio data, so the buffer |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
447 * \c cvt->buf should be allocated after the \c cvt structure is initialized by |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
448 * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
449 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
450 extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
451 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
452 #define SDL_MIX_MAXVOLUME 128 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
453 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
454 * This takes two audio buffers of the playing audio format and mixes |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
455 * them, performing addition, volume adjustment, and overflow clipping. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
456 * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
457 * for full audio volume. Note this does not change hardware volume. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
458 * This is provided for convenience -- you can mix your own audio data. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
459 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
460 extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
461 Uint32 len, int volume); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
462 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
463 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
464 * This works like SDL_MixAudio(), but you specify the audio format instead of |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
465 * using the format of audio device 1. Thus it can be used when no audio |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
466 * device is open at all. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
467 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
468 extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
469 const Uint8 * src, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
470 SDL_AudioFormat format, |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
471 Uint32 len, int volume); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
472 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
473 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
474 * \name Audio lock functions |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
475 * |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
476 * The lock manipulated by these functions protects the callback function. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
477 * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
478 * the callback function is not running. Do not call these from the callback |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
479 * function or you will cause deadlock. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
480 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
481 /*@{*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
482 extern DECLSPEC void SDLCALL SDL_LockAudio(void); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
483 extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
484 extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
485 extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
486 /*@}*//*Audio lock functions*/ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
487 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
488 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
489 * This function shuts down audio processing and closes the audio device. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
490 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
491 extern DECLSPEC void SDLCALL SDL_CloseAudio(void); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
492 extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
493 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
494 /** |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
495 * \return 1 if audio device is still functioning, zero if not, -1 on error. |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
496 */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
497 extern DECLSPEC int SDLCALL SDL_AudioDeviceConnected(SDL_AudioDeviceID dev); |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
498 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
499 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
500 /* Ends C function definitions when using C++ */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
501 #ifdef __cplusplus |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
502 /* *INDENT-OFF* */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
503 } |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
504 /* *INDENT-ON* */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
505 #endif |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
506 #include "close_code.h" |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
507 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
508 #endif /* _SDL_audio_h */ |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
509 |
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff
changeset
|
510 /* vi: set ts=4 sw=4 expandtab: */ |