Skip to content

Fixed ALSA capture device monitoring. #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2019
Merged

Fixed ALSA capture device monitoring. #328

merged 1 commit into from
Jan 13, 2019

Conversation

jdevelop
Copy link
Contributor

When using ALSA, the "Capture" mixer doesn't have the playback channel,
instead "capture"-related methods should be used to get information
about the current volume / state of the mixer.

Fixes #241

Copy link
Member

@orestisfl orestisfl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the new macros can be moved in print_volume.c since they are only used there


#define ALSA_MUTE_SWITCH(channel) \
if ((err = snd_mixer_selem_get_##channel##_switch(elem, 0, &pbval)) < 0) \
fprintf(stderr, "i3status: ALSA: ##channel##_switch: %s\n", snd_strerror(err)); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fprintf(stderr, "i3status: ALSA: ##channel##_switch: %s\n", snd_strerror(err)); \
fprintf(stderr, "i3status: ALSA: " #channel "_switch: %s\n", snd_strerror(err)); \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, pls have a look.

When using ALSA, the "Capture" mixer doesn't have the playback channel,
instead "capture"-related methods should be used to get information
about the current volume / state of the mixer.
@jdevelop
Copy link
Contributor Author

Any chance to get it merged into upstream, @Airblader ?

@Airblader
Copy link
Member

I wasn't aware you had made the changes since there's no notifications for pushes. Please always make sure to drop a comment so we get notified. :-) Thanks for your contribution!

@Airblader Airblader merged commit be0be59 into i3:master Jan 13, 2019
@qguv
Copy link

qguv commented Apr 14, 2020

@jdevelop: Could you give an example of a working i3status configuration that can make use of this? I'm running Pulse and would like to show whether my microphone is muted—is that possible using this change? Or is additional pulse support necessary?

@jdevelop
Copy link
Contributor Author

@qguv

# i3status configuration file.
# see "man i3status" for documentation.

# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!

general {
        output_format = "i3bar"
        colors = true
        interval = 5
}

order += "cpu_usage"
order += "load"
order += "volume master"
order += "volume capture"
order += "disk /"
order += "wireless _first_"
order += "ethernet _first_"
order += "battery 0"
order += "tztime zp"
order += "tztime local"

wireless _first_ {
        format_up = "W: (%quality at %essid) %ip"
        format_down = "W: down"
}

ethernet _first_ {
        # if you use %speed, i3status requires root privileges
        format_up = "E: %ip (%speed)"
        format_down = "E: down"
}

battery 0 {
        format = "%status %percentage %remaining"
}

cpu_usage {
    format = "%usage "
}

tztime local {
        format = "%Y-%m-%d %H:%M"
}

load {
        format = "%1min"
}

disk "/" {
        format = "/ %avail"
}

volume master {
        format = ": %volume"
        format_muted = ""
        device = "hw:0"
        mixer  = "Master"
        mixer_idx = 0
}

volume capture {
        format = ": %volume"
        format_muted = ""
        device = "hw:0"
        mixer  = "Capture"
        mixer_idx = 0
}

@jdevelop jdevelop deleted the fix/capture-volume-status branch April 14, 2020 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Allow monitoring volume and mute status of audio input devices
4 participants