Add more valid configurations to PS2 audio driver
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/src/audio/ps2/SDL_ps2audio.c b/src/audio/ps2/SDL_ps2audio.c
index f3b5788..b050984 100644
--- a/src/audio/ps2/SDL_ps2audio.c
+++ b/src/audio/ps2/SDL_ps2audio.c
@@ -48,15 +48,30 @@ PS2AUDIO_OpenDevice(_THIS, const char *devname)
}
SDL_zerop(this->hidden);
- /* This is the native supported audio PS2 config */
- this->spec.freq = 48000;
+
+ /* 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;
+ break;
+ }
+
this->spec.samples = 512;
- this->spec.channels = 2;
- this->spec.format = AUDIO_S16LSB;
+ this->spec.channels = this->spec.channels == 1 ? 1 : 2;
+ this->spec.format = this->spec.format == AUDIO_S8 ? AUDIO_S8 : AUDIO_S16;
SDL_CalculateAudioSpec(&this->spec);
- format.bits = 16;
+ format.bits = this->spec.format == AUDIO_S8 ? 8 : 16;
format.freq = this->spec.freq;
format.channels = this->spec.channels;