#!/usr/bin/env python
#
-# Copyright (c) 2008-2010 by Jaroslav Kysela <perex@perex.cz>
+# Copyright (c) 2008-2012 by Jaroslav Kysela <perex@perex.cz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#!/usr/bin/env python
#
-# Copyright (c) 2008-2010 by Jaroslav Kysela <perex@perex.cz>
+# Copyright (c) 2008-2012 by Jaroslav Kysela <perex@perex.cz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
ctls = self.get_controls()
res = []
for ctl in ctls:
- id = AlsaMixerElemId(name=ctl.name, index=ctl.index, device=ctl.device)
- e = AlsaMixerElem(self.codec.mixer, id)
+ for iface in (ctl.iface and [ctl.iface] or [None, 'card', 'pcm']):
+ try:
+ id = AlsaMixerElemId(iface=iface, name=ctl.name, index=ctl.index, device=ctl.device)
+ e = AlsaMixerElem(self.codec.mixer, id)
+ if iface and ctl.iface != iface:
+ ctl.iface = iface
+ break
+ except:
+ e = None
+ if not e:
+ print "Control ID not found:", ctl.dump_extra().strip().lstrip()
+ continue
e.hdactl = ctl
res.append(e)
return res
res[idx] = vals[idx]
if res[0] is None and res[1] is None:
return True
+ limit = self.wtype_id == 'AUD_OUT' and -3200 or -1200
for r in res:
- if r >= -1200:
+ if r >= limit:
return True
return False
#!/usr/bin/env python
#
-# Copyright (c) 2008-2010 by Jaroslav Kysela <perex@perex.cz>
+# Copyright (c) 2008-2012 by Jaroslav Kysela <perex@perex.cz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
column = gtk.TreeViewColumn("Active", renderer, active=0)
treeview.append_column(column)
renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn("Source Node", renderer, text=1, editable=False)
+ column = gtk.TreeViewColumn("Source Node", renderer, text=1, editable=1)
treeview.append_column(column)
sw.add(treeview)
return frame
for ctrl in ctrls:
hbox1 = gtk.HBox(False, 0)
vbox1.pack_start(hbox1, False, False)
- s = 'name=' + str(ctrl.name) + ', index=' + str(ctrl.index) + \
+ s = (ctrl.iface and ('iface=' + ctrl.iface + ',') or '') + \
+ 'name=' + str(ctrl.name) + ', index=' + str(ctrl.index) + \
', device=' + str(ctrl.device)
label = gtk.Label(s)
hbox1.pack_start(label, False, False)
vbox.pack_start(self.__build_device(dev), False, False)
ctrls = node.get_controls()
if ctrls:
+ node.get_mixercontrols() # workaround
vbox.pack_start(self.__build_controls(ctrls), False, False)
hbox = gtk.HBox(False, 0)
hbox.pack_start(self.__build_node_caps(node))
for i in CTL_ELEM_TYPEs:
CTL_ELEM_RTYPEs[CTL_ELEM_TYPEs[i]] = i
+CTL_ELEM_IFACE_CARD = 0
CTL_ELEM_IFACE_MIXER = 2
+CTL_ELEM_IFACE_PCM = 3
CTL_ELEM_IFACEs = {
+ "card": 0,
"mixer": 2,
+ "pcm": 3
}
CTL_ELEM_RIFACEs = {}
for i in CTL_ELEM_IFACEs:
name=None,
index=0):
self.numid = numid
- self.iface = iface
+ if type(iface) == type(''):
+ self.iface = CTL_ELEM_IFACEs[iface]
+ else:
+ self.iface = iface is None and CTL_ELEM_IFACE_MIXER or iface
self.device = device
self.subdevice = subdevice
self.name = name
#!/usr/bin/env python
#
-# Copyright (c) 2008-2010 by Jaroslav Kysela <perex@perex.cz>
+# Copyright (c) 2008-2012 by Jaroslav Kysela <perex@perex.cz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
class HDApcmControl:
- def __init__(self, name, index, device):
+ def __init__(self, iface, name, index, device):
+ self.iface = iface
self.name = name
self.index = index
self.device = device
self.amp_chs = None
def dump_extra(self):
- str = ' Control: name="%s", index=%s, device=%s\n' % (self.name, self.index, self.device)
+ str = ' Control: %sname="%s", index=%s, device=%s\n' % (self.iface and ("iface=\"%s\", " % self.iface) or "", self.name, self.index, self.device)
if not self.amp_chs is None:
str += ' ControlAmp: chs=%s, dir=%s, idx=%s, ofs=%s\n' % (self.amp_chs, self.amp_dir, self.amp_idx, self.amp_ofs)
return str
self.add_param(PARAMS['STREAM'], tmp1)
def add_control(self, line):
+ iface = None
+ if line.find('iface=') > 0:
+ line, iface = self.decodestrw(line, 'iface=')
line, name = self.decodestrw(line, 'name=')
line, index = self.decodeintw(line, 'index=')
line, device = self.decodeintw(line, 'device=')
- self.controls.append(HDApcmControl(name, index, device))
+ self.controls.append(HDApcmControl(iface, name, index, device))
def add_controlamp(self, line):
ctl = self.controls[-1]