(self, end_time=None)
return current_captured_sequence
Returns a copy of the current captured sequence.

    If called before the thread terminates, `end_time` is required and any open
    notes will have their end time set to it, any notes starting after it will
    be removed, and any notes ending after it will be truncated. `total_time`
    will also be set to `end_time`.

    Args:
      end_time: The float time in seconds to close any open notes and after
          which to close or truncate notes, if the thread is still alive.
          Otherwise, must be None.

    Returns:
      A copy of the current captured NoteSequence proto with open notes closed
      at and later notes removed or truncated to `end_time`.

    Raises:
      MidiHubError: When the thread is alive and `end_time` is None or the
         thread is terminated and `end_time` is not None.
Returns a copy of the current captured sequence.
Returns a copy of the current captured sequence .
def captured_sequence(self, end_time=None):
    """Returns a copy of the current captured sequence.

    If called before the thread terminates, `end_time` is required and any open
    notes will have their end time set to it, any notes starting after it will
    be removed, and any notes ending after it will be truncated. `total_time`
    will also be set to `end_time`.

    Args:
      end_time: The float time in seconds to close any open notes and after
          which to close or truncate notes, if the thread is still alive.
          Otherwise, must be None.

    Returns:
      A copy of the current captured NoteSequence proto with open notes closed
      at and later notes removed or truncated to `end_time`.

    Raises:
      MidiHubError: When the thread is alive and `end_time` is None or the
         thread is terminated and `end_time` is not None.
    """
    # Make a copy of the sequence currently being captured.
    current_captured_sequence = music_pb2.NoteSequence()
    with self._lock:
      current_captured_sequence.CopyFrom(self._captured_sequence)

    if self.is_alive():
      if end_time is None:
        raise MidiHubError(
            '`end_time` must be provided when capture thread is still running.')
      for i, note in enumerate(current_captured_sequence.notes):
        if note.start_time >= end_time:
          del current_captured_sequence.notes[i:]
          break
        if not note.end_time or note.end_time > end_time:
          note.end_time = end_time
      current_captured_sequence.total_time = end_time
    elif end_time is not None:
      raise MidiHubError(
          '`end_time` must not be provided when capture is complete.')

    return current_captured_sequence
def captured_sequence ( self , end_time = None ) : # Make a copy of the sequence currently being captured. current_captured_sequence = music_pb2 . NoteSequence ( ) with self . _lock : current_captured_sequence . CopyFrom ( self . _captured_sequence ) if self . is_alive ( ) : if end_time is None : raise MidiHubError ( '`end_time` must be provided when capture thread is still running.' ) for i , note in enumerate ( current_captured_sequence . notes ) : if note . start_time >= end_time : del current_captured_sequence . notes [ i : ] break if not note . end_time or note . end_time > end_time : note . end_time = end_time current_captured_sequence . total_time = end_time elif end_time is not None : raise MidiHubError ( '`end_time` must not be provided when capture is complete.' ) return current_captured_sequence