def _get_state(self, op, fb, ch):
     if op == "volume":
         return AvcAudio.get_feature_volume_state(self.fcp, 0, "current", fb, ch)
     elif op == "mute":
         return AvcAudio.get_feature_mute_state(self.fcp, 0, "current", fb, ch)
     else:
         raise ValueError("Invalid argument for channel operation")
 def set_input_level(self, level):
     if len(self._input_level_labels) == 0:
         raise OSError("Not supported")
     if level not in self._input_level_labels:
         raise ValueError("Invalid argument for input level.")
     value = self._input_level_labels[level]
     AvcAudio.set_feature_volume_state(self.fcp, 0, "current", 2, 0, value)
 def set_output_source(self, output, source):
     if output not in self._output_sink_labels:
         raise ValueError("Invalid argument for output")
     if source not in self._output_sources:
         raise ValueError("Invalid argument for output source")
     fb = self._output_sink_fbs[self._output_sink_labels.index(output)]
     ch = self._output_sources[source]
     AvcAudio.set_selector_state(self.fcp, 0, "current", fb, ch)
Beispiel #4
0
 def set_output_source(self, target, source):
     index = self._refer_out_data(target)
     if source in self._labels[self._id]['mixers'][index]:
         value = 0
     elif source.find('aux') == 0:
         value = 1
     else:
         raise ValueError('Invalid argument for output target')
     fb = self._output_sources[self._id][index]
     AvcAudio.set_selector_state(self.fcp, 0, 'current', fb, value)
Beispiel #5
0
 def set_headphone_source(self, target, source):
     index = self._refer_hp_data(target)
     if source in self._labels[self._id]['mixers']:
         ch = self._labels[self._id]['mixers'].index(source)
     elif source.find('aux') == 0:
         ch = len(self._labels[self._id]['mixers'])
     else:
         raise ValueError('Invalid argument for output target')
     fb = self._hp_sources[self._id][index][0]
     value = self._hp_sources[self._id][index][1][ch]
     AvcAudio.set_selector_state(self.fcp, 0, 'current', fb, value)
Beispiel #6
0
 def get_output_source(self, target):
     index = self._refer_out_data(target)
     fb = self._output_sources[self._id][index]
     value = AvcAudio.get_selector_state(self.fcp, 0, 'current', fb)
     if value == 1 and self._aux_output[self._id]:
         return 'aux-1/2'
     return self._labels[self._id]['mixers'][index]
Beispiel #7
0
 def get_headphone_source(self, target):
     index = self._refer_hp_data(target)
     fb = self._hp_sources[self._id][index][0]
     value = AvcAudio.get_selector_state(self.fcp, 0, 'current', fb)
     ch = self._hp_sources[self._id][index][1][value]
     if ch < len(self._labels[self._id]['mixers']):
         return self._labels[self._id]['mixers'][ch]
     return 'aux-1/2'
 def get_input_level(self):
     if len(self._input_level_labels) == 0:
         raise OSError("Not supported")
     level = AvcAudio.get_feature_volume_state(self.fcp, 0, "current", 2, 0)
     for name, value in self._input_level_labels.items():
         if value == level:
             return name
     else:
         raise OSError("Unexpected value for input level")
 def get_output_source(self, output):
     if output not in self._output_sink_labels:
         raise ValueError("Invalid argument for output")
     fb = self._output_sink_fbs[self._output_sink_labels.index(output)]
     idx = AvcAudio.get_selector_state(self.fcp, 0, "current", fb)
     for name, value in self._output_sources.items():
         if value == idx:
             return name
     else:
         raise ValueError("Unexpected value for output source.")
Beispiel #10
0
        self.listen()

    # 0x0000ffff - 0x7fffffff
    # db = 20 * log10(vol / 0x80000000)
    # vol = 0, then db = -144.0
    #
    # fw410: 19
    # audiophile: 15
    def get_metering(self):
        return self.read_transact(0xffc700600000, 15)

unit = BebobMaudio(card)

for i in range(1, 8):
    try:
        print(i, AvcAudio.get_selector_state(unit, 0, 'current', i))
    except Exception as e:
        print(e)

for i in range(1, 16):
    try:
        print(i, AvcAudio.get_feature_mute_state(unit, 0, 'current', i, 0))
    except Exception as e:
        print(e)

for i in range(1, 16):
    try:
        print(i, AvcAudio.get_feature_volume_state(unit, 0, 'current', i, 0))
    except Exception as e:
        print(e)
Beispiel #11
0
 def _get_volume(self, targets, index, ch):
     fb, ch = self._refer_fb_data(targets, index, ch)
     return AvcAudio.get_feature_volume_state(self.fcp, 0, 'current', fb, ch)
Beispiel #12
0
 def get_aux_master_volume(self, ch):
     if ch > 2:
         raise ValueError('Invalid argument for master channel')
     fb = self._aux_output[self._id]
     return AvcAudio.get_feature_volume_state(self.fcp, 0, 'current', fb, ch)
 def get_clock_source(self):
     state = AvcAudio.get_selector_state(self.fcp, 0, "current", 4)
     return self.supported_clock_sources[state]
 def set_clock_source(self, source):
     if self.supported_clock_sources.count(source) == 0:
         raise ValueError("Invalid argument for clock source")
     val = self.supported_clock_sources.index(source)
     AvcAudio.set_selector_state(self.fcp, 0, "current", 4, val)
Beispiel #15
0
 def set_mixer_routing(self, source, sink, value):
     in_fb, in_ch, out_fb, out_ch = self._refer_mixer_data(source, sink)
     AvcAudio.set_processing_mixer_state(self.fcp, 0, 'current',
                                         out_fb, in_fb, in_ch, out_ch, value)
Beispiel #16
0
    # 0x0000ffff - 0x7fffffff
    # db = 20 * log10(vol / 0x80000000)
    # vol = 0, then db = -144.0
    #
    # fw410: 19
    # audiophile: 15
    def get_metering(self):
        return self.read_transact(0xffc700600000, 15)


unit = BebobMaudio(card)

for i in range(1, 8):
    try:
        print(i, AvcAudio.get_selector_state(unit, 0, 'current', i))
    except Exception as e:
        print(e)

for i in range(1, 16):
    try:
        print(i, AvcAudio.get_feature_mute_state(unit, 0, 'current', i, 0))
    except Exception as e:
        print(e)

for i in range(1, 16):
    try:
        print(i, AvcAudio.get_feature_volume_state(unit, 0, 'current', i, 0))
    except Exception as e:
        print(e)
Beispiel #17
0
 def _set_volume(self, targets, index, ch, value):
     fb, ch = self._refer_fb_data(targets, index, ch)
     AvcAudio.set_feature_volume_state(self.fcp, 0, 'current', fb, ch, value)
Beispiel #18
0
 def get_mixer_routing(self, source, sink):
     in_fb, in_ch, out_fb, out_ch = self._refer_mixer_data(source, sink)
     return AvcAudio.get_processing_mixer_state(self.fcp, 0, 'current',
                                         out_fb, in_fb, in_ch, out_ch)