本文整理汇总了Python中LC2Sysex.LC2Sysex.log_message方法的典型用法代码示例。如果您正苦于以下问题:Python LC2Sysex.log_message方法的具体用法?Python LC2Sysex.log_message怎么用?Python LC2Sysex.log_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LC2Sysex.LC2Sysex
的用法示例。
在下文中一共展示了LC2Sysex.log_message方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _bank_down
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _bank_down(self):
if LC2Sysex.l9():
if len(self.song().scenes) > self.scene_offset() + self.height():
SessionComponent._bank_down(self)
self.send_offsets()
LC2Sysex.log_message(str(len(self.song().scenes)) + ' ' + str(self.scene_offset() + self.height()))
if len(self.song().scenes) == self.scene_offset() + self.height():
self._bank_down_button.turn_off()
示例2: set_clip
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def set_clip(self, clip, slot):
if self._clip is not None:
try:
if self._clip.playing_position_has_listener(self._on_playing_position_changed):
self._clip.remove_playing_position_listener(self._on_playing_position_changed)
if self._clip.notes_has_listener(self._on_notes_changed):
self._clip.remove_notes_listener(self._on_notes_changed)
if self._slot.has_clip_has_listener(self._on_slot_changed):
self._slot.remove_has_clip_listener(self._on_slot_changed)
for l in self._clisten:
chk = getattr(self._clip, l + "_has_listener")
if chk(self._on_length_changed):
rem = getattr(self._clip, "remove_" + l + "_listener")
rem(self._on_length_changed)
except:
pass
self._clip = clip
self._slot = slot
if clip is not None:
self._clip.add_playing_position_listener(self._on_playing_position_changed)
self._clip.add_notes_listener(self._on_notes_changed)
self._slot.add_has_clip_listener(self._on_slot_changed)
for l in self._clisten:
add = getattr(self._clip, "add_" + l + "_listener")
add(self._on_length_changed)
LC2Sysex.log_message(str(self._clip.length))
self._quantisation = 0.25
self._time_offset = 0
sysex = LC2Sysex("CLIP_TITLE")
sysex.ascii(
clip is not None
and clip.canonical_parent.canonical_parent.name
+ ": "
+ str(list(clip.canonical_parent.canonical_parent.clip_slots).index(clip.canonical_parent) + 1)
+ ". "
+ (clip.name and clip.name or "Unnamed")
or ""
)
sysex.rgb(clip is not None and clip.color or 0)
sysex.send()
self._cache_notes()
if self._clip is not None:
min = 128
for note in self._note_cache:
if note[0] < min:
min = note[0]
self._note_offset = len(self._note_cache) == 0 and 36 or min
self._fold_notes = 0
self._save_note = 0
self._send_offsets()
self._on_playing_position_changed()
self.update()
示例3: _select_xy
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _select_xy(self, sysex):
pid = sysex.parse('b')
LC2Sysex.log_message('SELECTING XY ' + str(pid))
if pid < len(self._xys):
self._selected_param = pid
param = self._xys[pid]
if param.mapped_parameter() is not None:
if isinstance(param.mapped_parameter().canonical_parent, Live.Device.Device):
self.song().view.select_device(param.mapped_parameter().canonical_parent)
self._send_id_param()
示例4: update
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def update(self):
array = [0 for i in range(self._height)]
array_l = [0 for i in range(self._height)]
for note in self._note_cache:
step = self._step(note[1])
nstep = self._note_step(note[0])
if step in range(16) and nstep in range(self._height):
array[self._height - 1 - nstep] |= 1 << step
last = self._step(note[1] + note[2])
for j in range(step + 1, min(last, 16)):
array_l[self._height - 1 - nstep] |= 1 << j
sysex = LC2Sysex("STEPS")
for b in array:
sysex.int2(b)
sysex.send()
sysex = LC2Sysex("STEPS2")
for b in array_l:
sysex.int2(b)
sysex.send()
sysex = LC2Sysex("SEQ_FADERS")
states = 0
for i in range(16):
fad = self._get_fader(i)[0]
if fad == -1:
sysex.byte(0)
else:
states |= 1 << i
sysex.byte(fad)
sysex.int2(states)
sysex.send()
self._get_timeline()
self._get_note_line()
sysex = LC2Sysex("SEQ_MUTES")
mutes = 0
for i in range(self._height):
mutes |= self._mutes[self._note(i)] << self._height - 1 - i
sysex.int2(mutes)
sysex.send()
sysex = LC2Sysex("SEQ_FOLD")
sysex.byte(self._fold_notes)
sysex.send()
sysex = LC2Sysex("SEQ_QUANT")
sysex.int(int(self._quantisation * 1000))
LC2Sysex.log_message(str(int(self._quantisation * 1000)))
sysex.send()
sysex = LC2Sysex("SEQ_SAVE_NOTE")
sysex.byte(self._save_note)
sysex.send()
示例5: bank
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def bank(self, ud):
if self._device is not None:
LC2Sysex.log_message('device')
if ud:
num_banks = self.number_of_parameter_banks(self._device)
LC2Sysex.log_message('up' + str(num_banks))
if num_banks > self._bank_index + 1:
self._bank_name = ''
self._bank_index += 1
self.update()
elif self._bank_index > 0:
self._bank_name = ''
self._bank_index -= 1
self.update()
示例6: _note_press
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _note_press(self, sysex):
x, y = sysex.parse("bb")
pos = self._pos(x)
pos2 = self._pos(x + 1)
pitch = self._note(y)
found = 0
for note in self._note_cache:
if note[1] >= pos and note[1] < pos2 and note[0] == pitch:
LC2Sysex.log_message(str(note[1]) + " " + str(pos) + " " + str(pos2))
found = 1
if found:
self.rem_note(pos, pos2, pitch)
else:
self.add_note(pos, pos2, pitch)
示例7: _transpose
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _transpose(self, args):
if not self._fold_notes:
pitch = args[0] == 1 and 1 or -1
selection, left = self._get_selection()
for note in selection:
id = self._note_step(note[0])
LC2Sysex.log_message("old " + str(note[0]))
note[0] = self._note(id + pitch)
LC2Sysex.log_message("new " + str(note[0]) + " " + str(id))
self._clip.select_all_notes()
self._clip.replace_selected_notes(tuple(selection + left))
self._selection[0] += pitch
self._selection[1] += pitch
self.update()
示例8: _compress
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _compress(self, args):
sel, rem = self._get_selection()
min = 99999
for note in sel:
if note[1] < min:
min = note[1]
for note in sel:
LC2Sysex.log_message("before: " + str(note))
if not args[0]:
note[1] = (note[1] - min) / 0.5 + min
note[2] = note[2] / 0.5
else:
note[1] = (note[1] - min) * 0.5 + min
note[2] = note[2] * 0.5
LC2Sysex.log_message("after: " + str(note))
self._clip.select_all_notes()
self._clip.replace_selected_notes(tuple(sel + rem))
示例9: set_device
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def set_device(self, device):
DeviceComponent.set_device(self, device)
if device is not None:
if hasattr(device, 'chains'):
LC2Sysex.log_message(str(len(device.chains)))
if hasattr(device, 'drum_pads'):
LC2Sysex.log_message(str(len(device.drum_pads)))
LC2Sysex.log_message(str(len(device.drum_pads[0].chains)))
cl = 0
par = False
if self._device is not None:
if hasattr(self._device, 'canonical_parent'):
par = isinstance(self._device.canonical_parent, Live.Device.Device) or isinstance(self._device.canonical_parent, Live.Chain.Chain)
else:
par = False
if hasattr(self._device, 'chains'):
if len(self._device.chains) > 0:
chains = [ i < len(self._device.chains) and (self._device.chains[i].name == '' and 'Chain ' + str(i + 1) or self._device.chains[i].name) or '' for i in range(8) ]
cl = min(8, len(self._device.chains))
else:
chains = [ '' for i in range(8) ]
else:
chains = [ '' for i in range(8) ]
else:
chains = [ '' for i in range(8) ]
sysex = LC2Sysex('CHAIN_NAMES')
sysex.byte(cl)
sysex.byte(int(par))
for i in range(8):
sysex.ascii(chains[i])
sysex.send()
self._selected_chain_id = 0
self._send_chain_devices()
示例10: _flip
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _flip(self, args):
dir = args[0]
sel, rem = self._get_selection()
LC2Sysex.log_message("Fliping " + str(dir) + " " + str(sel) + " " + str(rem))
if dir:
if not self._fold_notes:
min = 127
max = 0
for note in sel:
if note[0] > max:
max = note[0]
if note[0] < min:
min = note[0]
cs = (self._note_step(max) - self._note_step(min)) / 2.0 + self._note_step(min)
LC2Sysex.log_message(
str(cs)
+ " "
+ str(self._note_step(max))
+ " "
+ str(max)
+ " "
+ str(self._note_step(min))
+ " "
+ str(min)
)
for note in sel:
new_step = cs + (cs - self._note_step(note[0]))
note[0] = self._note(int(new_step))
self._clip.select_all_notes()
self._clip.replace_selected_notes(tuple(sel + rem))
else:
min = 99999
max = -99999
for note in sel:
if note[1] > max:
max = note[1]
if note[1] < min:
min = note[1]
centre = (max - min) / 2 + min
for note in sel:
note[1] = centre + (centre - note[1])
LC2Sysex.log_message("cent" + str(centre) + " " + str(min) + " " + str(max))
self._clip.select_all_notes()
self._clip.replace_selected_notes(tuple(sel + rem))
示例11: handle_sysex
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def handle_sysex(self, sysex):
if list(sysex).count(247) == 0:
count = 1
else:
count = list(sysex).count(247)
LC2Sysex.log_message(str(sysex))
LC2Sysex.log_message('sysex count' + str(count))
msysex = [ [] for i in range(count + 1) ]
id = 0
start = list(sysex).index(240)
for i, b in enumerate(sysex):
if i >= start:
msysex[id].append(b)
if b == 247:
id += 1
LC2Sysex.log_message(str(msysex))
pages = [self._session,
self._mixer,
self._sequencer,
self._modulator]
for sysex in msysex:
if len(sysex) > 1:
if sysex[1] == 5:
if sysex[2] == 1:
self._init()
elif sysex[2] == 2:
sysex = LC2SysexParser(sysex[3:])
interface = sysex.parse('b')
LC2Sysex.log_message('interface change: ' + str(interface))
if interface == 0 or interface == 1 or interface == 2:
self._mixer.set_enabled(1)
else:
self._mixer.set_enabled(0)
elif sysex[1] < len(pages):
pages[sysex[1]].handle_sysex(sysex[2:])
示例12: _select_device
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _select_device(self, sysex):
tr, id = sysex.parse('bb')
LC2Sysex.log_message('device select:' + str(tr) + ' ' + str(id))
if tr < len(self._channel_strips):
self.channel_strip(tr).select_device(id)
示例13: _select_send
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _select_send(self, sysex):
tid, send = sysex.parse('bb')
LC2Sysex.log_message(str(tid) + ' ' + str(send))
self._mixer.channel_strip(tid).select_send(send)
示例14: _launch_quant_value
# 需要导入模块: from LC2Sysex import LC2Sysex [as 别名]
# 或者: from LC2Sysex.LC2Sysex import log_message [as 别名]
def _launch_quant_value(self, value):
if self.is_enabled():
if self._launch_quant_button is not None:
LC2Sysex.log_message('valu' + str(value))
self.song().clip_trigger_quantization = Live.Song.Quantization.values[value]