Let SDL convert to valid Dreamcast audio formats instead of failing if the
hardware can't be opened in a specific format. Not that you'd want to swallow the overhead on a Dreamcast, but hey, it's the SDL way. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402047
This commit is contained in:
parent
1f63d96bcd
commit
3a09848855
1 changed files with 21 additions and 8 deletions
|
@ -220,18 +220,31 @@ DCAUD_CloseAudio(_THIS)
|
||||||
static int
|
static int
|
||||||
DCAUD_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
DCAUD_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
{
|
{
|
||||||
switch (spec->format & 0xff) {
|
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||||
case 8:
|
int valid_datatype = 0;
|
||||||
spec->format = AUDIO_S8;
|
while ((!valid_datatype) && (test_format)) {
|
||||||
break;
|
spec->format = test_format;
|
||||||
case 16:
|
switch (test_format) {
|
||||||
spec->format = AUDIO_S16LSB;
|
/* only formats Dreamcast accepts... */
|
||||||
break;
|
case AUDIO_S8:
|
||||||
default:
|
case AUDIO_S16LSB:
|
||||||
|
valid_datatype = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
test_format = SDL_NextAudioFormat();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||||
SDL_SetError("Unsupported audio format");
|
SDL_SetError("Unsupported audio format");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (spec->channels > 2)
|
||||||
|
spec->channels = 2; /* no more than stereo on the Dreamcast. */
|
||||||
|
|
||||||
/* Update the fragment size as size in bytes */
|
/* Update the fragment size as size in bytes */
|
||||||
SDL_CalculateAudioSpec(spec);
|
SDL_CalculateAudioSpec(spec);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue