ALSA: snd-aloop - fix "PCM Slave Active" element read value
[linux-3.10.git] / sound / drivers / aloop.c
index f2b8f868d97ae39767fa1be8747f13af83992ea4..040030aa9d8ea418e1ea245f7153f5ce3732c720 100644 (file)
@@ -347,7 +347,7 @@ static void copy_play_buf(struct loopback_pcm *play,
                          unsigned int bytes)
 {
        struct snd_pcm_runtime *runtime = play->substream->runtime;
-       char *src = play->substream->runtime->dma_area;
+       char *src = runtime->dma_area;
        char *dst = capt->substream->runtime->dma_area;
        unsigned int src_off = play->buf_pos;
        unsigned int dst_off = capt->buf_pos;
@@ -385,8 +385,10 @@ static void copy_play_buf(struct loopback_pcm *play,
                dst_off = (dst_off + size) % capt->pcm_buffer_size;
        }
 
-       if (clear_bytes > 0)
+       if (clear_bytes > 0) {
                clear_capture_buf(capt, clear_bytes);
+               capt->silent_size = 0;
+       }
 }
 
 #define BYTEPOS_UPDATE_POSONLY 0
@@ -737,7 +739,7 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol,
 {
        struct loopback *loopback = snd_kcontrol_chip(kcontrol);
        struct loopback_cable *cable = loopback->cables
-                               [kcontrol->id.subdevice][kcontrol->id.device];
+                       [kcontrol->id.subdevice][kcontrol->id.device ^ 1];
        unsigned int val = 0;
 
        if (cable != NULL)