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
This commit is contained in:
parent
da3564dedd
commit
5324cc6d9c
1 changed files with 44 additions and 31 deletions
|
@ -226,47 +226,60 @@ static int
|
|||
AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||
{
|
||||
// int width;
|
||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||
int valid_datatype = 0;
|
||||
|
||||
D(bug("AHI opening...\n"));
|
||||
|
||||
/* Determine the audio parameters from the AudioSpec */
|
||||
switch (spec->format & 0xFF) {
|
||||
while ((!valid_datatype) && (test_format)) {
|
||||
switch (test_format) {
|
||||
case AUDIO_S8:
|
||||
D(bug("AUDIO_S8...\n"));
|
||||
valid_datatype = 1;
|
||||
spec->format = AUDIO_S8;
|
||||
this->hidden->bytespersample = 1;
|
||||
if (spec->channels < 2)
|
||||
this->hidden->type = AHIST_M8S;
|
||||
else
|
||||
this->hidden->type = AHIST_S8S;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
{ /* Signed 8 bit audio data */
|
||||
D(bug("Samples a 8 bit...\n"));
|
||||
spec->format = AUDIO_S8;
|
||||
this->hidden->bytespersample = 1;
|
||||
if (spec->channels < 2)
|
||||
this->hidden->type = AHIST_M8S;
|
||||
else
|
||||
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 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;
|
||||
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:
|
||||
{
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return (-1);
|
||||
default:
|
||||
test_format = SDL_NextAudioFormat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (spec->channels != 1 && spec->channels != 2) {
|
||||
D(bug("Wrong channel number!\n"));
|
||||
SDL_SetError("Channel number non supported");
|
||||
return -1;
|
||||
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (spec->channels > 2) {
|
||||
spec->channels = 2; /* will convert at higher level. */
|
||||
}
|
||||
|
||||
D(bug("Before CalculateAudioSpec\n"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue