Beispiel #1
0
    def nameSceneCB(self, msg, source):
        """Called when a /live/name/scene message is received.

        Messages:
        /live/name/scene                            Returns a a series of all the scene names in the form /live/name/scene (int scene, string name)
        /live/name/scene    (int scene)             Returns a single scene's name in the form /live/name/scene (int scene, string name)
        /live/name/scene    (int scene, string name)Sets scene number scene's name to name

        """        
        #Requesting all scene names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            bundle = OSC.OSCBundle()
            sceneNumber = 0
            for scene in LiveUtils.getScenes():
                bundle.append("/live/name/scene", (sceneNumber, str(scene.name)))
                sceneNumber = sceneNumber + 1
            self.oscEndpoint.sendMessage(bundle)
            return
        #Requesting a single scene name
        if len(msg) == 3:
            sceneNumber = msg[2]
            self.oscEndpoint.send("/live/name/scene", (sceneNumber, str(LiveUtils.getScene(sceneNumber).name)))
            return
        #renaming a scene
        if len(msg) == 4:
            sceneNumber = msg[2]
            name = msg[3]
            LiveUtils.getScene(sceneNumber).name = name
Beispiel #2
0
    def nameSceneCB(self, msg):
        """Called when a /live/name/scene message is received.

        Messages:
        /live/name/scene                            Rerurns a a series of all the scene names in the form /live/name/scene (int scene, string name)
        /live/name/scene    (int scene)             Returns a single scene's name in the form /live/name/scene (int scene, string name)
        /live/name/scene    (int scene, string name)Sets scene number scene's name to name

        """        
        #Requesting all scene names
        if len(msg) == 2:
            sceneNumber = 0
            for scene in LiveUtils.getScenes():
                self.oscServer.sendOSC("/live/name/scene", (sceneNumber, scene.name))
                sceneNumber = sceneNumber + 1
            return
        #Requesting a single scene name
        if len(msg) == 3:
            sceneNumber = msg[2]
            self.oscServer.sendOSC("/live/name/scene", (sceneNumber, LiveUtils.getScene(sceneNumber).name))
            return
        #renaming a scene
        if len(msg) == 4:
            sceneNumber = msg[2]
            name = msg[3]
            LiveUtils.getScene(sceneNumber).name = name
Beispiel #3
0
    def nameSceneCB(self, msg, source):
        """Called when a /live/name/scene message is received.

        Messages:
        /live/name/scene                            Returns a a series of all the scene names in the form /live/name/scene (int scene, string name)
        /live/name/scene    (int scene)             Returns a single scene's name in the form /live/name/scene (int scene, string name)
        /live/name/scene    (int scene, string name)Sets scene number scene's name to name

        """
        #Requesting all scene names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            bundle = OSC.OSCBundle()
            sceneNumber = 0
            for scene in LiveUtils.getScenes():
                bundle.append("/live/name/scene",
                              (sceneNumber, str(scene.name)))
                sceneNumber = sceneNumber + 1
            self.oscEndpoint.sendMessage(bundle)
            return
        #Requesting a single scene name
        if len(msg) == 3:
            sceneNumber = msg[2]
            self.oscEndpoint.send(
                "/live/name/scene",
                (sceneNumber, str(LiveUtils.getScene(sceneNumber).name)))
            return
        #renaming a scene
        if len(msg) == 4:
            sceneNumber = msg[2]
            name = msg[3]
            LiveUtils.getScene(sceneNumber).name = name
Beispiel #4
0
 def fire_scene(self):
     if debug:
         log("PlayMode: " + str(playMode))
     if playMode == 'next':
         next_index = int(self.playing_scene_index) + 1
         LiveUtils.getScene(next_index).fire()
     elif playMode == 'repeat':
         LiveUtils.getScene(self.playing_scene_index).fire()
Beispiel #5
0
    def nameSceneBlockCB(self, msg, source):
        """Called when a /live/name/sceneblock message is received.

        /live/name/clipblock    (int offset, int blocksize) Returns a list of blocksize scene names starting at offset
        """
        if len(msg) == 4:
            block = []
            sceneOffset = msg[2]
            blocksize = msg[3]
            for scene in range(0, blocksize):
                block.extend([str(LiveUtils.getScene(sceneOffset+scene).name)])                            
            self.oscEndpoint.send("/live/name/sceneblock", block)
Beispiel #6
0
    def nameSceneBlockCB(self, msg):
        """Called when a /live/name/sceneblock message is received.

        /live/name/clipblock    (int offset, int blocksize) Returns a list of blocksize scene names starting at offset
        """
        if len(msg) == 4:
            block = []
            sceneOffset = msg[2]
            blocksize = msg[3]
            for scene in range(0, blocksize):
                block.extend([str(LiveUtils.getScene(sceneOffset+scene).name)])                            
            self.oscServer.sendOSC("/live/name/sceneblock", block)
Beispiel #7
0
 def send_playing_scene_id(self):
     track = LiveUtils.getTrack(LIVE_CONTROL_TRACK)
     index = track.playing_slot_index
     if index != -1:
         songID = Scan.findName(track.clip_slots[index].clip.name,
                                CONTROL_CLIP_IDENTIFIER)
         scene = LiveUtils.getScene(index)
         idIndex = scene.name.find(" #cS")
         if idIndex != -1:
             sceneID = scene.name[idIndex:]
             #log(sceneID)
             self.oscEndpoint.send("/session/playing",
                                   (index, str(sceneID), str(songID)))
Beispiel #8
0
    def findLongestClip(self, sceneIndex):
        longestLength = 0.0
        signature_denominator = LiveUtils.getSong().signature_denominator
        signature_numerator = LiveUtils.getSong().signature_numerator
        scene = LiveUtils.getScene(int(sceneIndex))
        for slot in scene.clip_slots:
            if slot.clip != None:
                longestLength = slot.clip.length if slot.clip.length > longestLength else longestLength
                if slot.clip.length > longestLength:
                    longestLength = slot.clip.length
                    signature_numerator = slot.clip.signature_numerator
                    signature_denominator = slot.clip.signature_denominator
        if longestLength == 0.0:
            longestLength = 4.0

        return (longestLength, signature_numerator, signature_denominator)
Beispiel #9
0
    def scanSceneClips(self, msg, source):

        scene = LiveUtils.getScene(int(msg[2]))
        oscEndpoint.sendMessage(OSC.OSCMessage("/clips/start"))
        slotNumber = 0
        for slot in scene.clip_slots:
            clipBundle = OSC.OSCBundle()
            clip = slot.clip
            scanID = CLIP_IDENTIFIER + self.makeID()
            if clip is None:
                # if there's no control clip in this slot let's add one
                if slotNumber == 0:
                    slot.create_clip(32.0)
                    slot.clip.name = "<!LC>" + scanID
            clip = slot.clip
            if clip is not None:
                clipBundle.append(OSC.OSCMessage("/clip/start"))
                if (clip.name.find(CLIP_IDENTIFIER) == -1):
                    clip.name = clip.name + scanID

                warping = True if clip.is_midi_clip else clip.warping
                arguments = (slotNumber, str(clip.name), int(clip.length),
                             str(warping), str(clip.looping),
                             int(clip.loop_start), int(clip.loop_end),
                             int(clip.signature_numerator),
                             int(clip.signature_denominator))
                clipBundle.append(OSC.OSCMessage("/clip", arguments))
                clipBundle.append(OSC.OSCMessage("/clip/end"))
                oscEndpoint.sendMessage(clipBundle)
                foundClip = True

            slotNumber = slotNumber + 1
        oscEndpoint.sendMessage(OSC.OSCMessage("/clips/end"))
        #self.oscEndpoint.send(clipBundle)
        return

        # proof of concept to duplicate scenes and move them into separate scenes
        """i = 0