This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Master channel switching

Tags: None
(comma "," separated)
kekegt
Registered Member
Posts
4
Karma
0

Master channel switching

Fri Jan 24, 2014 8:21 pm
Hi! I wondered if there was a way to change the master channel in kmix while changing the sound output.

I explain.

I've setup a script, which works with pulseaudio, that allows me to "rotate" between sound output with a keyboard shortcut.

Now, what I want to do is to "tell" kmix to change the master channel according to the newly chosen output, otherwise I'm not able to use my keyboard volume keys to turn up or down the volume if the output is not the "kmix master channel", it will only turn up and down the volume of my second output... which is pointless since I'm not even using it because I change to another output.

I don't know if I made myself clear...

If you'd like some command outputs or logs just let me know!!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Master channel switching

Sat Jan 25, 2014 8:36 am
You may find the following output to be of use:
Code: Select all
qdbus org.kde.kmix /Mixers


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
kekegt
Registered Member
Posts
4
Karma
0

Re: Master channel switching

Sat Jan 25, 2014 7:57 pm
The output of qdbus org.kde.kmix /Mixers is:

property read QString org.kde.KMix.MixSet.currentMasterControl
property read QString org.kde.KMix.MixSet.currentMasterMixer
property read QStringList org.kde.KMix.MixSet.mixers
property read QString org.kde.KMix.MixSet.preferredMasterControl
property read QString org.kde.KMix.MixSet.preferredMasterMixer
signal void org.kde.KMix.MixSet.masterChanged()
signal void org.kde.KMix.MixSet.mixersChanged()
method void org.kde.KMix.MixSet.setCurrentMaster(QString mixer, QString control)
method void org.kde.KMix.MixSet.setPreferredMaster(QString mixer, QString control)
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()
method QString org.freedesktop.DBus.Peer.GetMachineId()
method void org.freedesktop.DBus.Peer.Ping()

But I don't know what more it brings me...
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Master channel switching

Mon Jan 27, 2014 3:32 am
To change the master channel, you need to set two things: the master mixer, and the master control. Together, these two determine which channel is changed when you press the up/down volume keys, and which one is displayed in the popup.

You can use the following command to get a list of mixers:
Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.mixers


And the following command to get a list of controls from a given mixer (which is /Mixers/0 in this example):
Code: Select all
qdbus org.kde.kmix /Mixers/0 controls


Once you have determined that, you can run the following to change the master mixer and control:
Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.setCurrentMaster <mixer> <control>


You can use the following two commands to see what the current master mixer and controls are:
Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.currentMasterMixer
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.currentMasterControl


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
kekegt
Registered Member
Posts
4
Karma
0

Re: Master channel switching

Mon Jan 27, 2014 5:16 am
So It didn't work but maybe I've done something wrong so I'll paste the outputs of the commands above.

Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.mixers


gives

Code: Select all
/Mixers/PulseAudio__Playback_Devices_1
/Mixers/PulseAudio__Capture_Devices_1
/Mixers/PulseAudio__Playback_Streams_1
/Mixers/PulseAudio__Capture_Streams_1


Code: Select all
qdbus org.kde.kmix /Mixers/PulseAudio__Playback_Devices_1 controls


gives

Code: Select all
/Mixers/PulseAudio__Playback_Devices_1/alsa_output_pci_0000_01_00_1_hdmi_stereo_extra1
/Mixers/PulseAudio__Playback_Devices_1/alsa_output_pci_0000_00_1b_0_analog_stereo


then, to change the current master to analog_stereo... I typed

Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.setCurrentMaster /Mixers/PulseAudio__Playback_Devices_1 /alsa_output_pci_0000_00_1b_0_analog_stereo


and, to change the current master back to hdmi_stereo... I typed

Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.setCurrentMaster /Mixers/PulseAudio__Playback_Devices_1 /alsa_output_pci_0000_01_00_1_hdmi_stereo_extra1/Mixers/PulseAudio__Playback_Devices_1/alsa_output_pci_0000_01_00_1_hdmi_stereo_extra1


This is where the thing bugs... it doesns't switch back to hdmi...
When I'm first on HDMI and I switch to analog it works.. but when I try to use the second command to switch back nothing happens.

P.S. Thanks for your fast replies.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Master channel switching  Topic is solved

Mon Jan 27, 2014 8:54 am
Hmm, did this command complete successfully, as it looks like there is only one argument rather than the two that it is supposed to have?
Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.setCurrentMaster /Mixers/PulseAudio__Playback_Devices_1 /alsa_output_pci_0000_01_00_1_hdmi_stereo_extra1/Mixers/PulseAudio__Playback_Devices_1/alsa_output_pci_0000_01_00_1_hdmi_stereo_extra1


Otherwise, try passing the value of "id" from the mixer and control respectively to the command instead.
Code: Select all
qdbus org.kde.kmix /Mixers/0 id
qdbus org.kde.kmix /Mixers/0/alsa_output_pci_0000_00_1b_0_analog_stereo id


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
kekegt
Registered Member
Posts
4
Karma
0

Re: Master channel switching

Mon Jan 27, 2014 12:04 pm
Thanks for your help! It seems the code was more responsive with the use of the ids.
It now works!
apache
Registered Member
Posts
302
Karma
0
OS

Re: Master channel switching

Sat Dec 06, 2014 2:00 pm
kekegt wrote:I've setup a script, which works with pulseaudio, that allows me to "rotate" between sound output with a keyboard shortcut.

Can you share this script?

I have similar problem
viewtopic.php?f=19&t=123962
noorasad
Registered Member
Posts
1
Karma
0

Re: Master channel switching

Fri Jan 30, 2015 12:36 am
newly chosen output, otherwise I'm not able to use my keyboard volume keys to turn up or down the volume if the output is not the "kmix master channel", it will only turn up and down the volume of my second output... which is pointless since I'm not even using it because I change to another output.

(Edit by admin: removed advertisement link, please see the forum rules)
jkennedy
Registered Member
Posts
1
Karma
0

Re: Master channel switching

Mon Mar 09, 2015 8:12 pm
This is the correct method of setting the master channel through qdbus:

First, manually select the first master channel from the GUI. The output of this will be the mixer:
Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.currentMasterMixer


The output of this will be the control:
Code: Select all
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.currentMasterControl


Select the second master channel from the GUI. Run the previous command again to get the secondary control ID.

To set the new master channel from qdbus:
Code: Select all
qdbus org.kde.kmix /Mixers setCurrentMaster mixer control


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], ourcraft