-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add support for sources (microphone) #64
Add support for sources (microphone) #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the contribution!
Haha, it is indeed quite hacky but it does the trick, and that's what shell scripts are for, after all :P This will finally close #25.
- I would also change the
SINK_NICKNAMES
,ICON_SINK
, andSINK_BLACKLIST
variables to avoid confusion. Unfortunately, that will be a breaking change, but I would say it's worth it? Perhaps we could declare the old variables at the top as dummies with the value"Please update your variable names. See <link to release>"
. That way everyone would know about it, rather than breaking mysteriously. We can then remove them in a future version. Also the commandnext-sink
. - For the documentation, we're going to need to explain how it works in the README and update the
--help
message. - Maybe we could come up with a word to treat both sinks and sources to update the outdated comments, functions or variables, like artefact or device?
- Since it's tricky, could you please also comment out this solution carefully when introducing the variable, so that future developers can understand it easily, and why this was the best option?
- I think the explanation in the
--help
message could elaborate a bit more as well. - The tests are broken now
- Looks like you're using tabs and we used spaces in the script
I've tried it out and it seems like we need to add |
Sure thing!
Updated, I changed the flag to be
Agreed, changed it to
On it
Whoops, should be fixed :) |
Fixed: it seems that listening on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed a couple nitpicks and deprecated SINK_NICKNAME
as well. Let me know if it's okay for merging and I will do so! Thanks a lot for the help, the documentation looks great as well.
The only feedback I have is that I find 100 ms for the latency in read
to be too much, personally. It lags a bit and seems smoother with 50ms. What do you think? Should we modify the default value to 50ms or do we make it possible to customize? Do you agree with me here?
Also, the
The |
And one additional problem I've found: for some reason I also get sinks when running
|
On my side (pipewire), here is the output when switching the microphone once. I'm fine with changing the event criteria if it doesn't work on your end of course. I didn't dig deeper as this event was always generated on my end.
|
I agree, thinking about it I think this fix would solve the issue without changing the latency: #67 If you feel it doesn't solve the issue, we can change the 100 ms value to lower, and configurable too! |
I'm a novice regarding PulseAudio, but the |
That does fix it! Great job.
Perhaps we should add that
Seems like adding the blacklist fixed that issue! No worries, I think. |
Before this commit, pulseaudio-control supported solely sinks. After this commit, it supports sinks and sources, under a new name "node". A new flag `--node-type` changing the behavior of the script to handle sources instead of sinks. All the existing mentions of sinks have been changed to node when appropriate. Sinks and sources almost share the same commands, with the main difference being the command name (i.e. sink for Sinks). Thus, this commit adds a simple and hacky way to handle sources: a variable SINK_OR_SOURCE holds either `ink` or `ource` so that commands that were using `Sink` `Sinks` `sinks` `sink` can be transformed to `Source` `Sources` `sources` `source` easily.
Good idea, it's done :) A cleaner way would be to ignore within the script the |
Ok, I'd say that we can revert this commit and merge: a75f392 I do get |
The switch is not detected anymore on my end i.e.
|
Sometimes, only the client event is present, to be safe, update when it's triggered.
To be safe, and support every scenario, I have pushed a new commit where changes are updated on multiple pactl events. |
Yeah it's quite unpredictable, not sure how it works nor where to look it up, so we can just leave it like this. Though I wonder if at this point it's worth having the Edit: nevermind, I guess we wouldn't listen for source events when using sinks. So that's enough. Merging this PR finally! Thanks a bunch for your help. I'll release a new version shortly. |
A new flag
--microphone
changes the behavior of the script tohandle sources instead of sinks.
Sinks and sources almost share the same commands, with the main
difference being the command name (i.e. sink for Sinks).
Thus, this commit adds a simple and hacky way to handle sources:
a variable SINK_OR_SOURCE holds either
ink
orource
so thatcommands that were using
Sink
Sinks
sinks
sink
can betransformed to
Source
Sources
sources
source
easily.Again, hacky, but does the job.