[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    arts/flow
From:       Allan Sandfeld Jensen <kde () carewolf ! com>
Date:       2004-03-31 22:06:05
Message-ID: 20040331220605.BD14190E1 () office ! kde ! org
[Download RAW message or body]

CVS commit by carewolf: 

Another little work-around, because bytes_to_frames and frames_to_bytes
are not 100% resersable for some configuration with dmix.


  M +14 -5     audioioalsa9.cc   1.8


--- arts/flow/audioioalsa9.cc  #1.7:1.8
@@ -258,8 +258,6 @@ void AudioIOALSA::setParam(AudioParam p,
 int AudioIOALSA::getParam(AudioParam p)
 {
-        snd_pcm_status_t *status;
-        snd_pcm_status_alloca(&status);
-
         switch(p) {
+                /*
         case canRead:
                 if (! m_pcm_capture) return -1;
@@ -277,5 +275,12 @@ int AudioIOALSA::getParam(AudioParam p)
                 }
                 return snd_pcm_frames_to_bytes(m_pcm_playback, snd_pcm_status_get_avail(status));
+*/
+        case canRead:
+                if (! m_pcm_capture) return -1;
+                return snd_pcm_frames_to_bytes(m_pcm_capture, snd_pcm_avail_update(m_pcm_capture));
 
+        case canWrite:
+                if (! m_pcm_playback) return -1;
+                return snd_pcm_frames_to_bytes(m_pcm_playback, snd_pcm_avail_update(m_pcm_playback));
 
         case selectReadFD:
@@ -403,5 +408,5 @@ int AudioIOALSA::write(void *buffer, int
         // DMix has an annoying habit of returning instantantly on the returned
         // poll-descriptor. So we block here to avoid an infinity loop.
-        while(snd_pcm_wait(m_pcm_playback, 1) == 0);
+        snd_pcm_wait(m_pcm_playback, 1);
 
         int frames = snd_pcm_bytes_to_frames(m_pcm_playback, size);
@@ -419,4 +424,8 @@ int AudioIOALSA::write(void *buffer, int
                 }
         }
+
+        if (length == frames) // Yet another DMix work-around
+                return size;
+        else
         return snd_pcm_frames_to_bytes(m_pcm_playback, length);
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic