(self, block=True)
Signals for the playback to stop and ends all open notes.

    Args:
      block: If true, blocks until thread terminates.
Signals for the playback to stop and ends all open notes.
Signals for the playback to stop and ends all open notes .
def stop(self, block=True):
    """Signals for the playback to stop and ends all open notes.

    Args:
      block: If true, blocks until thread terminates.
    """
    with self._lock:
      if not self._stop_signal.is_set():
        self._stop_signal.set()
        self._allow_updates = False

        # Replace message queue with immediate end of open notes.
        self._message_queue.clear()
        for note in self._open_notes:
          self._message_queue.append(
              mido.Message(type='note_off', note=note, time=time.time()))
        self._update_cv.notify()
    if block:
      self.join()
def stop ( self , block = True ) : with self . _lock : if not self . _stop_signal . is_set ( ) : self . _stop_signal . set ( ) self . _allow_updates = False # Replace message queue with immediate end of open notes. self . _message_queue . clear ( ) for note in self . _open_notes : self . _message_queue . append ( mido . Message ( type = 'note_off' , note = note , time = time . time ( ) ) ) self . _update_cv . notify ( ) if block : self . join ( )