The attached patch:
- turns on blocking i/o, which should make ALSA write the entire contents in a snd_pcm_writei call. - fixes a bug setting the volume, unVolume / 100 == 0 meant that the volume was always set to either 0 or 100%.
Index: audlinux_alsa.cpp
===================================================================
RCS file: /cvsroot/audio/device/platform/unix/audlinux_alsa.cpp,v
retrieving revision 1.4.6.1
diff -u -r1.4.6.1 audlinux_alsa.cpp
--- audlinux_alsa.cpp	9 Mar 2005 18:30:06 -0000	1.4.6.1
+++ audlinux_alsa.cpp	12 Sep 2005 17:53:23 -0000
@@ -173,7 +173,7 @@
 
     if(err == 0)
     {
-        err = snd_pcm_nonblock(m_pAlsaPCMHandle, TRUE);
+        err = snd_pcm_nonblock(m_pAlsaPCMHandle, FALSE);
         if(err < 0)
         {
             HXLOGL1 ( HXLOG_ADEV, "snd_pcm_nonblock: %s",
@@ -1232,7 +1232,7 @@
 
                 if(max_volume > min_volume)
                 {
-                    nRetVolume = (UINT16) (100 * volume / (max_volume - min_volume));
+                    nRetVolume = (UINT16) (100 * ((double) volume / (max_volume - min_volume)));
                 }
             }
         }        
@@ -1269,7 +1269,7 @@
                                                       &max_volume);
 
             range = max_volume - min_volume;
-            volume = (long) ((unVolume / 100) * range + min_volume);
+            volume = (long) (((double) unVolume / 100.0) * range + min_volume);
 
             err = snd_mixer_selem_set_playback_volume( m_pAlsaMixerElem,
                                                        SND_MIXER_SCHN_FRONT_LEFT, 
_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev

Reply via email to