Пример #1
0
    def HasAudioSupport(self, port_id):
        """Returns true if the port has audio support.

    Args:
      port_id: The ID of the input/output port.

    Returns:
      True if the input/output port has audio support; otherwise, False.
    """
        return ids.IsAudioPort(port_id)
Пример #2
0
 def wrapper(instance, port_id, *args, **kwargs):
     if not ids.IsAudioPort(port_id):
         raise FlowManagerError(
             'Not a valid port_id for audio operation: %d' % port_id)
     if input_only and not ids.IsInputPort(port_id):
         raise FlowManagerError(
             'Not a valid port_id for input operation: %d' % port_id)
     elif output_only and not ids.IsOutputPort(port_id):
         raise FlowManagerError(
             'Not a valid port_id for output operation: %d' % port_id)
     return func(instance, port_id, *args, **kwargs)
Пример #3
0
    def StartPlayingEcho(self, port_id, input_id):
        """Echoes audio data received from input_id and plays to port_id.

    Echoes audio data received from input_id and plays to port_id.

    Chameleon does not support echoing from HDMI and capturing from LineIn/Mic
    at the same time. The echoing/capturing needs to be stop first before
    another action starts.

    For example, user can call

    StartPlayingEcho(3, 7) --> StopPlayingAudio(3) --> StartCapturingAudio(6)

    or

    StartCapturingAudio(6) --> StopCapturingAudio(6) --> StartPlayingEcho(3, 7)

    but user can not call

    StartPlayingEcho(3, 7) --> StartCapturingAudio(6)

    or

    StartCapturingAudio(6) --> StartPlayingEcho(3, 7)

    Exception is raised when conflicting actions are performed.

    Args:
      port_id: The ID of the output connector. Check the value in ids.py.
      input_id: The ID of the input connector. Check the value in ids.py.

    Raises:
      FlowManagerError: input_id is not valid for audio operation.
    """
        if not ids.IsAudioPort(input_id) or not ids.IsInputPort(input_id):
            raise FlowManagerError(
                'Not a valid input_id for audio operation: %d' % input_id)
        self.SelectInput(input_id)
        self.SelectOutput(port_id)
        logging.info(
            'Start playing echo from port #%d using source from port#%d',
            port_id, input_id)
        self.flows[port_id].StartPlayingEcho(input_id)