int32 support for windib and windx5 audio backends.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 01 Sep 2006 07:50:36 +0000
changeset 2008 4ad1e863d100
parent 2007 cff63f857ff3
child 2009 f2058fb367e4
int32 support for windib and windx5 audio backends.
src/audio/windib/SDL_dibaudio.c
src/audio/windx5/SDL_dx5audio.c
--- a/src/audio/windib/SDL_dibaudio.c	Fri Sep 01 06:55:41 2006 +0000
+++ b/src/audio/windib/SDL_dibaudio.c	Fri Sep 01 07:50:36 2006 +0000
@@ -248,7 +248,7 @@
     waveformat.wFormatTag = WAVE_FORMAT_PCM;
 
     /* Determine the audio parameters from the AudioSpec */
-    switch (spec->format & 0xFF) {
+    switch (SDL_AUDIO_BITSIZE(spec->format)) {
     case 8:
         /* Unsigned 8 bit audio data */
         spec->format = AUDIO_U8;
@@ -259,6 +259,11 @@
         spec->format = AUDIO_S16;
         waveformat.wBitsPerSample = 16;
         break;
+    case 16:
+        /* Signed 32 bit audio data */
+        spec->format = AUDIO_S32;
+        waveformat.wBitsPerSample = 32;
+        break;
     default:
         SDL_SetError("Unsupported audio format");
         return (-1);
--- a/src/audio/windx5/SDL_dx5audio.c	Fri Sep 01 06:55:41 2006 +0000
+++ b/src/audio/windx5/SDL_dx5audio.c	Fri Sep 01 07:50:36 2006 +0000
@@ -658,7 +658,7 @@
     waveformat.wFormatTag = WAVE_FORMAT_PCM;
 
     /* Determine the audio parameters from the AudioSpec */
-    switch (spec->format & 0xFF) {
+    switch (SDL_AUDIO_BITSIZE(spec->format)) {
     case 8:
         /* Unsigned 8 bit audio data */
         spec->format = AUDIO_U8;
@@ -671,6 +671,12 @@
         silence = 0x00;
         waveformat.wBitsPerSample = 16;
         break;
+    case 32:
+        /* Signed 32 bit audio data */
+        spec->format = AUDIO_S32;
+        silence = 0x00;
+        waveformat.wBitsPerSample = 32;
+        break;
     default:
         SDL_SetError("Unsupported audio format");
         return (-1);