Skip to content
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

Audio feature wrong volume #49

Open
h0useofdupree opened this issue May 7, 2021 · 8 comments
Open

Audio feature wrong volume #49

h0useofdupree opened this issue May 7, 2021 · 8 comments

Comments

@h0useofdupree
Copy link

This is totally not your fault, it is more a question on my side. The Control "Master" doesn't show my actual volume. And none of "amixer get <PCM/Speaker/etc> outputs show my actual volume. Is there anyway you could help me? I've spent hours trying to figure it out with the original dwmstatus and wanted to try yours now.
Best regards, Joel

@Gerschtli
Copy link
Owner

Hey, yeah I have some issues with amixer too sometimes. Until today, I only did trial and error. Are you using pulseaudio? Maybe have a look into pavucontrol and set the default output device.

@h0useofdupree
Copy link
Author

Yes I am already using pulseaudio. Sadly that means that I can't get around trying to rewrite the audio part of your code, so it would fit the output i used for the original dwmstatus, although I don't think i am qualified to do so. I will report back tomorrow and see if I was able to do something. Thanks for the reply.

@h0useofdupree
Copy link
Author

I fixed some stuff today by disabling my intel SoundCard, now my USB Interface is set a default basically.
Tho my volume needs to be controlled by Pulse anyway, so do you have any idea or tips for me, so i can alter your audio feature to display the output of pactl or pacmd ? I'd love to see my volume in the bar and i really wanna keep yours.

Sincerely, Joel

@Gerschtli
Copy link
Owner

A new option for the audio feature could be added, but I need to know how to get the current volume and a trigger to update the bar when volume changes.

Feel free to have a look at src/feature/audio.

@h0useofdupree
Copy link
Author

I really am no expert but i am able to get the volume with "pulsemixer --get-volume" and cut it down to one number with "pulsemixer --get-volume | cut -c 1-2"
My volume is controlled via DWM config.h command "pactl set-sink-volume <sink (1)> <value(+5%/-5%)>" ( pulsmixer can't increment volume afaik ).
I could simply get the bar to update when my volume keys are pressed, or much easier, it would be enough to have a timer update it like once a second.

I am just not able to implement the reading of the current volume ( yet, hopefully )

@Gerschtli
Copy link
Owner

I would propose the following:

  • Introduce a new option audio.backend which is per default alsa and can be set to pulseaudio
  • When backend set to pulseaudio:
    • In src/features/audio/notifier.rs run pactl subscribe to get updates when the volume changes or muting
    • In src/features/audio/updater.rs fetch current volume with pulsemixer --get-volume and mute state with pulsemixer --get-mute

Would these commands work in your environment? If you know rust, you can try to create a PR. Don't know when I have the time for it.

@Gerschtli
Copy link
Owner

I just put something together at pulseaudio branch. The only thing missing is a nice and easy way to trigger updates for the audio component. pactl subscribe only logs connections which are also created when reading the volume. This results currently in an infinite loop. I would love to get a kind of push logic implemented, this way the component updates only when needed and is always up-to-date. Unfortunately I did not find any solution for this. A time-based solution would work if thats the only way.

Do you have any ideas? Does alsactl monitor print anything when you change volume or switch mute on and off?

@h0useofdupree
Copy link
Author

Hey sorry for only answering now. I just checked it out and i love it. It works perfectly. I couldn't get alsactl to show volume changes, but i am working on something that might enable me to get volume changes. Thank you so much for doing this!
The infinite loop makes sense, pact subscribe isn't as useful as I had hoped.

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

No branches or pull requests

2 participants