本文整理汇总了Python中ta1394.general.AvcGeneral类的典型用法代码示例。如果您正苦于以下问题:Python AvcGeneral类的具体用法?Python AvcGeneral怎么用?Python AvcGeneral使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AvcGeneral类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: set_processing_mixer_state
def set_processing_mixer_state(unit, subunit_id, attr, fb_id, in_fb,
in_ch, out_ch, setting):
attrs = ('current', 'minimum', 'maximum', 'resolution', 'default')
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attrs.count(attr) == 0:
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if in_fb > 255:
raise ValueError('Invalid argument for input function block ID')
if in_ch > 255:
raise ValueError('Invalid argument for input channel number')
if out_ch > 255:
raise ValueError('Invalid argument for output channel number')
args = bytearray()
args.append(0x00)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x82) # Processing function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x04) # Selector length is 4
args.append(in_fb)
args.append(in_ch)
args.append(out_ch)
args.append(0x03) # Mixer control
args.append(0x02) # Control data is 2
args.append(setting >> 8) # Higher part of setting
args.append(setting & 0xff) # Lower part of setting
AvcGeneral.command_control(unit, args)
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:31,代码来源:audio.py
示例2: set_digital_channel_status
def set_digital_channel_status(cls, fcp, spec, name, values):
if spec is 'con':
attrs = BcoVendorDependent.supported_con_status
subcmds = BcoVendorDependent._con_subcmds
elif spec is 'pro':
attrs = BcoVendorDependent.supported_pro_status
subcmds = BcoVendorDependent._pro_subcmds
else:
raise ValueError('Invalid argument for specification name')
if name not in attrs:
raise ValueError('Invalid argument for attribute name')
if attrs[name] != 1:
if type(values) is not 'list' or len(values) != attrs[name]:
raise ValueError('Invalid argument for attribute value length')
args = bytearray(0xff for i in range(10))
args[0] = 0x00
args[1] = 0xff
args[2] = 0x00
args[3] = BcoVendorDependent.supported_spec.index(spec)
args[4] = subcmds[name]
args[5] = attrs[name]
if attrs[name] == 1:
args[6] = values
else:
for i in range(len(values)):
args[6 + i] = values[i]
AvcGeneral.command_control(fcp, args)
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:27,代码来源:extensions.py
示例3: set_processing_mixer_state_all
def set_processing_mixer_state_all(unit, subunit_id, attr, fb_id, in_fb,
states):
attrs = ('current', 'minimum', 'maximum', 'resolution', 'default')
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attrs.count(attr) == 0:
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if in_fb > 255:
raise ValueError('Invalid argument for input function block ID')
data_count = len(states) // 2
args = bytearray()
args.append(0x00)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x82) # Processing function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x04) # Selector length is 4
args.append(in_fb)
args.append(0xff)
args.append(0xff)
args.append(0x03) # Mixer control
args.append(data_count) # The length of control data
for i in range(data_count):
args.append((states[i * 2] << 8) | states[i * 2 + 1])
AvcGeneral.command_control(unit, args)
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:28,代码来源:audio.py
示例4: set_feature_mute_state
def set_feature_mute_state(unit, subunit_id, attr, fb_id, ch, mute):
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attr is not 'current':
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if ch > 255:
raise ValueError('Invalid argument for channel number')
if mute:
mute = 0x70
else:
mute = 0x80
args = bytearray()
args.append(0x00)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x81) # Feature function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x02) # Selector length is 2
args.append(ch)
args.append(0x01) # Mute control
args.append(0x01) # Control data length is 1
args.append(mute)
AvcGeneral.command_control(unit, args)
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:26,代码来源:audio.py
示例5: command_set_param
def command_set_param(self, cmd, param):
deps = bytearray()
deps.append(0x46)
deps.append(0x49)
deps.append(0x31)
deps.append(cmd)
deps.append(param)
AvcGeneral.set_vendor_dependent(unit, self.company_ids, deps)
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:8,代码来源:fireone.py
示例6: ask_signal_source
def ask_signal_source(cls, fcp, src, dst):
args = bytearray()
args.append(0x02)
args.append(0xff)
args.append(0x1a)
args.append(0xff)
args.append(src[0])
args.append(src[1])
args.append(dst[0])
args.append(dst[1])
AvcGeneral.command_inquire(fcp, args)
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:11,代码来源:ccm.py
示例7: command_set_param
def command_set_param(self, cmd, param):
deps = bytearray()
deps.append(0x46)
deps.append(0x49)
deps.append(0x31)
deps.append(cmd)
deps.append(param)
try:
AvcGeneral.set_vendor_dependent(self.fcp, self.company_ids, deps)
except Exception as e:
if str(e) != 'Unknown status':
raise e
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:12,代码来源:tascam_fireone.py
示例8: set_format
def set_format(cls, fcp, direction, plug, fmt):
args = bytearray()
args.append(0x00) # Control
args.append(0xff) # Addressing to unit
args.append(0xbf) # Extended stream format information command
args.append(0xc0) # SINGLE subfunction
args.append(cls.plug_direction.index(direction))
args.append(0x00)
args.append(0x00)
args.append(plug)
args.append(0xff)
args.append(0xff)
args.extend(cls._build_format(fmt))
AvcGeneral.command_control(fcp, args)
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:14,代码来源:streamformat.py
示例9: get_formats
def get_formats(unit, direction, plug):
if AvcGeneral.plug_direction.count(direction) == 0:
raise ValueError('Invalid argument for plug direction')
if plug > 255:
raise ValueError('Invalid argument for plug number')
fmts = []
args = bytearray()
args.append(0x01)
args.append(0xff)
args.append(0xbf)
args.append(0xc1)
args.append(AvcGeneral.plug_direction.index(direction))
args.append(0x00)
args.append(0x00)
args.append(plug)
args.append(0xff)
args.append(0xff)
args.append(0x00)
args.append(0xff)
for i in range(255):
args[10] = i
try:
fmt = AvcGeneral.command_status(unit, args)
fmts.append(fmt)
except:
break
return fmts
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:27,代码来源:streamformat.py
示例10: get_plug_clusters
def get_plug_clusters(unit, addr):
if addr[1] != BcoPlugInfo.addr_mode.index('unit') or \
addr[2] != BcoPlugInfo.addr_unit_type.index('isoc'):
raise ValueError('Isochronous unit plugs just support this')
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x03) # Info type is 'channel position data'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(unit, args)
data = params[10:]
pos = 0
clusters = [[] for i in range(data[pos])]
pos += 1
for cls in range(len(clusters)):
num = data[pos]
pos += 1
if num == 0:
break;
clusters[cls] = [[0, 0] for j in range(num)]
for e in range(len(clusters[cls])):
clusters[cls][e][0] = data[pos];
clusters[cls][e][1] = data[pos + 1];
pos += 2
return clusters
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:34,代码来源:extensions.py
示例11: get_entry_list
def get_entry_list(cls, fcp, addr):
fmts = []
for i in range(0xff):
# DM1500 tends to cause timeout.
time.sleep(0.1)
try:
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x2f) # Bco stream format support
args.append(0xc1) # List request
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0xff)
args.append(i)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
fmts.append(cls._parse_format(params[11:]))
except OSError as e:
if str(e) != 'Rejected':
raise
else:
break
return fmts
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:27,代码来源:extensions.py
示例12: get_feature_mute_state
def get_feature_mute_state(unit, subunit_id, attr, fb_id, ch):
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attr is not 'current':
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if ch > 255:
raise ValueError('Invalid argument for channel number')
args = bytearray()
args.append(0x01)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x81) # Feature function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x02) # Selector length is 2
args.append(ch)
args.append(0x01) # Mute control
args.append(0x01) # Control data length is 1
args.append(0xff) # Status
params = AvcGeneral.command_status(unit, args)
if params[10] == 0x70:
return True
elif params[10] == 0x60:
return False
else:
raise OSError('Unexpected value in response')
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:28,代码来源:audio.py
示例13: get_processing_mixer_state_all
def get_processing_mixer_state_all(unit, subunit_id, attr, fb_id, in_fb):
attrs = ('current', 'minimum', 'maximum', 'resolution', 'default')
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attrs.count(attr) == 0:
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if in_fb > 255:
raise ValueError('Invalid argument for input function block ID')
args = bytearray()
args.append(0x01)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x82) # Processing function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x04) # Selector length is 4
args.append(in_fb)
args.append(0xff)
args.append(0xff)
args.append(0x03) # Mixer control
args.append(0xff) # The length of control data in response
params = AvcGeneral.command_status(unit, args)
count = params[11] // 2
status = []
for i in range(count):
status.append((params[12 + i * 2] << 8) | params[13 + i * 2])
return status
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:29,代码来源:audio.py
示例14: get_plug_clusters
def get_plug_clusters(cls, fcp, addr):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x03) # Info type is 'channel position data'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
data = params[10:]
pos = 0
clusters = [[] for i in range(data[pos])]
pos += 1
for cls in range(len(clusters)):
num = data[pos]
pos += 1
if num == 0:
break;
clusters[cls] = [[0, 0] for j in range(num)]
for e in range(len(clusters[cls])):
clusters[cls][e][0] = data[pos];
clusters[cls][e][1] = data[pos + 1];
pos += 2
return clusters
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:31,代码来源:extensions.py
示例15: __init__
def __init__(self, path):
super().__init__(path)
for quad in self.get_config_rom():
# Vendor ID
if quad >> 24 == 0x03:
vendor_id = quad & 0x00FFFFFF
continue
# Model ID
if quad >> 24 == 0x17:
model_id = quad & 0x00FFFFFF
break
else:
raise ValueError("Invalid argument for Yamaha/Terratec unit")
# Check vendor ID for Yamaha/Terratec OUI
if vendor_id != 0x00A0DE and vendor_id != 0x000AAC:
raise ValueError("Invalid argument for Yamaha/Terratec unit")
# Yamaha GO 44 or Terratec Phase 24 FW
if model_id == 0x10000B or model_id == 0x000005:
self.name = "GO44"
self._output_sink_labels = ("analog-1/2", "headphone-1/2", "digital-1/2")
self._mixer_output_fb = 1
self._input_level_labels = {"low": 0xF400, "middle": 0xFD00, "high": 0x0000}
self._output_labels = ()
# Yamaha GO 46 or Terratec Phase X24 FW
elif model_id == 0x10000C or model_id == 0x000007:
self.name = "GO46"
self._output_sink_labels = ("analog-1/2", "analog-3/4", "digital-1/2")
self._mixer_output_fb = 2
self._output_fb = 1
self._input_level_labels = {}
self._output_labels = ("analog-1/2", "analog-3/4")
else:
raise ValueError("Invalid argument for Yamaha/Terratec unit")
unit_info = AvcGeneral.get_unit_info(self.fcp)
self._company_ids = unit_info["company-id"]
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:35,代码来源:yamaha_terratec.py
示例16: command_get_param
def command_get_param(self, cmd):
deps = bytearray()
deps.append(0x46)
deps.append(0x49)
deps.append(0x31)
deps.append(cmd)
deps.append(0xff)
params = AvcGeneral.get_vendor_dependent(unit, self.company_ids, deps)
return params[4]
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:9,代码来源:fireone.py
示例17: set_selector_state
def set_selector_state(unit, subunit_id, attr, fb_id, value):
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if ('current', 'minimum', 'maximum', 'default').count(attr) == 0:
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if value > 255:
raise ValueError('Invalid argument for selector value')
args = bytearray()
args.append(0x00)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x80) # Selector function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attribute])
args.append(0x02) # Selector length is 2
args.append(value)
args.append(0x01) # Selector control
AvcGeneral.command_control(unit, args)
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:20,代码来源:audio.py
示例18: set_signal_source
def set_signal_source(cls, fcp, src, dst):
args = bytearray()
args.append(0x00)
args.append(0xff)
args.append(0x1a)
args.append(0x0f)
args.append(src[0])
args.append(src[1])
args.append(dst[0])
args.append(dst[1])
return AvcGeneral.command_control(fcp, args)
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:11,代码来源:ccm.py
示例19: set_signal_souarce
def set_signal_souarce(unit, src, dst):
args = bytearray()
args.append(0x01)
args.append(0xff)
args.append(0x1a)
args.append(0x0f)
args.append(src[0])
args.append(src[1])
args.append(dst[0])
args.append(dst[1])
return AvcGeneral.command_control(unit, args)
开发者ID:EMATech,项目名称:hinawa-utils,代码行数:11,代码来源:ccm.py
示例20: __init__
def __init__(self, path):
super().__init__(path)
model_id = -1
for quad in self.get_config_rom():
if quad >> 24 == 0x17:
model_id = quad & 0x00ffffff
self._id = self._ids[model_id][0]
info = AvcGeneral.get_unit_info(self.fcp)
self._company_ids = info['company-id']
if model_id < 0:
raise OSError('Not supported')
开发者ID:takaswie,项目名称:hinawa-utils,代码行数:11,代码来源:maudio_normal.py
注:本文中的ta1394.general.AvcGeneral类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论