tatic int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, bool b) {
    snd_mixer_elem_t *me;
    snd_mixer_selem_id_t *sid;
    int r;

    pa_assert(m);
    pa_assert(e);

    SELEM_INIT(sid, e->alsa_name);
    if (!(me = snd_mixer_find_selem(m, sid))) {
pa_log_warn("Element %s seems to have disappeared.", e->alsa_name);
        return -1;
    }

    if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
        r = snd_mixer_selem_set_playback_switch_all(me, b);
    else
        r = snd_mixer_selem_set_capture_switch_all(me, b);

    if (r < 0)
pa_log_warn("Failed to set switch of %s: %s", e->alsa_name, pa_alsa_strerror(errno));
+   else
+ pa_log_dbg("element_set_switch %s dir=%d index=%d ", e->alsa_name, e->direction, b);
    return r;
}

( 0.094| 0.000) D: [lt-pulseaudio] alsa-mixer.c: Setting analog-input-microphone (analog-input-microphone) priority=0 ( 0.094| 0.000) D: [lt-pulseaudio] alsa-mixer.c: element_set_switch(): e->alsa_name Line ( 0.094| 0.000) D: [lt-pulseaudio] alsa-mixer.c: element_set_switch(): e->direction == PA_ALSA_DIRECTION_OUTPUT 28404576 ( 0.094| 0.000) D: [lt-pulseaudio] alsa-mixer.c: element_set_switch(): b 0 ( 0.094| 0.000) D: [lt-pulseaudio] alsa-mixer.c: element_set_switch(): me 28912288 ( 0.094| 0.000) D: [lt-pulseaudio] alsa-mixer.c: element_set_switch Line dir=2 index=0

However, Mic is selected in sound menu.

The pcm capture source seem changed to mic which is index 0

There are some difference between Capture Source of ac97 codec and PCM Capture Source of snd-usb-audio

The source of Ac97 capture source are cswitch-exclusive , only one cswitch can be on and others are off

Simple mixer control 'Line',0
Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive penum
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]

Simple mixer control 'Mic',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive penum
  Capture exclusive group: 0
  Playback channels: Mono
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono: Playback 0 [0%] [-34.50dB] [off]
  Front Left: Capture [on]
  Front Right: Capture [on]

static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw) {

  ...

                           } else {
- if ((r = snd_mixer_selem_set_capture_dB(me, c, value, rounding)) >= 0) + if ((r = snd_mixer_selem_set_capture_dB(me, c, value, rounding)) >= 0) {
+ pa_log_debug("element_set_volume %s %d dB", e->alsa_name, value);
r = snd_mixer_selem_get_capture_dB(me, c, &value);
+                              }
                            }

According to log output element_set_volume() is never called at start, only when opening sound UI.
But it goes to other if branch, because of write_to_hw being false.
Here is fresh log of first run after restart: http://pastebin.com/GJyUiraP
Mic was initially selected in UI, but didn't work, then I switched to Line and back.

Sincerely, Nazar Mokrynskyi
github.com/nazar-pc
Skype: nazar-pc
Diaspora:naza...@diaspora.mokrynskyi.com
Tox: 
A9D95C9AA5F7A3ED75D83D0292E22ACE84BA40E912185939414475AF28FD2B2A5C8EF5261249


Attachment: smime.p7s
Description: Кріптографічний підпис S/MIME

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to