All of lore.kernel.org
 help / color / mirror / Atom feed
* Two patches for Python bindings
@ 2012-03-12 13:16 Arvin Schnell
  2012-03-12 13:59 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Arvin Schnell @ 2012-03-12 13:16 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

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).

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

[-- Attachment #2: pyalsa-mixer.diff --]
[-- Type: text/x-patch, Size: 918 bytes --]

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));
+				PyList_SetItem(t, 0, PyInt_FromLong(val));
 		} else {
 			t = PyList_New(SND_MIXER_SCHN_LAST+1);
 			if (!t)
@@ -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));
+				PyList_SET_ITEM(t, 0, PyInt_FromLong(val));
 		} else {
 			t = PyList_New(SND_MIXER_SCHN_LAST+1);
 			if (!t)

[-- Attachment #3: pyalsa-test.diff --]
[-- Type: text/x-patch, Size: 1622 bytes --]

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():
+		if events & alsamixer.event_mask[i]:
 			s += '%s ' % i
 	return s[:-1]
 
 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()

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-12 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-12 13:16 Two patches for Python bindings Arvin Schnell
2012-03-12 13:59 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.