Commit 5324cc6d authored by Ryan C. Gordon's avatar Ryan C. Gordon

Added int32 support to Amiga audio driver and cleaned up some other details

 in driver initialization. May need tweaking: I can't compile the amiga driver
 here.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402043
parent da3564de
...@@ -226,47 +226,60 @@ static int ...@@ -226,47 +226,60 @@ static int
AHI_OpenAudio(_THIS, SDL_AudioSpec * spec) AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
{ {
// int width; // int width;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
int valid_datatype = 0;
D(bug("AHI opening...\n")); D(bug("AHI opening...\n"));
/* Determine the audio parameters from the AudioSpec */ /* Determine the audio parameters from the AudioSpec */
switch (spec->format & 0xFF) { while ((!valid_datatype) && (test_format)) {
switch (test_format) {
case 8: case AUDIO_S8:
{ /* Signed 8 bit audio data */ D(bug("AUDIO_S8...\n"));
D(bug("Samples a 8 bit...\n")); valid_datatype = 1;
spec->format = AUDIO_S8; spec->format = AUDIO_S8;
this->hidden->bytespersample = 1; this->hidden->bytespersample = 1;
if (spec->channels < 2) if (spec->channels < 2)
this->hidden->type = AHIST_M8S; this->hidden->type = AHIST_M8S;
else else
this->hidden->type = AHIST_S8S; this->hidden->type = AHIST_S8S;
break;
case AUDIO_S16MSB:
D(bug("AUDIO_S16MSB...\n"));
valid_datatype = 1;
spec->format = AUDIO_S16MSB;
this->hidden->bytespersample = 2;
if (spec->channels < 2)
this->hidden->type = AHIST_M16S;
else
this->hidden->type = AHIST_S16S;
break;
case AUDIO_S32MSB:
D(bug("AUDIO_S32MSB...\n"));
valid_datatype = 1;
spec->format = AUDIO_S32MSB;
this->hidden->bytespersample = 4;
if (spec->channels < 2)
this->hidden->type = AHIST_M32S;
else
this->hidden->type = AHIST_S32S;
break;
default:
test_format = SDL_NextAudioFormat();
break;
} }
break; }
case 16:
{ /* Signed 16 bit audio data */
D(bug("Samples a 16 bit...\n"));
spec->format = AUDIO_S16MSB;
this->hidden->bytespersample = 2;
if (spec->channels < 2)
this->hidden->type = AHIST_M16S;
else
this->hidden->type = AHIST_S16S;
}
break;
default: 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 != 1 && spec->channels != 2) { if (spec->channels > 2) {
D(bug("Wrong channel number!\n")); spec->channels = 2; /* will convert at higher level. */
SDL_SetError("Channel number non supported");
return -1;
} }
D(bug("Before CalculateAudioSpec\n")); D(bug("Before CalculateAudioSpec\n"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment