本文整理汇总了Python中api.configuration_api.ConfigurationAPI.set_audio_output_options方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationAPI.set_audio_output_options方法的具体用法?Python ConfigurationAPI.set_audio_output_options怎么用?Python ConfigurationAPI.set_audio_output_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.configuration_api.ConfigurationAPI
的用法示例。
在下文中一共展示了ConfigurationAPI.set_audio_output_options方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_audio_output_options_should_update_output_when_44100
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_audio_output_options [as 别名]
def test_set_audio_output_options_should_update_output_when_44100(self, mock_save, mock_load):
mock_load.return_value = self.default_config
capi = ConfigurationAPI(ConfigurationManager())
expected = self.default_config
expected.audio.output.modulation_on_frequency = 11025
expected.audio.output.modulation_off_frequency = 2205
expected.audio.output.bit_depth = '16 bit'
expected.audio.output.sample_rate = 44100
capi.load_printer("Printer")
actual = capi.set_audio_output_options(AudioSetting(44100, '16 bit'))
self.assertConfigurationEqual(expected, mock_save.mock_calls[0][1][0])
示例2: test_set_audio_output_options_should_update_output_when_44100
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_audio_output_options [as 别名]
def test_set_audio_output_options_should_update_output_when_44100(self, mock_save, mock_load):
config = self.DEFAULT_CONFIG.copy()
mock_load.return_value = config
capi = ConfigurationAPI(ConfigurationManager())
expected = config.copy()
expected['on_modulation_frequency'] = 11025
expected['off_modulation_frequency'] = 3675
expected['output_bit_depth'] = '16 bit'
expected['output_sample_frequency'] = 44100
capi.load_printer("Printer")
actual = capi.set_audio_output_options(AudioSetting(44100, '16 bit'))
mock_save.assert_called_with(expected)
示例3: test_set_audio_output_options_should_update_output_when_48000
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_audio_output_options [as 别名]
def test_set_audio_output_options_should_update_output_when_48000(self, mock_save, mock_load):
printer_name = 'MegaPrint'
config = self.DEFAULT_CONFIG.copy()
mock_load.return_value = config
capi = ConfigurationAPI(ConfigurationManager())
expected = config.copy()
expected['on_modulation_frequency'] = 12000
expected['off_modulation_frequency'] = 4000
expected['output_bit_depth'] = '32 bit Floating Point'
expected['output_sample_frequency'] = 48000
capi.load_printer(printer_name)
actual = capi.set_audio_output_options(AudioSetting(48000,'32 bit Floating Point'))
mock_save.assert_called_with(expected)
示例4: test_set_audio_output_options_should_update_output_when_48000
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_audio_output_options [as 别名]
def test_set_audio_output_options_should_update_output_when_48000(self, mock_save, mock_load):
printer_name = 'MegaPrint'
config = self.default_config
mock_load.return_value = config
capi = ConfigurationAPI(ConfigurationManager())
expected = self.default_config
expected.audio.output.modulation_on_frequency = 12000
expected.audio.output.modulation_off_frequency = 2000
expected.audio.output.bit_depth = '32 bit Floating Point'
expected.audio.output.sample_rate = 48000
capi.load_printer(printer_name)
actual = capi.set_audio_output_options(AudioSetting(48000,'32 bit Floating Point'))
self.assertConfigurationEqual(expected, mock_save.mock_calls[0][1][0])
示例5: SetupAudioUI
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_audio_output_options [as 别名]
class SetupAudioUI(PeachyFrame):
def initialize(self):
self.grid()
self._current_printer = self.kwargs['printer']
self._configuration_api = ConfigurationAPI(self._configuration_manager)
self._configuration_api.load_printer(self._current_printer)
audio_options = self._configuration_api.get_available_audio_options()
self._input_options = dict([ (str(option), option) for option in audio_options['inputs']])
self._output_options = dict([ (str(option), option) for option in audio_options['outputs']])
if (len(self._input_options) < 1 or len(self._output_options) < 1):
logging.error("No inputs available")
tkMessageBox.showwarning('Error','Audio card appears to not be setup correctly, Have you plugged in your dripper and printer?')
self._back()
return
self._input_audio_selection_current = StringVar()
self._input_audio_selection_current.set(self._currently_selected(self._input_options))
self._output_options = dict([ (str(option), option) for option in audio_options['outputs']])
self._output_audio_selection_current = StringVar()
self._output_audio_selection_current.set(self._currently_selected(self._output_options))
Label(self, text = 'Printer: ').grid(column=0,row=10)
Label(self, text = self._configuration_api.current_printer()).grid(column=1,row=10)
Button(self, text='?', command=self._help).grid(column=2, row=10,stick=N+E)
Label(self).grid(column=0,row=20)
Label(self, text = 'Selecting a format not supported by your system may result in odd behaviour').grid(column=0,row=25,columnspan=3)
Label(self).grid(column=0,row=26)
Label(self, text = "Audio Input Settings" ).grid(column=0,row=30)
OptionMenu( self, self._input_audio_selection_current, *self._input_options.keys()).grid(column=1,row=30,sticky=NSEW)
Label(self, text = "Audio Output Settings" ).grid(column=0,row=40)
OptionMenu(self, self._output_audio_selection_current, *self._output_options.keys()).grid(column=1,row=40,sticky=NSEW)
Label(self).grid(column=0,row=50)
Button(self, text ="Back", command = self._back).grid(column=0,row=60,sticky=N+S+W)
Button(self, text ="Save", command = self._save).grid(column=1,row=60,sticky=N+S+E)
self.update()
def _currently_selected(self, audio_options):
current_option = [ k for k, v in audio_options.iteritems() if v.current ]
if (len(current_option) == 0):
return audio_options[0]
else:
return current_option[0]
def _get_recommend_audio_index(self, options):
for i in range(0,len(options)):
if options[i].endswith('(Recommended)'):
return i
return 0
def _back(self):
self.navigate(SetupUI)
def _help(self):
PopUp(self,'Help', help_text.setup_audio_help)
def _save(self):
input_option = self._input_options[self._input_audio_selection_current.get()]
output_option = self._output_options[self._output_audio_selection_current.get()]
self._configuration_api.set_audio_input_options(input_option)
self._configuration_api.set_audio_output_options(output_option)
self.navigate(SetupUI)
def close(self):
pass