(self)
Sends message on the qpm interval until stop signal received.
Sends message on the qpm interval until stop signal received.
Sends message on the qpm interval until stop signal received .
def run(self):
    """Sends message on the qpm interval until stop signal received."""
    sleeper = concurrency.Sleeper()
    while True:
      now = time.time()
      tick_number = max(0, int((now - self._start_time) // self._period) + 1)
      tick_time = tick_number * self._period + self._start_time

      if self._stop_time is not None and self._stop_time < tick_time:
        break

      sleeper.sleep_until(tick_time)

      metric_position = tick_number % len(self._messages)
      tick_message = self._messages[metric_position]

      if tick_message is None:
        continue

      tick_message.channel = self._channel
      self._outport.send(tick_message)

      if tick_message.type == 'note_on':
        sleeper.sleep(self._duration)
        end_tick_message = mido.Message(
            'note_off', note=tick_message.note, channel=self._channel)
        self._outport.send(end_tick_message)
def run ( self ) : sleeper = concurrency . Sleeper ( ) while True : now = time . time ( ) tick_number = max ( 0 , int ( ( now - self . _start_time ) // self . _period ) + 1 ) tick_time = tick_number * self . _period + self . _start_time if self . _stop_time is not None and self . _stop_time < tick_time : break sleeper . sleep_until ( tick_time ) metric_position = tick_number % len ( self . _messages ) tick_message = self . _messages [ metric_position ] if tick_message is None : continue tick_message . channel = self . _channel self . _outport . send ( tick_message ) if tick_message . type == 'note_on' : sleeper . sleep ( self . _duration ) end_tick_message = mido . Message ( 'note_off' , note = tick_message . note , channel = self . _channel ) self . _outport . send ( end_tick_message )