예제 #1
0
 def _parse_scene_number(self, number):
     if number in self._scenes:
         # single scene number, no subscene
         return (_util.actual(number), -1)
     elif (_misc.issequence(number) and
             len(number) > 1 and number[0] in self._scenes):
         # scene/subscene numbers as tuple...
         if _util.actual(number[1]) < len(self._scenes[number[0]][1]):
             # both scene and subscene numbers are valid
             return (_util.actual(number[0]), _util.actual(number[1]))
         # subscene number is invalid
         return (_util.actual(number[0]), -1)
     # no such scene
     return (-1, -1)
예제 #2
0
 def _parse_scene_number(self, number):
     if number in self._scenes:
         # single scene number, no subscene
         return (_util.actual(number), -1)
     elif (_misc.issequence(number) and len(number) > 1
           and number[0] in self._scenes):
         # scene/subscene numbers as tuple...
         if _util.actual(number[1]) < len(self._scenes[number[0]][1]):
             # both scene and subscene numbers are valid
             return (_util.actual(number[0]), _util.actual(number[1]))
         # subscene number is invalid
         return (_util.actual(number[0]), -1)
     # no such scene
     return (-1, -1)
예제 #3
0
def Channel(channel):
    """
    Channel(channel)

    Change the event's channel number.
    """
    return _Unit(_mididings.Channel(_util.actual(channel)))
예제 #4
0
def Port(port):
    """
    Port(port)

    Change the event's port number.
    """
    return _Unit(_mididings.Port(_util.actual(port)))
예제 #5
0
 def next_subscene_cb(self, path, args):
     s = _engine.scenes()[_engine.current_scene()]
     n = _util.actual(_engine.current_subscene()) + 1
     if len(s[1]) and len(args) and args[0]:
         n %= len(s[1])
     if n < len(s[1]):
         _engine.switch_subscene(_util.offset(n))
예제 #6
0
 def next_subscene_cb(self, path, args):
     s = _engine.scenes()[_engine.current_scene()]
     n = _util.actual(_engine.current_subscene()) + 1
     if len(s[1]) and len(args) and args[0]:
         n %= len(s[1])
     if n < len(s[1]):
         _engine.switch_subscene(_util.offset(n))
예제 #7
0
    def setup(self, scenes, control, pre, post):
        # build and setup all scenes and scene groups
        for number, scene in scenes.items():
            if isinstance(scene, _scene.SceneGroup):
                self._scenes[number] = (scene.name, [])

                for subscene in scene.subscenes:
                    sceneobj = _scene._parse_scene(subscene)
                    self._scenes[number][1].append(sceneobj.name)

                    # build patches
                    patch = _patch.Patch(sceneobj.patch)
                    init_patch = _patch.Patch(sceneobj.init_patch)
                    exit_patch = _patch.Patch(sceneobj.exit_patch)
                    # add scene to base class object
                    self.add_scene(_util.actual(number), patch, init_patch,
                                   exit_patch)
            else:
                sceneobj = _scene._parse_scene(scene)
                self._scenes[number] = (sceneobj.name, [])

                # build patches
                patch = _patch.Patch(sceneobj.patch)
                init_patch = _patch.Patch(sceneobj.init_patch)
                exit_patch = _patch.Patch(sceneobj.exit_patch)
                # add scene to base class object
                self.add_scene(_util.actual(number), patch, init_patch,
                               exit_patch)

        # build and setup control, pre, and post patches
        control_patch = _patch.Patch(control) if control else None
        pre_patch = _patch.Patch(pre) if pre else None
        post_patch = _patch.Patch(post) if post else None
        # tell base class object about these patches
        self.set_processing(control_patch, pre_patch, post_patch)

        global _TheEngine
        _TheEngine = _weakref.ref(self)

        _gc.collect()
        _gc.disable()
예제 #8
0
    def setup(self, scenes, control, pre, post):
        # build and setup all scenes and scene groups
        for number, scene in scenes.items():
            if isinstance(scene, _scene.SceneGroup):
                self._scenes[number] = (scene.name, [])

                for subscene in scene.subscenes:
                    sceneobj = _scene._parse_scene(subscene)
                    self._scenes[number][1].append(sceneobj.name)

                    # build patches
                    patch = _patch.Patch(sceneobj.patch)
                    init_patch = _patch.Patch(sceneobj.init_patch)
                    exit_patch = _patch.Patch(sceneobj.exit_patch)
                    # add scene to base class object
                    self.add_scene(_util.actual(number),
                                   patch, init_patch, exit_patch)
            else:
                sceneobj = _scene._parse_scene(scene)
                self._scenes[number] = (sceneobj.name, [])

                # build patches
                patch = _patch.Patch(sceneobj.patch)
                init_patch = _patch.Patch(sceneobj.init_patch)
                exit_patch = _patch.Patch(sceneobj.exit_patch)
                # add scene to base class object
                self.add_scene(_util.actual(number),
                               patch, init_patch, exit_patch)

        # build and setup control, pre, and post patches
        control_patch = _patch.Patch(control) if control else None
        pre_patch = _patch.Patch(pre) if pre else None
        post_patch = _patch.Patch(post) if post else None
        # tell base class object about these patches
        self.set_processing(control_patch, pre_patch, post_patch)

        global _TheEngine
        _TheEngine = _weakref.ref(self)

        _gc.collect()
        _gc.disable()
예제 #9
0
 def switch_subscene(self, subscene):
     _mididings.Engine.switch_scene(self, -1, _util.actual(subscene))
예제 #10
0
 def switch_scene(self, scene, subscene=None):
     _mididings.Engine.switch_scene(
         self, _util.actual(scene),
         _util.actual(subscene) if subscene is not None else -1)
예제 #11
0
 def switch_subscene(self, subscene):
     _mididings.Engine.switch_scene(self, -1, _util.actual(subscene))
예제 #12
0
 def switch_scene(self, scene, subscene=None):
     _mididings.Engine.switch_scene(self,
         _util.actual(scene),
         _util.actual(subscene) if subscene is not None else -1
      )
예제 #13
0
파일: event.py 프로젝트: Darko8/mididings
 def setter(self, value):
     self._check_type_attribute(type, name)
     setattr(self, data, _util.actual(value))
예제 #14
0
파일: event.py 프로젝트: Darko8/mididings
def ProgramEvent(port, channel, program):
    """
    Create a new program change event object.
    """
    return MidiEvent(_constants.PROGRAM, port, channel, 0,
                     _util.actual(program))
예제 #15
0
파일: event.py 프로젝트: aldanor/mididings
 def setter(self, value):
     self._check_type_attribute(type, name)
     setattr(self, data, _util.actual(value))
예제 #16
0
파일: event.py 프로젝트: aldanor/mididings
def ProgramEvent(port, channel, program):
    """
    Create a new program change event object.
    """
    return MidiEvent(_constants.PROGRAM, port, channel, 0,
                     _util.actual(program))