LandisTwo / veromix-plasmoid

Automatically exported from code.google.com/p/veromix-plasmoid
GNU General Public License v3.0
0 stars 0 forks source link

Cannot switch microphone inputs #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is no way to get a dialog similar to the one in my attached screenshot.

The screenshot shows pavucontrol on the "input devices" screen. The input 
device listed on the screen has a "port" dropdown that lets me pick "internal 
microphone," "analog microphone," or "analog line-in." Veromix has no 
equivalent dropdown, which means I must use pavucontrol or the phonon settings 
in kde to configure this to switch between my headset and my laptop's internal 
mic.

Original issue reported on code.google.com by Mr.Challinger@gmail.com on 25 Jan 2012 at 1:24

Attachments:

GoogleCodeExporter commented 9 years ago
Working on it - by the way: you will get context menus

Original comment by nik.lutz on 25 Jan 2012 at 2:01

GoogleCodeExporter commented 9 years ago
Yay!

Original comment by Mr.Challinger@gmail.com on 25 Jan 2012 at 4:50

GoogleCodeExporter commented 9 years ago

Original comment by nik.lutz on 27 Jan 2012 at 11:05

GoogleCodeExporter commented 9 years ago
Not fixed in latest svn

Original comment by Mr.Challinger@gmail.com on 27 Jan 2012 at 11:23

GoogleCodeExporter commented 9 years ago
Oops sorry I thought this was about pavucontrol tab "configuration" -> profile.

Original comment by nik.lutz on 27 Jan 2012 at 11:37

GoogleCodeExporter commented 9 years ago
I love the context menus, but I don't like the clutter introduced by having the 
configurations for all sinks listed. I also think that the names should follow 
pavucontrol. I also think that the "settings" item should be named "Veromix 
Settings" to clarify that the settings are for veromix, rather than for the 
specific source/sink.

So, I think the menus for sinks and sources should look like this:
Port >
Configuration >
✓Muted
✓Unlock Channels
----------------
Veromix Settings

For streams:
Output/Input (my preference is for "Move to")
✓Muted
✓Unlock Channels
Disconnect/Kill

Another possible refinement is not to include the current output in the output 
list.

As an aside, I'm no longer getting recording streams on veromix. I have a 
"record" tab with the two sources, but a stream doesn't show up when I start 
skype, for example. (It does show up in pavucontrol)

Original comment by Mr.Challinger@gmail.com on 28 Jan 2012 at 6:42

GoogleCodeExporter commented 9 years ago
Thanks for the input. 

I decided to show all sinks because otherwise it is not possible to enable a 
switched-off sink. Do you also have a suggestion for that use case?

Original comment by nik.lutz on 28 Jan 2012 at 12:20

GoogleCodeExporter commented 9 years ago
Hmm. keep showing sinks that are switched off, but grayed out and moved to the 
bottom of the list. To turn back on, either a button shown over the top of the 
sink or a context menu with one option: enable.

Original comment by Mr.Challinger@gmail.com on 28 Jan 2012 at 6:39

GoogleCodeExporter commented 9 years ago
Oh, I see what you mean.
Yeah, same thing before but show grayed out at the bottom with a "Profile" 
option.

Original comment by Mr.Challinger@gmail.com on 28 Jan 2012 at 6:51

GoogleCodeExporter commented 9 years ago
I've been trying to look at how to add ports, but I'm having trouble tracking 
it down... Trying to trace down how profiles are done and use that to add 
ports...

Original comment by Mr.Challinger@gmail.com on 29 Jan 2012 at 9:58

GoogleCodeExporter commented 9 years ago
Port related stuff isn't yet in lib_pulsaudio.py. To get it in there I would 
search the function(s) in the documentation, for example: 

http://freedesktop.org/software/pulseaudio/doxygen/introspect_8h.html#a028b48d14
4de34d7489662c66812dbfa

then run:
# python /usr/share/pyshared/ctypeslib/h2xml.py  
/usr/include/pulse/introspect.h -o /tmp/test.xml
# python /usr/share/pyshared/ctypeslib/xml2py.py test.xml  -k f  -l 
/usr/lib/libpulse.so -o temp_lib.py

and copy paste the (needed) functions and structs from temp_lib.py to 
lib_pulseaudio.py (maybe rename some variables). Then you would just have to 
pass the values trough dbus to the plasmoid...

---

Please commit your work - so that I do not double the work..

Original comment by nik.lutz on 29 Jan 2012 at 11:59

GoogleCodeExporter commented 9 years ago
Well, I committed the changes to lib_pulseaudio.py, but I'm still having 
trouble figuring out how to actually use them. I'm giving up on it for now, but 
any help is appreciated.

Otherwise, if you want to finish it, I can watch what you commit and learn from 
that. But I'd rather learn by doing it myself, so my preference would be for 
you to help me.

Original comment by Mr.Challinger@gmail.com on 29 Jan 2012 at 8:11

GoogleCodeExporter commented 9 years ago
I see two ways to continue: 
a) test pa_context_set_sink_port_by_index and make the function available over 
dbus
b) get the card port information, an show it in veromix

a) 
- Temporary use pulse_sink_mute (PulseAudio.py) to call 
pa_context_set_sink_port_by_index - start dbus-service/VeromixServiceMain.py in 
a separate terminal to see "print" and other debugging statements.. (and check 
with pavucontrol if it works.. ) -- make sure that there is only one 
VeromixServiceMain.py process: use contrib/kill_service.sh to be sure..

- then copy and adapt pulse_sink_mute in VeromixDbus.py to call your new 
function in PulseAudio.py (now you can launch qdbusviewer and see/execute your 
function)

- define a function in contents/code/PulseAudioProxy.py (and also 
PulseProxyObjects.py)

b) 
- try to extract 'n_ports','ports','active_port', in class PulseSink  of 
PulseSink.py  
- see on_sink_info(self, sink): in PA2dBus.py, decide weather you want to put 
ports and active_ports in the properties dictionary or as new arguments to the 
dbus notification
- make an accessor in SinkInfo of on_sink_info(self, sink)

..

Original comment by nik.lutz on 29 Jan 2012 at 9:01

GoogleCodeExporter commented 9 years ago
How do I pass ports? I'm thinking I want to extract the ports to a 2d array of 
strings {{name, description},...} in pulsesink.py?

Original comment by Mr.Challinger@gmail.com on 29 Jan 2012 at 11:15

GoogleCodeExporter commented 9 years ago
yes exactly then extend 

    @dbus.service.signal(dbus_interface="org.veromix.notification", signature='isba{ia{si}}a{ss}')
    def sink_info(self, index,  name , mute, volume , dictProperties):
        pass

by an integer (for active - i for interger or s for string)  and a dbus 
dictionary a{ss}  (array with string->string )

==>
    @dbus.service.signal(dbus_interface="org.veromix.notification", signature='isba{ia{si}}a{ss}ia{ss}')
    def sink_info(self, index,  name , mute, volume , dictProperties, port_index, port_profiles):
        pass

Original comment by nik.lutz on 29 Jan 2012 at 11:55

GoogleCodeExporter commented 9 years ago
I cannot figure out how to get the names and descriptions of the ports out of 
the array.

Original comment by Mr.Challinger@gmail.com on 29 Jan 2012 at 11:58

GoogleCodeExporter commented 9 years ago
if I put 
self.n_ports = pa_sink_info.n_ports
if self.n_ports > 0:
  print pa_sink_info.ports
  print pa_sink_info.ports[0]
  print pa_sink_info.ports[0][0]

in __init__(self, pa_sink_info) i get:

<pulseaudio.lib_pulseaudio.LP_LP_pa_sink_port_info object at 0x1bb8a70>
<pulseaudio.lib_pulseaudio.LP_pa_sink_port_info object at 0x1bb8b00>
Segmentation fault

Original comment by Mr.Challinger@gmail.com on 30 Jan 2012 at 12:03

GoogleCodeExporter commented 9 years ago
oh, and if I print n_ports I get 56000.

Original comment by Mr.Challinger@gmail.com on 30 Jan 2012 at 12:03

GoogleCodeExporter commented 9 years ago
Already tried

Pa_sink_info.ports[0].name

?

Original comment by nik.lutz on 30 Jan 2012 at 12:14

GoogleCodeExporter commented 9 years ago
Yes.

Original comment by Mr.Challinger@gmail.com on 30 Jan 2012 at 12:23

GoogleCodeExporter commented 9 years ago
Here's what happens:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 313, in 'calling callback function'
  File "/home/jschall/veromix-plasmoid-read-only/trunk/dbus-service/pulseaudio/PulseAudio.py", line 370, in pa_sink_info_cb
    sink = PulseSinkInfo(struct[0])
  File "/home/jschall/veromix-plasmoid-read-only/trunk/dbus-service/pulseaudio/PulseSink.py", line 111, in __init__
    print pa_sink_info.ports[0].name
AttributeError: 'LP_pa_sink_port_info' object has no attribute 'name'

Original comment by Mr.Challinger@gmail.com on 30 Jan 2012 at 12:24

GoogleCodeExporter commented 9 years ago
Arent you missing some arguments between proplist and n_ports?

If the order.in this api is right 
http://harmattan-dev.nokia.com/docs/platform-api-reference/xml/daily-docs/pulsea
udio/ (i dont reach frendesktop.org) you get configured-latency for N_ports

Original comment by nik.lutz on 30 Jan 2012 at 12:34

GoogleCodeExporter commented 9 years ago
I am nik3nt3 on oftc irc..

Original comment by nik.lutz on 30 Jan 2012 at 12:49

GoogleCodeExporter commented 9 years ago
got it

Original comment by Mr.Challinger@gmail.com on 30 Jan 2012 at 12:51

GoogleCodeExporter commented 9 years ago

Original comment by Mr.Challinger@gmail.com on 30 Jan 2012 at 7:00

GoogleCodeExporter commented 9 years ago
nice work!

two remarks:

- with my Sennheiser USB Audio Device I cannot switch the port - not even with 
pavucontrol! This is most probably a Pulseaudio bug.

- when you change the port with pavucontrol - does veromix get notified?
  A sink_info notification should be sent over dbus. If not you should check if there is something similar to PA_SUBSCRIPTION_MASK_CARD ..

- please use white-spaces instead of tabs. I once decided not to use tabs for 
this project...

/nik

Original comment by nik.lutz on 30 Jan 2012 at 11:36

GoogleCodeExporter commented 9 years ago
I hate tabs. kate must've put them in.
I'm not sure if veromix gets notified or not, but it seems to always have the 
right port.

Original comment by Mr.Challinger@gmail.com on 30 Jan 2012 at 11:41