Add pcms function, unify arguments.

Also, fix some memory leaks in error cases
This commit is contained in:
Lars Immisch
2015-05-09 21:39:00 +02:00
parent 7e2e99d072
commit cb6fc6231c
3 changed files with 129 additions and 67 deletions
+8 -4
View File
@@ -44,7 +44,7 @@ class MixerTest(unittest.TestCase):
def testMixer(self):
"""Open the default Mixers and the Mixers on every card"""
for d in ['default'] + range(len(alsaaudio.cards())):
for d in ['default'] + list(range(len(alsaaudio.cards()))):
if type(d) == type(0):
kwargs = { 'cardindex': d }
else:
@@ -90,10 +90,14 @@ class PCMTest(unittest.TestCase):
"""Test PCM objects"""
def testPCM(self):
"Open a PCM object on every card"
"Open a PCM object on every device"
for i in range(len(alsaaudio.cards())):
pcm = alsaaudio.PCM(i)
for device in alsaaudio.pcms():
pcm = alsaaudio.PCM(device=device)
pcm.close()
for device in alsaaudio.pcms(alsaaudio.PCM_CAPTURE):
pcm = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, device=device)
pcm.close()
def testPCMAll(self):