At Mon, 12 Mar 2012 14:16:31 +0100, Arvin Schnell wrote:
Hi,
please integrate the two attached patches in ALSA. The first one fixes get_volume_array of the Python bindings for mono channels (also reported as bug 5546). The second just updates one of the pyalsa tests (apparently function names changed some time ago).
Thanks, applied both patches to git tree now.
Takashi
Regards, Arvin
-- Arvin Schnell, aschnell@suse.de Senior Software Engineer, Research & Development SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Maxfeldstraße 5 90409 Nürnberg Germany [2 pyalsa-mixer.diff <text/x-patch; us-ascii (7bit)>] diff --git a/pyalsa/alsamixer.c b/pyalsa/alsamixer.c index d686f16..662a2a9 100644 --- a/pyalsa/alsamixer.c +++ b/pyalsa/alsamixer.c @@ -627,7 +627,7 @@ pyalsamixerelement_getvolumearray(struct pyalsamixerelement *pyelem, PyObject *a return NULL; res = snd_mixer_selem_get_playback_volume(pyelem->elem, SND_MIXER_SCHN_MONO, &val); if (res >= 0)
PyTuple_SetItem(t, 0, PyInt_FromLong(val));
} else { t = PyList_New(SND_MIXER_SCHN_LAST+1); if (!t)PyList_SetItem(t, 0, PyInt_FromLong(val));
@@ -658,7 +658,7 @@ pyalsamixerelement_getvolumearray(struct pyalsamixerelement *pyelem, PyObject *a return NULL; res = snd_mixer_selem_get_capture_volume(pyelem->elem, SND_MIXER_SCHN_MONO, &val); if (res >= 0)
PyTuple_SET_ITEM(t, 0, PyInt_FromLong(val));
} else { t = PyList_New(SND_MIXER_SCHN_LAST+1); if (!t)PyList_SET_ITEM(t, 0, PyInt_FromLong(val));
[3 pyalsa-test.diff <text/x-patch; us-ascii (7bit)>] diff --git a/test/mixertest2.py b/test/mixertest2.py index 24e5605..6c2d026 100755 --- a/test/mixertest2.py +++ b/test/mixertest2.py @@ -10,25 +10,25 @@ import select def parse_event_mask(events): if events == 0: return 'None'
- if events == alsamixer.EventMaskRemove:
- if events == alsamixer.event_mask_remove: return 'Removed' s = ''
- for i in alsamixer.EventMask.keys():
if events & alsamixer.EventMask[i]:
- for i in alsamixer.event_mask.keys():
return s[:-1]if events & alsamixer.event_mask[i]: s += '%s ' % i
def event_callback(element, events):
print 'CALLBACK (DEF)! [%s] %s:%i' % (parse_event_mask(events), element.name, element.index)
- print ' ', element.getVolumeTuple(), element.getSwitchTuple()
- print ' ', element.get_volume_tuple(), element.get_switch_tuple()
class MyElementEvent:
def callback(self, element, events): print 'CALLBACK (CLASS)! [%s] %s:%i' % (parse_event_mask(events), element.name, element.index)
print ' ', element.getVolumeTuple(), element.getSwitchTuple()
print ' ', element.get_volume_tuple(), element.get_switch_tuple()
mixer = alsamixer.Mixer() @@ -36,13 +36,13 @@ mixer.attach() mixer.load()
element1 = alsamixer.Element(mixer, "Front") -element1.setCallback(event_callback) +element1.set_callback(event_callback) element2 = alsamixer.Element(mixer, "PCM") -element2.setCallback(MyElementEvent()) +element2.set_callback(MyElementEvent())
poller = select.poll() -mixer.registerPoll(poller) +mixer.register_poll(poller) while True: poller.poll() print 'Poll OK!'
- mixer.handleEvents()
- mixer.handle_events()
[4 <text/plain; us-ascii (7bit)>] _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel