Added initial support for PulseAudio in KMix. #19

Merged
MicheleC merged 1 commits from feat/pa-support into master 4 years ago
Owner

The mixer/device channel to control from the system tray widget is now selectable from the user and default to the main one if not specifically selected. This allows to control PulseAudio volume from KMix correctly if PA is installed on the system

This PR makes the PR proposed in bug 2782 (#4) obsolete. Please note additional work is still required to integrate KMilo and also to fix a few extra issues in KMix.

The mixer/device channel to control from the system tray widget is now selectable from the user and default to the main one if not specifically selected. This allows to control PulseAudio volume from KMix correctly if PA is installed on the system This PR makes the PR proposed in bug 2782 (#4) obsolete. Please note additional work is still required to integrate KMilo and also to fix a few extra issues in KMix.
MicheleC added this to the R14.1.0 release milestone 4 years ago
MicheleC added the PR/rfc label 4 years ago
MicheleC changed title from Added initial support for PulseAudio in KMix. to WIP: Added initial support for PulseAudio in KMix. 4 years ago
Poster
Owner

@deloptes
Could you test this PR and let me know if you can correctly control PA volume on your system using the KMix tray icon/slider? Please note KMilo support is still not working correctly.

To test:

  1. compile and install. Exit and restart KMix
  2. by default KMix slider should now control PA master volume, including correctly muting/unmuting.
  3. Right click on KMix, choose "Select Master Channel", then "Custom" and then select any prepferred channel. After applying the change, the slider in KMix will now control only that specific channel (could be on a different mixer too, like an alsa mixer).
  4. Repeat step 3. but select "Default". After applying, KMix slider will once again control PA master volume
@deloptes Could you test this PR and let me know if you can correctly control PA volume on your system using the KMix tray icon/slider? Please note KMilo support is still not working correctly. To test: 1. compile and install. Exit and restart KMix 2. by default KMix slider should now control PA master volume, including correctly muting/unmuting. 3. Right click on KMix, choose "Select Master Channel", then "Custom" and then select any prepferred channel. After applying the change, the slider in KMix will now control only that specific channel (could be on a different mixer too, like an alsa mixer). 4. Repeat step 3. but select "Default". After applying, KMix slider will once again control PA master volume
Collaborator

Hi Michele,
went through the steps but Step 4. does not return behaviour to control PA Master channel
- mute unmute impacts now Master and PCM in the ALSA only (I mean visually it does not switch off the PA Master
- also the volume slider does not control PA anymore.
- also PA Master shows up at 50% but ALSA is at 100%.
- also mouse wheel controls sound but not the mixer (left mouse click). When mixer is open the PA slider is not controlled by mouse wheel. In the ALSA however it is.

Same on the D520 and on top, what I am missing all the time is to handle dynamic devices - like BT mixers or perhaps USB (but I have not tried USB here). I tested however BT (as you perhaps know) and the problem is that one can not configure BT-device audio properties with kmix, but can with PA volume control.

I think this topic is much bigger, than it seems and IMO the original patch controlling all the master channels was OK. Might be that something in between is the truth, but I had no time to look into details in yours or in the others patch.

Hi Michele, went through the steps but Step 4. does not return behaviour to control PA Master channel - mute unmute impacts now Master and PCM in the ALSA only (I mean visually it does not switch off the PA Master - also the volume slider does not control PA anymore. - also PA Master shows up at 50% but ALSA is at 100%. - also mouse wheel controls sound but not the mixer (left mouse click). When mixer is open the PA slider is not controlled by mouse wheel. In the ALSA however it is. Same on the D520 and on top, what I am missing all the time is to handle dynamic devices - like BT mixers or perhaps USB (but I have not tried USB here). I tested however BT (as you perhaps know) and the problem is that one can not configure BT-device audio properties with kmix, but can with PA volume control. I think this topic is much bigger, than it seems and IMO the original patch controlling all the master channels was OK. Might be that something in between is the truth, but I had no time to look into details in yours or in the others patch.
Collaborator

Thinking about it once again, why should PA has only master channel? And why should kmix mess up with ALSA and PA?

If PA is installed, then primary control should be on PA, if not on ALSA device. In fact PA is "just" another device. What I mean is I am missing a TDE interface similar to pactl. It would be great if we had such interface.

I'm curious to know how kmix is working, but don't have the time to go deeper now.

Thinking about it once again, why should PA has only master channel? And why should kmix mess up with ALSA and PA? If PA is installed, then primary control should be on PA, if not on ALSA device. In fact PA is "just" another device. What I mean is I am missing a TDE interface similar to pactl. It would be great if we had such interface. I'm curious to know how kmix is working, but don't have the time to go deeper now.
Poster
Owner

Hi Emanoil, thanks for testing.

went through the steps but Step 4. does not return behaviour to control PA Master channel
- mute unmute impacts now Master and PCM in the ALSA only (I mean visually it does not switch off the PA Master
- also the volume slider does not control PA anymore.
- also PA Master shows up at 50% but ALSA is at 100%.
- also mouse wheel controls sound but not the mixer (left mouse click). When mixer is open the PA slider is not controlled by mouse wheel. In the ALSA however it is.

There is currently a problem with the update of the slider for PA master in the mixer window, this was preexisting and is a point I was already planning to look at. Both step 2. and 4. should give the exact same results, which are what you described:

  1. the slider in the tray area affects ALSA master and PCM (this means it is controlling the PA Master channel in effect)
  2. mute/unmute affects ALSA master and PCM (this means it is muting/unmuting the PA Master channel in effect)
  3. the PA Master slider in the Mixer windows is not updated
  4. using the wheel on the PA Master slider controls the ALSA master.

So for what I see here and your comments, it seems things are in sync.

Same on the D520 and on top, what I am missing all the time is to handle dynamic devices - like BT mixers or perhaps USB (but I have not tried USB here). I tested however BT (as you perhaps know) and the problem is that one can not configure BT-device audio properties with kmix, but can with PA volume control.

This patch and for R14.1.0 there will only be minimal support for PA in KMix, as in the Master channel only. For R14.2.0 I would like to extend KMix to properly support PA, that is add the ability to control the volume of individual streams as can be done at the moment using pavucontrol for example/

Hi Emanoil, thanks for testing. > went through the steps but Step 4. does not return behaviour to control PA Master channel > - mute unmute impacts now Master and PCM in the ALSA only (I mean visually it does not switch off the PA Master > - also the volume slider does not control PA anymore. > - also PA Master shows up at 50% but ALSA is at 100%. > - also mouse wheel controls sound but not the mixer (left mouse click). When mixer is open the PA slider is not controlled by mouse wheel. In the ALSA however it is. There is currently a problem with the update of the slider for PA master in the mixer window, this was preexisting and is a point I was already planning to look at. Both step 2. and 4. should give the exact same results, which are what you described: 1. the slider in the tray area affects ALSA master and PCM (this means it is controlling the PA Master channel in effect) 2. mute/unmute affects ALSA master and PCM (this means it is muting/unmuting the PA Master channel in effect) 3. the PA Master slider in the Mixer windows is not updated 4. using the wheel on the PA Master slider controls the ALSA master. So for what I see here and your comments, it seems things are in sync. > Same on the D520 and on top, what I am missing all the time is to handle dynamic devices - like BT mixers or perhaps USB (but I have not tried USB here). I tested however BT (as you perhaps know) and the problem is that one can not configure BT-device audio properties with kmix, but can with PA volume control. This patch and for R14.1.0 there will only be minimal support for PA in KMix, as in the Master channel only. For R14.2.0 I would like to extend KMix to properly support PA, that is add the ability to control the volume of individual streams as can be done at the moment using pavucontrol for example/
Poster
Owner

Thinking about it once again, why should PA has only master channel? And why should kmix mess up with ALSA and PA?

KMix currently shows the actual hw device channels related to PA. The sw streams are not yet supported, as mentioned in the previous comment I would like to add them for R14.2.0.

KMix will also list all available mixers in the system.

If PA is installed, then primary control should be on PA, if not on ALSA device. In fact PA is "just" another device.

Correct, if PA is installed, PA should be the primary control as the "default" option in this PR does. But if a user wants to control a different channel for some reasons, he is given the ability to do so.

> Thinking about it once again, why should PA has only master channel? And why should kmix mess up with ALSA and PA? KMix currently shows the actual hw device channels related to PA. The sw streams are not yet supported, as mentioned in the previous comment I would like to add them for R14.2.0.<br/> KMix will also list all available mixers in the system. > If PA is installed, then primary control should be on PA, if not on ALSA device. In fact PA is "just" another device. Correct, if PA is installed, PA should be the primary control as the "default" option in this PR does. But if a user wants to control a different channel for some reasons, he is given the ability to do so.
Poster
Owner

Hi Emanoil, I have done further testing while working on keyboard shortcuts. I confirm there is a problem with the update of the tray icon when KMix is started with the default channel already selected. This is probably what you saw at point 4. If you select another channel and select back to default, it works. I will work on a fix 😄

Hi Emanoil, I have done further testing while working on keyboard shortcuts. I confirm there is a problem with the update of the tray icon when KMix is started with the default channel already selected. This is probably what you saw at point 4. If you select another channel and select back to default, it works. I will work on a fix :smile:
Poster
Owner

@deloptes @roman

Could you test this PR on your system and let me know if it works fine with muting/unmuting the selected mixer/device? Please note that:

  1. the changes proposed in the patch in KMilo are not needed
  2. you can use the global keyboard shortcut already present in KMix. Open the mixer window, then Settings -> Configure Global Shortcuts... if you need to change them
  3. the tray icon will update if you mute/unmute from DCOP/keyboard shortcut/mute command in right click mouse menu/alsamixer/pavucontrol. It will NOT update if you mute/unmute using the green LED on top of the volume slider. This is a bug in the slider that I will address in a subsequent commit.
  4. Remaining issues with slider mouse wheel are still not fixed (again, for a future commit).

Thanks for any feedback 😄

@deloptes @roman<br/> Could you test this PR on your system and let me know if it works fine with muting/unmuting the selected mixer/device? Please note that: 1. the changes proposed in the patch in KMilo are not needed 2. you can use the global keyboard shortcut already present in KMix. Open the mixer window, then Settings -> Configure Global Shortcuts... if you need to change them 3. the tray icon will update if you mute/unmute from DCOP/keyboard shortcut/mute command in right click mouse menu/alsamixer/pavucontrol. It will NOT update if you mute/unmute using the green LED on top of the volume slider. This is a bug in the slider that I will address in a subsequent commit. 4. Remaining issues with slider mouse wheel are still not fixed (again, for a future commit). Thanks for any feedback :smile:
Poster
Owner

Further update to the code. Now even the slider's mute/unmute and wheels event should work nicely. Furthermore increasing/decreasing the volume using keyboard shortcut should now work. No KMilo is required for that, so appreciated if you could test without KMilo installed, just for the sake of it.

Further update to the code. Now even the slider's mute/unmute and wheels event should work nicely. Furthermore increasing/decreasing the volume using keyboard shortcut should now work. No KMilo is required for that, so appreciated if you could test without KMilo installed, just for the sake of it.
Collaborator

Hi Michele,

I did compile the pa patch and installed kmix without restarting the desktop. The MM keys did not work even after removing kmilo.

The rest looks good. I will look forward to test on the D520 tomorrow. I can reboot there and test fresh.

Hi Michele, I did compile the pa patch and installed kmix without restarting the desktop. The MM keys did not work even after removing kmilo. The rest looks good. I will look forward to test on the D520 tomorrow. I can reboot there and test fresh.
Poster
Owner

Hi Emanoil, thanks for testing.

Regarding the MM keys, did all three functions (increase volume, decrease volume, mute/unmute) not work? Have you tried assigning different shortcuts to them for a test? I can see the functions working here on my VM. I can try on a laptop later on if required.

Now that I am think of it, please take note there is no OSD feedback for volume change using this code. Something I missed out, I will have to put it back in 😄

Hi Emanoil, thanks for testing.<br/> Regarding the MM keys, did all three functions (increase volume, decrease volume, mute/unmute) not work? Have you tried assigning different shortcuts to them for a test? I can see the functions working here on my VM. I can try on a laptop later on if required. Now that I am think of it, please take note there is no OSD feedback for volume change using this code. Something I missed out, I will have to put it back in :smile:
Poster
Owner

Confirmed the MM keys don't work, I tried on my old laptop. But if reassigned they do, so the functionality is there. Just need to clean it up properly 😉

Confirmed the MM keys don't work, I tried on my old laptop. But if reassigned they do, so the functionality is there. Just need to clean it up properly :wink:
Poster
Owner

@deloptes @roman

Could you test this PR again, together with TDE/tdeutils#26? What it does is as follow:

  1. this PR allows the user to select the default mixer/device to consider as master (by default it will be the default mixer)

  2. KMilo volume controls acts on such selected channel.

This adds support for PA on a default installation.

Notes:

  1. in case you had assigned special global shortcuts in KMix, make sure they are either removed or do not conflict with the global shortcuts specified in KMilo

  2. suggest you make a reboot before testing or alternatively exit kmix and stop kmilo, then run kmix and kmilo again. This is to make sure global keyboard shortcuts are correctly handled.

@deloptes @roman<br/> Could you test this PR again, together with TDE/tdeutils#26? What it does is as follow: 1. this PR allows the user to select the default mixer/device to consider as master (by default it will be the default mixer) 2. KMilo volume controls acts on such selected channel. This adds support for PA on a default installation. Notes: 1. in case you had assigned special global shortcuts in KMix, make sure they are either removed or do not conflict with the global shortcuts specified in KMilo 2. suggest you make a reboot before testing or alternatively exit kmix and stop kmilo, then run kmix and kmilo again. This is to make sure global keyboard shortcuts are correctly handled.
Collaborator

Hi Michele,
this works almost great. There are two things I noticed:

  1. In the new select master channel, when default is selected there is no option to select the default - all is greyed out.
    This might be OK if we assume that kmix is always taking the Master as default, but I noticed that:
  2. (default config) with the MM keys on the VM not the Master but the ALSA PCM is being controlled in parallel to the PA Master. On D520 it works fine - both master channels are controlled.
  3. Mute/Unmute in Custom config, when set to control Master on ALSA and PA does unmute only ALSA Master, but mutes both PA and ALSA Master. Then I boot same image to D520 tested there and booted again the VM. Repeated this test and it worked fine. It could be it had to do something with a configuration from previous testing.

If 1. is on purpose then it looks like only 2 needs more attention.

thanks, Michele

Hi Michele, this works almost great. There are two things I noticed: 1. In the new select master channel, when default is selected there is no option to select the default - all is greyed out. This might be OK if we assume that kmix is always taking the Master as default, but I noticed that: 2. (default config) with the MM keys on the VM not the Master but the ALSA PCM is being controlled in parallel to the PA Master. On D520 it works fine - both master channels are controlled. 3. Mute/Unmute in Custom config, when set to control Master on ALSA and PA does unmute only ALSA Master, but mutes both PA and ALSA Master. Then I boot same image to D520 tested there and booted again the VM. Repeated this test and it worked fine. It could be it had to do something with a configuration from previous testing. If 1. is on purpose then it looks like only 2 needs more attention. thanks, Michele
Poster
Owner

Hi Emanoil, first of all thanks for testing.

  1. "default" means that KMix will use the master channel that would automatically be selected by the system, so that is the reasons the other options are grayed out.If you choose "custom", then you can select any of the available channels on any available mixer.

  2. if you have only ALSA installed (no PA), then "default" will control the master channel only. If you have PA installed, "default" will control the PA master channel. PA will then control volume and mute status of ALSA master and PCM. On my system, muting PA mutes both ALSA master and PCM. On your D520 system if I remember correctly, you don't have a mute switch for PCM, so only ALSA master will be muted/unmuted by PA

  3. when controlling ALSA master with custom config, muting will mute PA too, and consequently ALSA PCM too if available. When unmuting, only ALSA master will unmute while PA master will remained muted since PCM is still muted. You should be able to reproduce this behavior in alsamixer (even without running KMix at all) if you act on the ALSA master instead of PA master. This is something I also see here and many people have already observed. Since this is a custom config from the user and the behavior is as per expected, I don't see a problem here. Basically if PA is installed, we should control PA master to have the correct mute/unmute behavior 😉

In summary, your tests matches my tests too and it works as expected, based on the actual user choice.

Does this explanation clear your doubts?

Hi Emanoil, first of all thanks for testing. 1. "default" means that KMix will use the master channel that would automatically be selected by the system, so that is the reasons the other options are grayed out.If you choose "custom", then you can select any of the available channels on any available mixer. 2. if you have only ALSA installed (no PA), then "default" will control the master channel only. If you have PA installed, "default" will control the PA master channel. PA will then control volume and mute status of ALSA master and PCM. On my system, muting PA mutes both ALSA master and PCM. On your D520 system if I remember correctly, you don't have a mute switch for PCM, so only ALSA master will be muted/unmuted by PA 3. when controlling ALSA master with custom config, muting will mute PA too, and consequently ALSA PCM too if available. When unmuting, only ALSA master will unmute while PA master will remained muted since PCM is still muted. You should be able to reproduce this behavior in alsamixer (even without running KMix at all) if you act on the ALSA master instead of PA master. This is something I also see here and many people have already observed. Since this is a custom config from the user and the behavior is as per expected, I don't see a problem here. Basically if PA is installed, we should control PA master to have the correct mute/unmute behavior :wink: In summary, your tests matches my tests too and it works as expected, based on the actual user choice.<br/> Does this explanation clear your doubts?
Collaborator

Hi,

regarding 1) no problem with this at all - I was just double checking

regarding 2) you want to say that PA is controlling the ALSA device (Master/PCM)?
Because as mentioned only the PCM was going up/down. So what you say means that PA is controlling only the PCM? I'll double check this with the PA mixer.

regarding 3) I observed described behavior only after changing configuration default -> custom -> default. Before it was default, but was behaving as you describe the custom one. It could be that there was some left over.

Mute/Unmute seems OK in all cases.

regards

Hi, regarding 1) no problem with this at all - I was just double checking regarding 2) you want to say that PA is controlling the ALSA device (Master/PCM)? Because as mentioned only the PCM was going up/down. So what you say means that PA is controlling only the PCM? I'll double check this with the PA mixer. regarding 3) I observed described behavior only after changing configuration default -> custom -> default. Before it was default, but was behaving as you describe the custom one. It could be that there was some left over. Mute/Unmute seems OK in all cases. regards
Poster
Owner

Hi Emanoil,

  1. ok, all clear

  2. yes, PA is controlling ALSA master and PCM, both volume and mute. This is regardless of whether kmix is running, you can check this in alsamixer. On my system, first PCM volume goes down, then at very low percentage of PA master volume, even ALSA master volume goes down to 0. Not sure if this is the same on all systems, but it is nothing to do with kmix or TDE in any case.

  3. I have tried to replicate your item 3 here, but I always see consistent behaviour. Could you double check first, then if you can reproduce this systematically please let me know the exact steps and I will try again (I have both VM and real laptop available).

I will wait for you feedback before proceeding on this.

Thanks for the support in testing 😄

Hi Emanoil, 1. ok, all clear 2. yes, PA is controlling ALSA master and PCM, both volume and mute. This is regardless of whether kmix is running, you can check this in alsamixer. On my system, first PCM volume goes down, then at very low percentage of PA master volume, even ALSA master volume goes down to 0. Not sure if this is the same on all systems, but it is nothing to do with kmix or TDE in any case. 3. I have tried to replicate your item 3 here, but I always see consistent behaviour. Could you double check first, then if you can reproduce this systematically please let me know the exact steps and I will try again (I have both VM and real laptop available). I will wait for you feedback before proceeding on this. Thanks for the support in testing :smile:
Collaborator

Hi Michele,

I can confirm 2) and 3) with what you are saying.

Regarding 2) the volume control decreases only ALSA PCM, but when it reaches minimum also ALSA Master is set to 0.

Regarding 3) it seems something was saved in config when testing previous versions. Now it behaves exactly as expected.

I wonder if I should test with a fresh user. I can do this later this evening. Let me know if desired.

regards

Hi Michele, I can confirm 2) and 3) with what you are saying. Regarding 2) the volume control decreases only ALSA PCM, but when it reaches minimum also ALSA Master is set to 0. Regarding 3) it seems something was saved in config when testing previous versions. Now it behaves exactly as expected. I wonder if I should test with a fresh user. I can do this later this evening. Let me know if desired. regards
Poster
Owner

Hi Emanoil

sure, why not. A quick test on a fresh user will provide extra feedback. If all is good, I can then merge this. If we find a problem, I will look into it.

Thanks!

Hi Emanoil sure, why not. A quick test on a fresh user will provide extra feedback. If all is good, I can then merge this. If we find a problem, I will look into it. Thanks!
Collaborator

Hi Michele,
now tested on the VM with new user.

Uninstalled PA - ALSA controls work great. Installed PA - controls work great. I can not reproduce 3) anymore.

Hi Michele, now tested on the VM with new user. Uninstalled PA - ALSA controls work great. Installed PA - controls work great. I can not reproduce 3) anymore.
Poster
Owner

ok, thanks for checking and confirming this. I will proceed with merging.

On a side note, I think you may have observed the problem in 3) if you had started PA after KMix. In such case KMix would have been controlling the ALSA master and not the PA master, since it can't at present detect changes in mixers at run time (it is in my todo list at some point).

Thanks for all the test and support.

ok, thanks for checking and confirming this. I will proceed with merging. On a side note, I think you may have observed the problem in 3) if you had started PA after KMix. In such case KMix would have been controlling the ALSA master and not the PA master, since it can't at present detect changes in mixers at run time (it is in my todo list at some point). Thanks for all the test and support.
MicheleC changed title from WIP: Added initial support for PulseAudio in KMix. to Added initial support for PulseAudio in KMix. 4 years ago
MicheleC closed this pull request 4 years ago
MicheleC deleted branch feat/pa-support 4 years ago
MicheleC removed the PR/rfc label 4 years ago
The pull request has been merged as e1b2705c5d.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tdemultimedia#19
Loading…
There is no content yet.