Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a bug found by the tests

  • Loading branch information...
commit f9e5518e8bec1e9e9e39d77b034f05da94c00e03 1 parent 88803ab
@ppaez authored
Showing with 36 additions and 2 deletions.
  1. +2 −2 alsamidi.py
  2. +34 −0 test_alsamidi.py
View
4 alsamidi.py
@@ -95,7 +95,7 @@ def pitchbendevent( ch, value, start = -1 ):
if start < 0:
return ( alsaseq.SND_SEQ_EVENT_PITCHBEND, alsaseq.SND_SEQ_TIME_STAMP_REAL,
- 0, SND_SEQ_QUEUE_DIRECT, ( start/1000, start%1000 * 1000000),
+ 0, SND_SEQ_QUEUE_DIRECT, (0, 0),
( 0, 0 ), ( 0,0 ), ( ch, 0, value ) )
else:
return ( alsaseq.SND_SEQ_EVENT_PITCHBEND, alsaseq.SND_SEQ_TIME_STAMP_REAL,
@@ -110,7 +110,7 @@ def chanpress( ch, value, start = -1 ):
if start < 0:
return ( alsaseq.SND_SEQ_EVENT_CHANPRESS, alsaseq.SND_SEQ_TIME_STAMP_REAL,
- 0, SND_SEQ_QUEUE_DIRECT, ( start/1000, start%1000 * 1000000),
+ 0, SND_SEQ_QUEUE_DIRECT, (0, 0),
( 0, 0 ), ( 0,0 ), ( ch, 0, value ) )
else:
return ( alsaseq.SND_SEQ_EVENT_CHANPRESS, alsaseq.SND_SEQ_TIME_STAMP_REAL,
View
34 test_alsamidi.py
@@ -51,6 +51,40 @@ def test_scheduled(self):
self.assertEqual(expected, pgmchangeevent(1, 9, 1000))
+class PitchbendEvent(TestCase):
+
+ def test_sent_directly(self):
+ from alsamidi import pitchbendevent
+
+ data = (1, 0, 9)
+ expected = (13, 1, 0, 253, (0, 0), (0, 0), (0, 0), data)
+ self.assertEqual(expected, pitchbendevent(1, 9))
+
+ def test_scheduled(self):
+ from alsamidi import pitchbendevent
+
+ data = (1, 0, 9)
+ expected = (13, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
+ self.assertEqual(expected, pitchbendevent(1, 9, 1000))
+
+
+class ChanPress(TestCase):
+
+ def test_sent_directly(self):
+ from alsamidi import chanpress
+
+ data = (1, 0, 9)
+ expected = (12, 1, 0, 253, (0, 0), (0, 0), (0, 0), data)
+ self.assertEqual(expected, chanpress(1, 9))
+
+ def test_scheduled(self):
+ from alsamidi import chanpress
+
+ data = (1, 0, 9)
+ expected = (12, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
+ self.assertEqual(expected, chanpress(1, 9, 1000))
+
+
class Merge(TestCase):
def test_no_tracks(self):
Please sign in to comment.
Something went wrong with that request. Please try again.