changeset 126:97488948215c

Allow setting audio format settings.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Oct 2012 06:04:43 +0300
parents 5102ec9e9bce
children ab4086db7dad
files dmsimple.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dmsimple.c	Thu Oct 04 05:38:08 2012 +0300
+++ b/dmsimple.c	Thu Oct 04 06:04:43 2012 +0300
@@ -469,10 +469,14 @@
     initSDL = TRUE;
 
     // Initialize audio parts
-    engine.optAfmt.freq     = 44100;
-    engine.optAfmt.format   = AUDIO_S16SYS;
-    engine.optAfmt.channels = 2;
-    engine.optAfmt.samples  = 16*1024;
+    if (engine.optAfmt.freq == 0 && engine.optAfmt.channels == 0)
+    {
+        // Defaults, if none seem to be set
+        engine.optAfmt.freq     = 44100;
+        engine.optAfmt.format   = AUDIO_S16SYS;
+        engine.optAfmt.channels = 2;
+        engine.optAfmt.samples  = 16*1024;
+    }
 
 #ifdef DM_USE_JSS
     jssInit();