def __init__(self, params, *args): params = utils.multiExtendSettings(inputTypes['random pulse'], inputTypes['randomPulse multi'], params) self.numPulses = params['number'] for inputIndex in range(len(params['inParams'])): params['inParams'][inputIndex]['relevance'] = [i for i in range(self.numPulses)] params['outParams'] = [{'type' : 'toggle', 'sendMessageOnChange' : True, 'description' : 'channel%s' %(i)} for i in range(self.numPulses)] InputBase.__init__(self, params, *args) self.checkTimer = Timer(True, 200, self.doCheck) self.onStates = [False for i in range(self.numPulses)] self.offTimers = [Timer(False, self.inParams[1].getValue(), self.turnOff, (i,)) for i in range(self.numPulses)]
def __init__(self, configParams, *args): configParams = utils.multiExtendSettings({'inParams' : []}, configParams) inParamKeys = [key for key in ['min', 'max', 'default', 'description', 'choices'] if key in configParams] for i in range(configParams['number']): configParam = {} for key in inParamKeys: if isinstance(configParams[key], list): configParam[key] = configParams[key][i % len(configParams[key])] else: configParam[key] = configParams[key] configParam['relevance'] = [i] configParams['inParams'].append(utils.extendSettings(inputTypes[configParams['basicInputType']]['inParams'][0], configParam)) for key in inParamKeys: del configParams[key] InputBase.__init__(self, configParams, *args)
def __init__(self, params, *args): params = utils.multiExtendSettings(inputTypes['random pulse'], inputTypes['randomPulse multi'], params) self.numPulses = params['number'] for inputIndex in range(len(params['inParams'])): params['inParams'][inputIndex]['relevance'] = [ i for i in range(self.numPulses) ] params['outParams'] = [{ 'type': 'toggle', 'sendMessageOnChange': True, 'description': 'channel%s' % (i) } for i in range(self.numPulses)] InputBase.__init__(self, params, *args) self.checkTimer = Timer(True, 200, self.doCheck) self.onStates = [False for i in range(self.numPulses)] self.offTimers = [ Timer(False, self.inParams[1].getValue(), self.turnOff, (i, )) for i in range(self.numPulses) ]
def __init__(self, configParams, instanceId): self.configParams = utils.multiExtendSettings({'inParams' : [], 'outParams' : [], 'direct' : False}, configParams) possibleInParamKeys = ['min', 'max', 'default', 'description', 'sendMessageOnChange', 'choices'] inParamKeys = [key for key in possibleInParamKeys if key in self.configParams] if inParamKeys: for key in inParamKeys: self.configParams['inParams'][0][key] = self.configParams[key] del self.configParams[key] if 'setupParamsNeeded' in self.configParams.keys(): del self.configParams['setupParamsNeeded'] self.outParams = [] self.inParams = [] self.instanceId = instanceId if self.configParams['direct']: for paramIndex in range(len(self.configParams['inParams'])): self.outParams.append(self.makeIoParam(self.configParams['inParams'][paramIndex], paramIndex)) self.inParams.append(self.outParams[paramIndex]) else: for inputParam in self.configParams['inParams']: self.inParams.append(self.makeIoParam(inputParam)) for paramIndex in range(len(self.configParams['outParams'])): self.outParams.append(self.makeIoParam(self.configParams['outParams'][paramIndex], paramIndex))
def __init__(self, configParams, instanceId): self.configParams = utils.multiExtendSettings( { 'inParams': [], 'outParams': [], 'direct': False }, configParams) possibleInParamKeys = [ 'min', 'max', 'default', 'description', 'sendMessageOnChange', 'choices' ] inParamKeys = [ key for key in possibleInParamKeys if key in self.configParams ] if inParamKeys: for key in inParamKeys: self.configParams['inParams'][0][key] = self.configParams[key] del self.configParams[key] if 'setupParamsNeeded' in self.configParams.keys(): del self.configParams['setupParamsNeeded'] self.outParams = [] self.inParams = [] self.instanceId = instanceId if self.configParams['direct']: for paramIndex in range(len(self.configParams['inParams'])): self.outParams.append( self.makeIoParam(self.configParams['inParams'][paramIndex], paramIndex)) self.inParams.append(self.outParams[paramIndex]) else: for inputParam in self.configParams['inParams']: self.inParams.append(self.makeIoParam(inputParam)) for paramIndex in range(len(self.configParams['outParams'])): self.outParams.append( self.makeIoParam( self.configParams['outParams'][paramIndex], paramIndex))
def __init__(self, configParams, *args): configParams = utils.multiExtendSettings({'inParams': []}, configParams) inParamKeys = [ key for key in ['min', 'max', 'default', 'description', 'choices'] if key in configParams ] for i in range(configParams['number']): configParam = {} for key in inParamKeys: if isinstance(configParams[key], list): configParam[key] = configParams[key][i % len( configParams[key])] else: configParam[key] = configParams[key] configParam['relevance'] = [i] configParams['inParams'].append( utils.extendSettings( inputTypes[configParams['basicInputType']]['inParams'][0], configParam)) for key in inParamKeys: del configParams[key] InputBase.__init__(self, configParams, *args)
from ProgramModules import utils from InputBase import InputBase from Basic import TimerPulseInput, BasicMultiInput, RandomPulseInput, RandomPulseMultiInput from Osc import OscMultiInput from Audio import AudioPulseInput import Osc, Basic, Audio inputTypes = utils.multiExtendSettings(Basic.inputTypes, Osc.inputTypes, Audio.inputTypes) availableInputTypes = {} for key in inputTypes.keys(): subType = False parts = key.split(' ') type = parts[-1] if len(parts) > 1: subType = parts[0] if not type in availableInputTypes.keys(): availableInputTypes[type] = [] if subType: availableInputTypes[type].append(subType)