[pulseaudio-discuss] PCM Capture Source of usb audio not supported by pulseaudio

Raymond Yau superquad.vortex2 at gmail.com
Sun Jun 21 19:12:01 PDT 2015


>>
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Activating path
analog-input-mic
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Path
analog-input-mic (Microphone), direction=2, priority=87, probed=yes,
supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0,
max_volume=48, min_dB=-12, max_dB=12
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Element Mic,
direction=2, switch=1, volume=1, volume_limit=-1, enumeration=0,
required=0, required_any=4, required_absent=0, mask=0x3600000000f66,
n_channels=2, override_map=yes
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Element PCM Capture
Source, direction=2, switch=0, volume=0, volume_limit=-1, enumeration=1,
required=0, required_any=0, required_absent=0, mask=0x0, n_channels=0,
override_map=no
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Option Mic
(analog-input-microphone/analog-input-microphone) index=0, priority=0
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Element Line,
direction=2, switch=2, volume=2, volume_limit=-1, enumeration=0,
required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2,
override_map=no
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Jack Mic,
alsa_name='Mic Jack', detection unavailable
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Jack Mic Phantom,
alsa_name='Mic Phantom Jack', detection unavailable
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c: Setting
analog-input-microphone (analog-input-microphone) priority=0
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c:
element_set_switch(): e->alsa_name Line
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c:
element_set_switch():
e->direction == PA_ALSA_DIRECTION_OUTPUT 33694896
>>
>> Do you mean the direction is not input ?
>
> According to debug message, it is so, however in config:

Both are cvolume and cswitch

Simple mixer control 'Line',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 48
  Front Left: Capture 24 [50%] [0.00dB] [on]
  Front Right: Capture 24 [50%] [0.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 48
  Front Left: Capture 24 [50%] [0.00dB] [on]
  Front Right: Capture 24 [50%] [0.00dB] [on]

Seem mono capture switch but capture volume are stereo

>>>
>>> [Mapping analog-stereo-input]
>>> device-strings = hw:%f,1,0
>>> paths-input = analog-input-mic analog-input-linein
>>> channel-map = left,right
>>> direction = input
>
> There is explicit mentioning of required direction.
>
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c:
element_set_switch(): b 0
>>
>> pulseaudio seem just turn off line switch instead of turn on nic capture
volum/switch when activating mic path
>>
>> One line show element name , values or enum index and enum name instead
of three lines

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;
}

>
> Sorry, I'm not sure I understand what do you mean by this.
> I'm not C/C++ developer at all, can't even find definition of
snd_mixer_elem_t to find what is that and how to use it (my guess that
you've being asking about it, right?).
>>
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c:
element_set_option(): e->alsa_name PCM Capture Source
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c:
element_set_option(): e->switch_use == PA_ALSA_SWITCH_SELECT 0
>> (   0.090|   0.000) D: [lt-pulseaudio] alsa-mixer.c:
element_set_option(): alsa_idx 0
>>
>> snd_mixer_selem_get_enum_item_name() provide the name of enum item by
index
>

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);
+                              }
                            }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150622/01523fc5/attachment.html>


More information about the pulseaudio-discuss mailing list