[AD] wdsndmix.diff

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Yay, a proper diff file this time. :P This also takes into account values of -1 for sound_bits and sound_freq. Again, I can't test it, but it seems to be in proper working order..

- Kitty Cat
--- wdsndmix.c	2004-04-24 17:06:23.000000000 -0700
+++ wdsndmix.c	2004-04-24 17:34:55.000000000 -0700
@@ -387,20 +387,21 @@
       goto Error; 
    }
 
-   if (dscaps.dwFlags & DSCAPS_PRIMARY16BIT)
+   if ((dscaps.dwFlags & DSCAPS_PRIMARY16BIT) &&
+       (_sound_bits >= 16 || _sound_bits < 0))
       _bits = 16;
    else
       _bits = 8;
 
-   if (dscaps.dwFlags & DSCAPS_PRIMARYSTEREO)
+   if ((dscaps.dwFlags & DSCAPS_PRIMARYSTEREO) && _sound_stereo)
       _stereo = 1;
    else
       _stereo = 0;
 
-   if (dscaps.dwMaxSecondarySampleRate > 44000)
-      _freq = 44100;
+   if ((dscaps.dwMaxSecondarySampleRate > _sound_freq) && (_sound_freq >= 0))
+      _freq = _sound_freq;
    else
-      _freq = 22050;
+      _freq = dscaps.dwMaxSecondarySampleRate;
 
    _TRACE("DirectSound caps: %u bits, %s, %uHz\n", _bits, _stereo ? "stereo" : "mono", _freq);
 
@@ -491,7 +492,7 @@
    /* start playing */
    install_int(digi_dsoundmix_mixer_callback, 20);  /* 50 Hz */
    IDirectSoundBuffer_Play(prim_buf, 0, 0, DSBPLAY_LOOPING);
-	
+
    return 0;
 
  Error:
@@ -510,7 +511,7 @@
       digi_directsound_capture_exit();
       return;
    }
-	
+
    /* stop playing */
    remove_int(digi_dsoundmix_mixer_callback);
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/