@@ -87,8 +87,8 @@ def __init__(self,
8787
8888 self .looping_regions : list [LoopingRegion ] = []
8989
90- self .quantize_grid : Optional [float ] = None
91- self .quantize_level : Optional [float ] = None
90+ self .quantize_grid : Optional [float ] = 0.0
91+ self .quantize_level : Optional [float ] = 0.0
9292
9393 self .defaults = EventDefaults (fallback_to = timeline .defaults )
9494
@@ -873,7 +873,7 @@ def _quantize_time(self, time: float) -> float:
873873 Returns:
874874 The quantized time, in beats.
875875 """
876- if self .quantize_grid is None or self .quantize_level is None :
876+ if self .quantize_grid is None or self .quantize_level is None or self . quantize_grid == 0.0 or self . quantize_level == 0.0 :
877877 return time
878878
879879 grid = self .quantize_grid
@@ -892,6 +892,9 @@ def _on_note_on(self, note: MidiNote):
892892 #--------------------------------------------------------------------------------
893893 if self ._monitor :
894894 self .output_device .note_on (note .pitch , note .velocity , note .channel )
895+
896+ if not self .timeline .is_running :
897+ return
895898
896899 if self ._is_recording :
897900 self ._recording_notes [note .pitch ] = (self .current_time , note .velocity , note .channel )
@@ -903,6 +906,9 @@ def _on_note_off(self, note: MidiNote):
903906 if self ._monitor :
904907 self .output_device .note_off (note .pitch , note .channel )
905908
909+ if not self .timeline .is_running :
910+ return
911+
906912 if note .pitch in self ._recording_notes :
907913 start_time , velocity , channel = self ._recording_notes .pop (note .pitch )
908914 end_time = self .current_time
0 commit comments