Mercurial > sdl-ios-xcode
comparison src/audio/mint/SDL_mintaudio_stfa.c @ 704:c4803992e09c
Small bugfixes
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Sat, 30 Aug 2003 20:00:11 +0000 |
parents | 594422ab8f9f |
children | b8d311d90021 |
comparison
equal
deleted
inserted
replaced
703:ca809c1b41ca | 704:c4803992e09c |
---|---|
204 { | 204 { |
205 int i; | 205 int i; |
206 | 206 |
207 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); | 207 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); |
208 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); | 208 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); |
209 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); | 209 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); |
210 DEBUG_PRINT(("channels=%d, ", spec->channels)); | 210 DEBUG_PRINT(("channels=%d, ", spec->channels)); |
211 DEBUG_PRINT(("freq=%d\n", spec->freq)); | 211 DEBUG_PRINT(("freq=%d\n", spec->freq)); |
212 | 212 |
213 /* Check formats available */ | 213 /* Check formats available */ |
214 MINTAUDIO_nfreq=16; | 214 MINTAUDIO_nfreq=16; |
221 MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, 0, spec->freq); | 221 MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, 0, spec->freq); |
222 spec->freq=MINTAUDIO_hardfreq[MINTAUDIO_numfreq]; | 222 spec->freq=MINTAUDIO_hardfreq[MINTAUDIO_numfreq]; |
223 | 223 |
224 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); | 224 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); |
225 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); | 225 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); |
226 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); | 226 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); |
227 DEBUG_PRINT(("channels=%d, ", spec->channels)); | 227 DEBUG_PRINT(("channels=%d, ", spec->channels)); |
228 DEBUG_PRINT(("freq=%d\n", spec->freq)); | 228 DEBUG_PRINT(("freq=%d\n", spec->freq)); |
229 | 229 |
230 return 0; | 230 return 0; |
231 } | 231 } |
252 if (spec->channels==2) { | 252 if (spec->channels==2) { |
253 cookie_stfa->sound_control |= STFA_FORMAT_STEREO; | 253 cookie_stfa->sound_control |= STFA_FORMAT_STEREO; |
254 } else { | 254 } else { |
255 cookie_stfa->sound_control |= STFA_FORMAT_MONO; | 255 cookie_stfa->sound_control |= STFA_FORMAT_MONO; |
256 } | 256 } |
257 if (spec->format & 0x8000) { | 257 if ((spec->format & 0x8000)!=0) { |
258 cookie_stfa->sound_control |= STFA_FORMAT_SIGNED; | 258 cookie_stfa->sound_control |= STFA_FORMAT_SIGNED; |
259 } else { | 259 } else { |
260 cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED; | 260 cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED; |
261 } | 261 } |
262 if (spec->format & 0x1000) { | 262 if ((spec->format & 0x1000)!=0) { |
263 cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN; | |
264 } else { | |
263 cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN; | 265 cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN; |
264 } else { | |
265 cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN; | |
266 } | 266 } |
267 | 267 |
268 /* Set buffer */ | 268 /* Set buffer */ |
269 cookie_stfa->sound_start = (unsigned long) buffer; | 269 cookie_stfa->sound_start = (unsigned long) buffer; |
270 cookie_stfa->sound_end = (unsigned long) (buffer + spec->size); | 270 cookie_stfa->sound_end = (unsigned long) (buffer + spec->size); |
290 } | 290 } |
291 | 291 |
292 SDL_CalculateAudioSpec(spec); | 292 SDL_CalculateAudioSpec(spec); |
293 | 293 |
294 /* Allocate memory for audio buffers in DMA-able RAM */ | 294 /* Allocate memory for audio buffers in DMA-able RAM */ |
295 spec->size = spec->samples; | |
296 spec->size *= spec->channels; | |
297 spec->size *= (spec->format & 0xFF)/8; | |
298 | |
299 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); | 295 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); |
300 | 296 |
301 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); | 297 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); |
302 if (SDL_MintAudio_audiobuf[0]==NULL) { | 298 if (SDL_MintAudio_audiobuf[0]==NULL) { |
303 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); | 299 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); |