File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -783,7 +783,7 @@ def parse(source):
783
783
return event
784
784
785
785
def __str__ (self ):
786
- return type (self ).__name__
786
+ return _name_to_desc ( type (self ).__name__ )
787
787
788
788
789
789
class ChannelEvent (Event ):
@@ -1628,6 +1628,19 @@ def _var_int_bytes(value):
1628
1628
return bytes (array )
1629
1629
1630
1630
1631
+ def _name_to_desc (name ):
1632
+ """Convert a name (e.g.: 'NoteOn') to a description (e.g.: 'Note On')."""
1633
+ if len (name ) < 1 :
1634
+ return ''
1635
+ desc = list ()
1636
+ desc .append (name [0 ])
1637
+ for index in range (1 , len (name )):
1638
+ if name [index ].isupper ():
1639
+ desc .append (' ' )
1640
+ desc .append (name [index ])
1641
+ return '' .join (desc )
1642
+
1643
+
1631
1644
class MIDIError (Exception ):
1632
1645
"""
1633
1646
An exception raised when parsing fails or at an illegal operation.
You can’t perform that action at this time.
0 commit comments