Skip to content

Commit 5b3631a

Browse files
committed
MIDI examples: use with-statement
1 parent 14b43b9 commit 5b3631a

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

‎examples/midi_chords.py‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ def callback(frames, userdata):
3434
return jack.CALL_AGAIN
3535

3636
client.set_process_callback(callback)
37-
client.activate()
3837

39-
print("#" * 80)
40-
print("press Return to quit")
41-
print("#" * 80)
42-
input()
43-
client.close()
38+
with client:
39+
print("#" * 80)
40+
print("press Return to quit")
41+
print("#" * 80)
42+
input()

‎examples/midi_monitor.py‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ def callback(frames, userdata):
1616
return jack.CALL_AGAIN
1717

1818
client.set_process_callback(callback)
19-
client.activate()
2019

21-
print("#" * 80)
22-
print("press Return to quit")
23-
print("#" * 80)
24-
input()
25-
client.close()
20+
with client:
21+
print("#" * 80)
22+
print("press Return to quit")
23+
print("#" * 80)
24+
input()

0 commit comments

Comments
 (0)