def __init__(self, params, *args):
		self.outputTypes = ['pulse', 'toggle', 'value']
		callbackAddresses = {}
		callbacksInStringForm = False
		for outputType in self.outputTypes:
			callbackAddresses[outputType] = []
			key = outputType + 'AddressString'
			if key in params.keys():
				callbackAddresses[outputType] = params[key].split()
				if len(callbackAddresses[outputType]) > 0:
					callbacksInStringForm = True
				del params[key]
		if callbacksInStringForm:
			params['callbackAddresses'] = callbackAddresses
		params['outParams'] = []
		for outputType in self.outputTypes:
			for address in params['callbackAddresses'][outputType]:
				params['outParams'].append({'type' : outputType, 'description' : outputType[0].upper() + outputType[1:] + ' ' + address, 'sendMessageOnChange' : True})
			
		InputBase.__init__(self, params, *args)
		self.callbackLinkList = []
		self.stopEvent = Event()
		self.server = OscMultiInput.OscServerThread((self.configParams['host'], self.configParams['port']), self.stopEvent)
		self.buildCallbackLinkList()
		self.server.setCallBacks(self.callbackLinkList)
		self.server.start()
		self.persistant = True
Пример #2
0
 def __init__(self, *args):
     InputBase.__init__(self, *args)
     self.checkTimer = Timer(True, 200, self.doCheck)
     self.numPulses = 1
     self.onStates = [False]
     self.offTimers = [
         Timer(False, self.inParams[1].getValue(), self.turnOff, (0, ))
     ]
	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)
Пример #5
0
 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)
     ]
Пример #6
0
    def __init__(self, params, *args):
        self.outputTypes = ['pulse', 'toggle', 'value']
        callbackAddresses = {}
        callbacksInStringForm = False
        for outputType in self.outputTypes:
            callbackAddresses[outputType] = []
            key = outputType + 'AddressString'
            if key in params.keys():
                callbackAddresses[outputType] = params[key].split()
                if len(callbackAddresses[outputType]) > 0:
                    callbacksInStringForm = True
                del params[key]
        if callbacksInStringForm:
            params['callbackAddresses'] = callbackAddresses
        params['outParams'] = []
        for outputType in self.outputTypes:
            for address in params['callbackAddresses'][outputType]:
                params['outParams'].append({
                    'type':
                    outputType,
                    'description':
                    outputType[0].upper() + outputType[1:] + ' ' + address,
                    'sendMessageOnChange':
                    True
                })

        InputBase.__init__(self, params, *args)
        self.callbackLinkList = []
        self.stopEvent = Event()
        self.server = OscMultiInput.OscServerThread(
            (self.configParams['host'], self.configParams['port']),
            self.stopEvent)
        self.buildCallbackLinkList()
        self.server.setCallBacks(self.callbackLinkList)
        self.server.start()
        self.persistant = True
Пример #7
0
    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)
Пример #8
0
 def stop(self):
     self.stopEvent.set()
     InputBase.stop(self)
Пример #9
0
 def stop(self):
     self.checkTimer.stop()
     for i in range(self.numPulses):
         self.offTimers[i].stop()
     InputBase.stop(self)
	def __init__(self, *args):
		InputBase.__init__(self, *args)
		self.checkTimer = Timer(True, 200, self.doCheck)
		self.numPulses = 1
		self.onStates = [False]
		self.offTimers = [Timer(False, self.inParams[1].getValue(), self.turnOff, (0,))]
Пример #11
0
 def setInputValue(self, *args):
     InputBase.setInputValue(self, *args)
     self.timer.changeInterval(self.inParams[0].getValue())
	def stop(self):
		self.checkTimer.stop()
		for i in range(self.numPulses):
			self.offTimers[i].stop()
		InputBase.stop(self)
Пример #13
0
 def stop(self):
     self.timer.stop()
     InputBase.stop(self)
	def __init__(self, *args):
		InputBase.__init__(self, *args)
		self.audioThread = AudioPulseInput.AudioInputThread(self, Event(), self.handleAudioUpdate)
		self.audioThread.start()
	def __init__(self, *args):
		InputBase.__init__(self, *args)
		self.timer = Timer(True, self.inParams[0].getValue(), getattr(self, 'sendPulse'))
 def stop(self):
     self.audioThread.stop()
     InputBase.stop(self)
 def __init__(self, *args):
     InputBase.__init__(self, *args)
     self.audioThread = AudioPulseInput.AudioInputThread(
         self, Event(), self.handleAudioUpdate)
     self.audioThread.start()
	def stop(self):
		self.timer.stop()
		InputBase.stop(self)
	def stop(self):
		self.stopEvent.set()
		InputBase.stop(self)
Пример #20
0
 def __init__(self, *args):
     InputBase.__init__(self, *args)
     self.timer = Timer(True, self.inParams[0].getValue(),
                        getattr(self, 'sendPulse'))
	def stop(self):
		self.audioThread.stop()
		InputBase.stop(self)
	def setInputValue(self, *args):
		InputBase.setInputValue(self, *args)
		self.timer.changeInterval(self.inParams[0].getValue())