def get_sampling_rate(self): in_rate = AvcConnection.get_plug_signal_format(self.unit.fcp, 'input', 0) out_rate = AvcConnection.get_plug_signal_format( self.unit.fcp, 'output', 0) if in_rate != out_rate: raise OSError('Unexpected state of the unit: {0}!={1}'.format( in_rate, out_rate)) return in_rate
def set_16bit_mode(self, target): if target != 'none': rate = AvcConnection.get_plug_signal_format(self.fcp, 'output', 0) if rate not in (44100, 48000): raise ValueError('Sampling rate should be 44100 or 48000.') HwCmd.set_16bit_mode(self.__cache, self.fcp, target) self.__save_cache()
def get_supported_sampling_rates(self): rate = AvcConnection.get_plug_signal_format(self.fcp, 'input', 0) for mode, rates in self._RATE_MODES.items(): if rate in rates and mode in self._caps['rate-modes']: break else: raise OSError('Invalid state for sampling rate.') return rates
def set_cd_mode(self, enable): if enable: if self.__cache['hw']['16bit'] != 'spdif-coax-out-1/2': raise ValueError('16bit-mode should be spdif-coax-out-1/2.') rate = AvcConnection.get_plug_signal_format(self.fcp, 'output', 0) if rate != 44100: raise ValueError('Sampling rate should be 44100.') HwCmd.set_cd_mode(self.__cache, self.fcp, enable) self.__save_cache()
def set_sampling_rate(self, rate): if self.get_property('streaming'): raise OSError('Packet streaming starts') curr_rate = AvcConnection.get_plug_signal_format(self.fcp, 'input', 0) for mode, rates in self._RATE_MODES.items(): if curr_rate in rates: break else: raise OSError('Invalid state for sampling rate.') if rate not in rates: raise ValueError('Invalid argument for sampling rate.') AvcConnection.set_plug_signal_format(self.fcp, 'input', 0, rate) AvcConnection.set_plug_signal_format(self.fcp, 'output', 0, rate)
def get_sampling_rate(self): # Current rate is correctly returned from a plug 0 for output direction # only. return AvcConnection.get_plug_signal_format(self.unit.fcp, 'output', 0)
def get_sampling_rate(self): in_rate = AvcConnection.get_plug_signal_format(self.fcp, 'input', 0) out_rate = AvcConnection.get_plug_signal_format(self.fcp, 'output', 0) if in_rate != out_rate: raise OSError('Sampling rate mismatch: ', in_rate, out_rate) return in_rate
def get_sampling_rate(self): return AvcConnection.get_plug_signal_format(self.fcp, 'output', 0)