コード例 #1
0
    def new_input(self, protocol="OSC", **kwargs):
        """
        Create a new input for this device

            args:
                Mandatory argument is the protocol
                you want to use for this output
                (OSC, MIDI, serial, ArtNet)
            rtype:
                input object
        """
        if not self._inputs:
            self._inputs = []
        taille = len(self._inputs)
        if protocol == "OSC":
            the_input = 'OSC'
            self.osc_server = liblo.ServerThread(1235)
            for param in self.getparameters():
                self.osc_server.add_method(param.address, 'i', param.listen)
            self.osc_server.start()
        elif protocol == "MIDI":
            the_input = InputMIDI()
        else:
            the_input = None
        if the_input:
            set_attributes(the_input, kwargs)
            self._inputs.append(the_input)
            return self._inputs[taille]
        else:
            return False
コード例 #2
0
    def new_output(self, protocol="OSC", **kwargs):
        """
        Create a new output for this device

            args:
                Mandatory argument is the protocol
                you want to use for this output
                (OSC, MIDI, serial, ArtNet)
            rtype:
                Output object
        """
        if not self._outputs:
            self._outputs = []
        taille = len(self._outputs)
        if protocol == "OSC":
            output = OutputOSC()
        elif protocol == "MIDI":
            output = OutputMIDI()
        else:
            output = None
        if output:
            set_attributes(output, kwargs)
            self._outputs.append(output)
            return self._outputs[taille]
        else:
            return False
コード例 #3
0
 def __init__(self, **kwargs):
     super(Parameter, self).__init__()
     # IMPORTANT to register parent first
     self._parent = kwargs['parent']
     # collection of states
     self._states = []
     # collection of states
     set_attributes(self, kwargs)
コード例 #4
0
 def __init__(self, **kwargs):
     super(OutputOSC, self).__init__()
     if __dbug__:
         print('creating an OSC output')
     self._protocol = 'OSC'
     self._name = 'OSC Output'
     self._port = '127.0.0.1:1234'
     set_attributes(self, kwargs)
コード例 #5
0
 def __init__(self, **kwargs):
     super(Node, self).__init__()
     # initialise attributes/properties of this node
     self._address = None
     self._parameter = None
     self._children = None
     # kwargs setup attributes
     set_attributes(self, kwargs)
コード例 #6
0
ファイル: node.py プロジェクト: PixelStereo/pybush
 def __init__(self, **kwargs):
     super(Node, self).__init__()
     # initialise attributes/properties of this node
     self._address = None
     self._parameter = None
     self._children = None
     # kwargs setup attributes
     set_attributes(self, kwargs)
コード例 #7
0
ファイル: parameter.py プロジェクト: PixelStereo/pybush
 def __init__(self, **kwargs):
     super(Parameter, self).__init__()
     # IMPORTANT to register parent first
     self._parent = kwargs['parent']
     # collection of states
     self._states = []
     # collection of states
     set_attributes(self, kwargs)
コード例 #8
0
ファイル: basic.py プロジェクト: PixelStereo/pybush
 def __init__(self, **kwargs):
     super(Basic, self).__init__()
     # this is not really clean.
     if 'children' in kwargs.keys():
         kwargs.pop('children')
     # initialise attributes/properties of this node
     self._description = None
     self._tags = []
     self._name = None
     # kwargs setup attributes
     set_attributes(self, kwargs)
コード例 #9
0
 def __init__(self, **kwargs):
     super(Basic, self).__init__()
     # this is not really clean.
     if 'children' in kwargs.keys():
         kwargs.pop('children')
     # initialise attributes/properties of this node
     self._description = None
     self._tags = []
     self._name = None
     # kwargs setup attributes
     set_attributes(self, kwargs)
コード例 #10
0
ファイル: parameter.py プロジェクト: PixelStereo/pybush
 def recall(self, snap):
     """
     recall a state of the parameter
     """
     if isinstance(snap, dict):
         pass
     elif isinstance(snap, State) or isinstance(snap, State):
         snap = snap.export()
     else:
         print('ERROR 76543')
         return False
     set_attributes(self, snap)
     return True
コード例 #11
0
 def recall(self, snap):
     """
     recall a state of the parameter
     """
     if isinstance(snap, dict):
         pass
     elif isinstance(snap, State) or isinstance(snap, State):
         snap = snap.export()
     else:
         print('ERROR 76543')
         return False
     set_attributes(self, snap)
     return True
コード例 #12
0
 def __init__(self, **kwargs):
     super(Device, self).__init__(**kwargs)
     self._author = None
     self._version = None
     self._input = None
     self._output = None
     # list of all outputs for this device
     self._outputs = None
     # list of all inputs for this device
     self._inputs = None
     # kwargs setup attributes
     set_attributes(self, kwargs)
     # temporary workaround
     self._final_node = None
コード例 #13
0
ファイル: value.py プロジェクト: PixelStereo/pybush
 def __init__(self, **kwargs):
     super(Value, self).__init__()
     if 'parent' in kwargs.keys():
         self._parent = kwargs['parent']
     self._value = None
     self._clipmode = None
     self._domain = None
     self._silent = False
     self._unique = None
     self._datatype = None
     self._raw = None
     # initialise attributes/properties of this node
     set_attributes(self, kwargs)
     # there is no animation on the param
     self._current_player = None
コード例 #14
0
 def __init__(self, **kwargs):
     super(Value, self).__init__()
     if 'parent' in kwargs.keys():
         self._parent = kwargs['parent']
     self._value = None
     self._clipmode = None
     self._domain = None
     self._silent = False
     self._unique = None
     self._datatype = None
     self._raw = None
     # initialise attributes/properties of this node
     set_attributes(self, kwargs)
     # there is no animation on the param
     self._current_player = None
コード例 #15
0
    def read(self, filepath):
        """
        Fillin Bush with objects created from a json file

        Creates Outputs obects
        First, dump attributes, then outputs.

        :returns: True if file formatting is correct, False otherwise
        :rtype: boolean
        """
        # self.read is a method from File Class
        device_dict = self.load(filepath)
        # FOR LATER : CHECK IF THIS IS A VALID DEVICE FILE
        # if valid python dict / json file
        if device_dict:
            if __dbug__:
                print('initing device called : ' + filepath)
            self.__init__()
            if __dbug__:
                print('loading device called : ' + filepath)
        else:
            if __dbug__:
                print('ERROR 901 - file is not valid' + str(filepath))
        try:
            if __dbug__:
                print('new-device : ' + device_dict['name'])
            # iterate each attributes of the selected device
            set_attributes(self, device_dict)
            if __dbug__:
                print('device loaded : ' + str(self.name))
            return True
        # catch error if file is not valid or if file is not a valide node
        except (IOError, ValueError) as error:
            if __dbug__:
                print(error, "ERROR 902 - this is not a valid Device")
            return False
コード例 #16
0
ファイル: value.py プロジェクト: PixelStereo/pybush
 def __init__(self, **kwargs):
     super(Integer, self).__init__()
     # initialise attributes/properties of this node
     set_attributes(self, kwargs)
コード例 #17
0
ファイル: value.py プロジェクト: PixelStereo/pybush
 def __init__(self, value=None, domain=None, clipmode=None):
     super(Numeric, self).__init__()
     # initialise attributes/properties of this node
     set_attributes(self, kwargs)
コード例 #18
0
 def __init__(self, **kwargs):
     super(Output, self).__init__()
     self._port = None
     set_attributes(self, kwargs)
コード例 #19
0
 def __init__(self, **kwargs):
     super(State, self).__init__(**kwargs)
     if __dbug__:
         print('creating a state')
     set_attributes(self, kwargs)
コード例 #20
0
 def __init__(self, value=None, domain=None, clipmode=None):
     super(Numeric, self).__init__()
     # initialise attributes/properties of this node
     set_attributes(self, kwargs)
コード例 #21
0
 def __init__(self, **kwargs):
     super(Integer, self).__init__()
     # initialise attributes/properties of this node
     set_attributes(self, kwargs)