本文整理汇总了Python中CeciliaLib.getTotalTime方法的典型用法代码示例。如果您正苦于以下问题:Python CeciliaLib.getTotalTime方法的具体用法?Python CeciliaLib.getTotalTime怎么用?Python CeciliaLib.getTotalTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CeciliaLib
的用法示例。
在下文中一共展示了CeciliaLib.getTotalTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setAutomationData
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import getTotalTime [as 别名]
def setAutomationData(self, data):
# convert values on scaling
temp = []
log = self.getLog()
minval = self.getMinValue()
maxval = self.getMaxValue()
automationlength = self.getAutomationLength()
frac = automationlength / CeciliaLib.getTotalTime()
virtuallength = len(data) / frac
data.extend([data[-1]] * int(((1 - frac) * virtuallength)))
totallength = float(len(data))
oldpos = 0
oldval = data[0]
if log:
maxOnMin = maxval / minval
torec = math.log10(oldval/minval) / math.log10(maxOnMin)
else:
maxMinusMin = maxval - minval
torec = (oldval - minval) / maxMinusMin
temp.append([0.0, torec])
for i, val in enumerate(data):
length = (i - oldpos) / totallength
pos = oldpos / totallength + length
if log:
torec = math.log10(val/minval) / math.log10(maxOnMin)
else:
torec = (val - minval) / maxMinusMin
temp.append([pos, torec])
oldval = val
oldpos = i
self.automationData = temp
示例2: getCeciliaText
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import getTotalTime [as 别名]
def getCeciliaText(self):
orchtext = ''
scotext = ''
if self.rate == 'k':
orchtext += 'instr Cecilia_%s\n' % self.name
orchtext += 'gk%s chnget "%s_value"\n' % (self.name, self.name)
orchtext += 'endin\n\n'
scotext += 'i "Cecilia_%s" 0 %f\n' % (self.name, CeciliaLib.getTotalTime())
return orchtext, scotext
示例3: getUserValue
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import getTotalTime [as 别名]
def getUserValue(str):
if str == 'total_time':
return CeciliaLib.getTotalTime()
elif str in CeciliaLib.getUserInputs().keys():
return CeciliaLib.getUserInputs()[str]['path']
elif str in [slider.getName() for slider in CeciliaLib.getUserSliders()]:
for slider in CeciliaLib.getUserSliders():
if str == slider.getName():
return slider.getValue()
elif str in [obj.getName() for obj in CeciliaLib.getUserTogglePopups()]:
for obj in CeciliaLib.getUserTogglePopups():
if str == obj.getName():
return obj.getValue()
else:
for k in CeciliaLib.getUserInputs().keys():
if 'off%s' % k == str or 'nchnls%s' % k == str or 'gensize%s' % k == str or 'sr%s' % k == str or 'dur%s' % k == str:
return CeciliaLib.getUserInputs()[k][str]
示例4: createGrapher
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import getTotalTime [as 别名]
def createGrapher(self):
graph = buildGrapher(self.grapher, CeciliaLib.getInterfaceWidgets(), CeciliaLib.getTotalTime())
CeciliaLib.setGrapher(graph)
return graph
示例5: getParamsText
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import getTotalTime [as 别名]
def getParamsText(self):
knobs = [self.knob1, self.knob2, self.knob3]
orchtext = ''
scotext = ''
for knob in knobs:
if knob.getRate() == 'k':
orchtext += 'instr Cecilia_%s\n' % knob.getName()
orchtext += 'ksliderValue init %f\n' % knob.GetValue()
orchtext += 'kgetValue init %f\n' % knob.GetValue()
if knob.getWithMidi() and not knob.getPlay():
orchtext += 'kmidiValue init %f\n' % knob.GetValue()
if not knob.getLog():
init = (knob.GetValue() - knob.getMinValue()) / (knob.getMaxValue() - knob.getMinValue()) - (1./254)
if init <= 0:
orchtext += 'initc7 %d, %d, 0\n' % (knob.getMidiChannel(), knob.getMidiCtl())
else:
orchtext += 'initc7 %d, %d, %f\n' % (knob.getMidiChannel(), knob.getMidiCtl(), init)
orchtext += 'kmidiValue ctrl7 %d, %d, %f, %f\n' % (knob.getMidiChannel(), knob.getMidiCtl(), knob.getMinValue(), knob.getMaxValue())
else:
init = math.log10(knob.GetValue() / knob.getMinValue()) / math.log10(knob.getMaxValue() / knob.getMinValue()) - (1./254)
if init <= 0:
orchtext += 'initc7 %d, %d, 0\n' % (knob.getMidiChannel(), knob.getMidiCtl())
else:
orchtext += 'initc7 %d, %d, %f\n' % (knob.getMidiChannel(), knob.getMidiCtl(), init)
orchtext += 'kmiditemp ctrl7 %d, %d, 0, 1\n' % (knob.getMidiChannel(), knob.getMidiCtl())
orchtext += 'kmidiValue pow 10, kmiditemp * %f + %f\n' % ((math.log10(knob.getMaxValue()) - math.log10(knob.getMinValue())), math.log10(knob.getMinValue()))
orchtext += 'kgetValue chnget "%s_value"\n' % knob.getName()
if knob.getWithMidi() and not knob.getPlay():
orchtext += 'ksliderDown init 0\n'
orchtext += 'ksliderDown chnget "%s_down"\n' % knob.getName()
orchtext += 'if ksliderDown == 1 then\n'
orchtext += 'ksliderValue = kgetValue\n'
orchtext += 'else\n'
orchtext += 'ksliderValue = kmidiValue\n'
orchtext += 'endif\n\n'
orchtext += 'gk%s port ksliderValue, %f, %f\n' % (knob.getName(), knob.gliss, knob.GetValue())
orchtext += 'chnset gk%s, "%s"\n' % (knob.getName(), knob.getName())
elif knob.getPlay():
orchtext += 'kreadValue init %f\n' % knob.GetValue()
orchtext += 'ksliderDown init 0\n'
orchtext += 'ksliderDown chnget "%s_down"\n' % knob.getName()
orchtext += 'kphase phasor 1/p3\n'
orchtext += 'kreadValue tablei kphase, %d, 1\n' % knob.getTable()
orchtext += 'if ksliderDown == 1 then\n'
orchtext += 'gk%s port kgetValue, %f, %f\n' % (knob.getName(), knob.gliss, knob.GetValue())
orchtext += 'else\n'
orchtext += 'gk%s = kreadValue\n' % knob.getName()
orchtext += 'endif\n\n'
orchtext += 'chnset gk%s, "%s"\n' % (knob.getName(), knob.getName())
else:
orchtext += 'gk%s port kgetValue, %f, %f\n' % (knob.getName(), knob.gliss, knob.GetValue())
if knob.getRec():
knob.path = os.path.join(AUTOMATION_SAVE_PATH, '%s.auto' % knob.getName())
knob.path = CeciliaLib.convertWindowsPath(knob.getPath())
orchtext += 'dumpk gk%s, "%s", 8, 4/kr\n\n' % (knob.getName(), knob.getPath())
orchtext += 'endin\n\n'
scotext += 'i "Cecilia_%s" 0 %f\n' % (knob.getName(), CeciliaLib.getTotalTime())
return orchtext, scotext