Mercurial > sdl-ios-xcode
comparison src/audio/baudio/SDL_beaudio.cc @ 2043:adf732f1f016
Formatting update
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 24 Sep 2006 15:56:55 +0000 |
parents | 02108bfd6550 |
children | 5f6550e5184f b225d9820ee3 |
comparison
equal
deleted
inserted
replaced
2042:3908e1f808e1 | 2043:adf732f1f016 |
---|---|
158 int valid_datatype = 0; | 158 int valid_datatype = 0; |
159 media_raw_audio_format format; | 159 media_raw_audio_format format; |
160 SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format); | 160 SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format); |
161 | 161 |
162 /* Parse the audio format and fill the Be raw audio format */ | 162 /* Parse the audio format and fill the Be raw audio format */ |
163 memset(&format, '\0', sizeof (media_raw_audio_format)); | 163 memset(&format, '\0', sizeof(media_raw_audio_format)); |
164 format.byte_order = B_MEDIA_LITTLE_ENDIAN; | 164 format.byte_order = B_MEDIA_LITTLE_ENDIAN; |
165 format.frame_rate = (float) spec->freq; | 165 format.frame_rate = (float) spec->freq; |
166 format.channel_count = spec->channels; /* !!! FIXME: support > 2? */ | 166 format.channel_count = spec->channels; /* !!! FIXME: support > 2? */ |
167 while ((!valid_datatype) && (test_format)) { | 167 while ((!valid_datatype) && (test_format)) { |
168 valid_datatype = 1; | 168 valid_datatype = 1; |
169 spec->format = test_format; | 169 spec->format = test_format; |
170 switch (test_format) { | 170 switch (test_format) { |
171 case AUDIO_S8: | 171 case AUDIO_S8: |
172 format.format = media_raw_audio_format::B_AUDIO_CHAR; | 172 format.format = media_raw_audio_format::B_AUDIO_CHAR; |
173 break; | 173 break; |
174 | 174 |
175 case AUDIO_U8: | 175 case AUDIO_U8: |
176 format.format = media_raw_audio_format::B_AUDIO_UCHAR; | 176 format.format = media_raw_audio_format::B_AUDIO_UCHAR; |
177 break; | 177 break; |
178 | 178 |
179 case AUDIO_S16LSB: | 179 case AUDIO_S16LSB: |
180 format.format = media_raw_audio_format::B_AUDIO_SHORT; | 180 format.format = media_raw_audio_format::B_AUDIO_SHORT; |
181 break; | 181 break; |
182 | 182 |
183 case AUDIO_S16MSB: | 183 case AUDIO_S16MSB: |
184 format.format = media_raw_audio_format::B_AUDIO_SHORT; | 184 format.format = media_raw_audio_format::B_AUDIO_SHORT; |
185 format.byte_order = B_MEDIA_BIG_ENDIAN; | 185 format.byte_order = B_MEDIA_BIG_ENDIAN; |
186 break; | 186 break; |
187 | 187 |
188 case AUDIO_S32LSB: | 188 case AUDIO_S32LSB: |
189 format.format = media_raw_audio_format::B_AUDIO_INT; | 189 format.format = media_raw_audio_format::B_AUDIO_INT; |
190 break; | 190 break; |
191 | 191 |
192 case AUDIO_S32MSB: | 192 case AUDIO_S32MSB: |
193 format.format = media_raw_audio_format::B_AUDIO_INT; | 193 format.format = media_raw_audio_format::B_AUDIO_INT; |
194 format.byte_order = B_MEDIA_BIG_ENDIAN; | 194 format.byte_order = B_MEDIA_BIG_ENDIAN; |
195 break; | 195 break; |
196 | 196 |
197 case AUDIO_F32LSB: | 197 case AUDIO_F32LSB: |
198 format.format = media_raw_audio_format::B_AUDIO_FLOAT; | 198 format.format = media_raw_audio_format::B_AUDIO_FLOAT; |
199 break; | 199 break; |
200 | 200 |
201 case AUDIO_F32MSB: | 201 case AUDIO_F32MSB: |
202 format.format = media_raw_audio_format::B_AUDIO_FLOAT; | 202 format.format = media_raw_audio_format::B_AUDIO_FLOAT; |
203 format.byte_order = B_MEDIA_BIG_ENDIAN; | 203 format.byte_order = B_MEDIA_BIG_ENDIAN; |
204 break; | 204 break; |
205 | 205 |
206 default: | 206 default: |
207 valid_datatype = 0; | 207 valid_datatype = 0; |
208 test_format = SDL_NextAudioFormat(); | 208 test_format = SDL_NextAudioFormat(); |
209 break; | 209 break; |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 format.buffer_size = spec->samples; | 213 format.buffer_size = spec->samples; |
214 | 214 |
215 if (!valid_datatype) { /* shouldn't happen, but just in case... */ | 215 if (!valid_datatype) { /* shouldn't happen, but just in case... */ |
216 SDL_SetError("Unsupported audio format"); | 216 SDL_SetError("Unsupported audio format"); |
217 return (-1); | 217 return (-1); |
218 } | 218 } |
219 | 219 |
220 /* Initialize the Be Application, if it's not already started */ | 220 /* Initialize the Be Application, if it's not already started */ |