Add more valid configurations to PS2 audio driver

This commit is contained in:
Francisco Javier Trujillo Mata 2022-08-26 16:58:21 +02:00 committed by Sam Lantinga
parent d7fae33967
commit b9e3cae572
1 changed files with 20 additions and 5 deletions

View File

@ -48,15 +48,30 @@ PS2AUDIO_OpenDevice(_THIS, const char *devname)
} }
SDL_zerop(this->hidden); SDL_zerop(this->hidden);
/* This is the native supported audio PS2 config */
/* These are the native supported audio PS2 configs */
switch (this->spec.freq) {
case 11025:
case 12000:
case 22050:
case 24000:
case 32000:
case 44100:
case 48000:
this->spec.freq = this->spec.freq;
break;
default:
this->spec.freq = 48000; this->spec.freq = 48000;
break;
}
this->spec.samples = 512; this->spec.samples = 512;
this->spec.channels = 2; this->spec.channels = this->spec.channels == 1 ? 1 : 2;
this->spec.format = AUDIO_S16LSB; this->spec.format = this->spec.format == AUDIO_S8 ? AUDIO_S8 : AUDIO_S16;
SDL_CalculateAudioSpec(&this->spec); SDL_CalculateAudioSpec(&this->spec);
format.bits = 16; format.bits = this->spec.format == AUDIO_S8 ? 8 : 16;
format.freq = this->spec.freq; format.freq = this->spec.freq;
format.channels = this->spec.channels; format.channels = this->spec.channels;