def get_headphone_source(self, target):
        if target not in self.get_headphone_labels():
            raise ValueError('Invalid argument for headphone')

        state = AvcAudio.get_selector_state(self.unit.fcp, 0, 'current',
                                            self.__SELECTOR_FB)
        if state == 0x01:
            return 'aux-1/2'
        elif state == 0x00:
            for i, elems in enumerate(self.mixers):
                in_ch = elems[1][0]
                data = AvcAudio.get_processing_mixer_state(
                    self.unit.fcp, 0, 'current', self.__PROCESSING_OUT_FB,
                    self.__PROCESSING_IN_FB, in_ch, self.__PROCESSING_OUT_CH)
                if data[0] == 0x00 and data[1] == 0x00:
                    return self.labels['mixers'][i]

        # No sources are set. For convenience, set 'mixer-1/2'.
        self.set_headphone_source('headphone-1/2', 'mixer-1/2')
        return 'mixer-1/2'
Пример #2
0
 def get_mixer_routing(self, target, source):
     in_fb, in_ch, out_fb, out_ch = self._refer_mixer_data(target, source)
     data = AvcAudio.get_processing_mixer_state(self.unit.fcp, 0, 'current',
                                                out_fb, in_fb, in_ch,
                                                out_ch)
     return data[0] == 0x00 and data[1] == 0x00