All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvin Schnell <aschnell@suse.de>
To: alsa-devel@alsa-project.org
Subject: Two patches for Python bindings
Date: Mon, 12 Mar 2012 14:16:31 +0100	[thread overview]
Message-ID: <20120312131631.GA15612@suse.de> (raw)

[-- 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 --]



             reply	other threads:[~2012-03-12 13:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 13:16 Arvin Schnell [this message]
2012-03-12 13:59 ` Two patches for Python bindings Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120312131631.GA15612@suse.de \
    --to=aschnell@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.