]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Do hwsync of slave PCM on dmix
authorTakashi Iwai <tiwai@suse.de>
Tue, 29 Mar 2005 14:10:16 +0000 (14:10 +0000)
committerTakashi Iwai <tiwai@suse.de>
Tue, 29 Mar 2005 14:10:16 +0000 (14:10 +0000)
Call hwsync of slave PCM on snd_pcm_hwsync() over dmix.
This reduces ocasional output noises, typically seen in xmms and bmp with
multi-threading on SMP/HT systems.

Disabled slowptr of default dmix definition again.

src/conf/pcm/dmix.conf
src/pcm/pcm_dmix.c

index 5546ff394ad0b6ea3a0c909824a28cec948c4c47..addcaf7c5dbdff7d5a774ec66389d11e167e2d4d 100644 (file)
@@ -27,7 +27,6 @@ pcm.!dmix {
        type dmix
        ipc_key 5678293
        ipc_key_add_uid yes
-       slowptr yes
        slave {
                pcm {
                        type hw
index efdfeaa42e88aeacad5e9cc29ffd567b969fea34..06e82159e9fba8f3b60d58dddb41694f74e878c7 100644 (file)
@@ -243,7 +243,7 @@ static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t size)
 /*
  *  synchronize hardware pointer (hw_ptr) with ours
  */
-static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
+static int _snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm, int do_slave_sync)
 {
        snd_pcm_direct_t *dmix = pcm->private_data;
        snd_pcm_uframes_t slave_hw_ptr, old_slave_hw_ptr, avail;
@@ -256,7 +256,7 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
        default:
                break;
        }
-       if (dmix->slowptr)
+       if (do_slave_sync)
                snd_pcm_hwsync(dmix->spcm);
        old_slave_hw_ptr = dmix->slave_hw_ptr;
        slave_hw_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
@@ -285,6 +285,12 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
        return 0;
 }
 
+static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
+{
+       snd_pcm_direct_t *dmix = pcm->private_data;
+       return _snd_pcm_dmix_sync_ptr(pcm, dmix->slowptr);
+}
+
 /*
  *  plugin implementation
  */
@@ -369,7 +375,8 @@ static int snd_pcm_dmix_hwsync(snd_pcm_t *pcm)
        switch(dmix->state) {
        case SNDRV_PCM_STATE_DRAINING:
        case SNDRV_PCM_STATE_RUNNING:
-               return snd_pcm_dmix_sync_ptr(pcm);
+               /* sync slave PCM */
+               return _snd_pcm_dmix_sync_ptr(pcm, 1);
        case SNDRV_PCM_STATE_PREPARED:
        case SNDRV_PCM_STATE_SUSPENDED:
        case STATE_RUN_PENDING: