def nameClipCB(self, msg):
        """Called when a /live/name/clip message is received.

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

        """
        
        #Requesting all clip names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackNumber = 0
            clipNumber = 0
            for track in LiveUtils.getTracks():
                for clipSlot in track.clip_slots:
                    if clipSlot.clip != None:
                        self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(clipSlot.clip.name), clipSlot.clip.color))
                    clipNumber = clipNumber + 1
                clipNumber = 0
                trackNumber = trackNumber + 1
            return
        #Requesting a single clip name
        if len(msg) == 4:
            trackNumber = msg[2]
            clipNumber = msg[3]
            self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(LiveUtils.getClip(trackNumber, clipNumber).name), LiveUtils.getClip(trackNumber, clipNumber).color))
            return
        #renaming a clip
        if len(msg) == 5:
            trackNumber = msg[2]
            clipNumber = msg[3]
            name = msg[4]
            LiveUtils.getClip(trackNumber, clipNumber).name = name
Example #2
0
    def nameClipBlockCB(self, msg, source):
        """Called when a /live/name/clipblock message is received.

        /live/name/clipblock    (int track, int clip, blocksize x/tracks, blocksize y/clipslots) Returns a list of clip names for a block of clips (int blockX, int blockY, clipname)

        """
        #Requesting a block of clip names X1 Y1 X2 Y2 where X1,Y1 is the first clip (track, clip) of the block, X2 the number of tracks to cover and Y2 the number of scenes

        if len(msg) == 6:
            block = []
            trackOffset = msg[2]
            clipOffset = msg[3]
            blocksizeX = msg[4]
            blocksizeY = msg[5]
            for clip in range(0, blocksizeY):
                for track in range(0, blocksizeX):
                    trackNumber = trackOffset + track
                    clipNumber = clipOffset + clip
                    if LiveUtils.getClip(trackNumber, clipNumber) != None:
                        block.extend([
                            str(
                                LiveUtils.getClip(trackNumber,
                                                  clipNumber).name)
                        ])
                    else:
                        block.extend([""])

            self.oscEndpoint.send("/live/name/clipblock", block)
Example #3
0
    def nameClipCB(self, msg):
        """Called when a /live/name/clip message is received.

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

        """
        
        #Requesting all clip names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackNumber = 0
            clipNumber = 0
            for track in LiveUtils.getTracks():
                for clipSlot in track.clip_slots:
                    if clipSlot.clip != None:
                        self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(clipSlot.clip.name), str(clipSlot.clip.color_index)))
                    clipNumber = clipNumber + 1
                clipNumber = 0
                trackNumber = trackNumber + 1
            return
        #Requesting a single clip name
        if len(msg) == 4:
            trackNumber = msg[2]
            clipNumber = msg[3]
            self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(LiveUtils.getClip(trackNumber, clipNumber).name), str(LiveUtils.getClip(trackNumber, clipNumber).color_index)))
            return
        #renaming a clip
        if len(msg) == 5:
            trackNumber = msg[2]
            clipNumber = msg[3]
            name = msg[4]
            LiveUtils.getClip(trackNumber, clipNumber).name = name
Example #4
0
 def loopEndCB(self, msg):
     trackNumber = msg[2]
     clipNumber = msg[3]    
     if len(msg) == 4:
         self.oscServer.sendOSC("/live/loopend", float(LiveUtils.getClip(trackNumber, clipNumber).loop_end))    
     
     elif len(msg) == 5:
         loopEnd = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).loop_end =  loopEnd
Example #5
0
 def loopStartCB(self, msg):
     trackNumber = msg[2]
     clipNumber = msg[3]
 
     if len(msg) == 4:
         self.oscServer.sendOSC("/live/loopstart", float(LiveUtils.getClip(trackNumber, clipNumber).loop_start))    
 
     elif len(msg) == 5:
         loopStart = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).loop_start = loopStart
Example #6
0
 def loopStateCB(self, msg):
     trackNumber = msg[2]
     clipNumber = msg[3]
 
     if len(msg) == 4:
         self.oscServer.sendOSC("/live/loopstate", int(LiveUtils.getClip(trackNumber, clipNumber).looping))    
     
     elif len(msg) == 5:
         loopState = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).looping =  loopState
Example #7
0
 def loopEndCB(self, msg, source):
     type = msg[0] == '/live/clip/loopend_id' and 1 or 0
 
     trackNumber = msg[2]
     clipNumber = msg[3]    
     if len(msg) == 4:
         if type == 1:
             self.oscEndpoint.send("/live/clip/loopend", (trackNumber, clipNumber, float(LiveUtils.getClip(trackNumber, clipNumber).loop_end)))
         else:
             self.oscEndpoint.send("/live/clip/loopend", (float(LiveUtils.getClip(trackNumber, clipNumber).loop_end)))    
     
     elif len(msg) == 5:
         loopEnd = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).loop_end =  loopEnd
Example #8
0
 def loopEndCB(self, msg, source):
     type = msg[0] == '/live/clip/loopend_id' and 1 or 0
 
     trackNumber = msg[2]
     clipNumber = msg[3]    
     if len(msg) == 4:
         if type == 1:
             self.oscEndpoint.send("/live/clip/loopend", (trackNumber, clipNumber, float(LiveUtils.getClip(trackNumber, clipNumber).loop_end)))
         else:
             self.oscEndpoint.send("/live/clip/loopend", (float(LiveUtils.getClip(trackNumber, clipNumber).loop_end)))    
     
     elif len(msg) == 5:
         loopEnd = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).loop_end =  loopEnd
Example #9
0
    def nameClipCB(self, msg, source):
        """Called when a /live/name/clip message is received.

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

        """
        #Requesting all clip names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackNumber = 0
            clipNumber = 0
            for track in LiveUtils.getTracks():
                bundle = OSC.OSCBundle()
                for clipSlot in track.clip_slots:
                    if clipSlot.clip != None:
                        bundle.append(
                            "/live/name/clip",
                            (trackNumber, clipNumber, str(
                                clipSlot.clip.name), clipSlot.clip.color))
                    clipNumber = clipNumber + 1
                self.oscEndpoint.sendMessage(bundle)
                clipNumber = 0
                trackNumber = trackNumber + 1
            self.oscEndpoint.send("/live/name/clip/done", "bundle sended")
            return
        #Requesting a single clip name
        if len(msg) == 4:
            trackNumber = msg[2]
            clipNumber = msg[3]
            self.oscEndpoint.send(
                "/live/name/clip",
                (trackNumber, clipNumber,
                 str(LiveUtils.getClip(trackNumber, clipNumber).name),
                 LiveUtils.getClip(trackNumber, clipNumber).color))
            return
        #renaming a clip
        if len(msg) >= 5:
            trackNumber = msg[2]
            clipNumber = msg[3]
            name = msg[4]
            LiveUtils.getClip(trackNumber, clipNumber).name = name

        if len(msg) >= 6:
            trackNumber = msg[2]
            clipNumber = msg[3]
            color = msg[5]
            LiveUtils.getClip(trackNumber, clipNumber).color = color
Example #10
0
 def loopStateCB(self, msg, source):
     type = msg[0] == '/live/clip/loopstate_id' and 1 or 0
 
     trackNumber = msg[2]
     clipNumber = msg[3]
 
     if len(msg) == 4:
         if type == 1:
             self.oscEndpoint.send("/live/clip/loopstate", (trackNumber, clipNumber, int(LiveUtils.getClip(trackNumber, clipNumber).looping)))
         else:
             self.oscEndpoint.send("/live/clip/loopstate", (int(LiveUtils.getClip(trackNumber, clipNumber).looping)))    
     
     elif len(msg) == 5:
         loopState = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).looping =  loopState
Example #11
0
 def loopStateCB(self, msg, source):
     type = msg[0] == '/live/clip/loopstate_id' and 1 or 0
 
     trackNumber = msg[2]
     clipNumber = msg[3]
 
     if len(msg) == 4:
         if type == 1:
             self.oscEndpoint.send("/live/clip/loopstate", (trackNumber, clipNumber, int(LiveUtils.getClip(trackNumber, clipNumber).looping)))
         else:
             self.oscEndpoint.send("/live/clip/loopstate", (int(LiveUtils.getClip(trackNumber, clipNumber).looping)))    
     
     elif len(msg) == 5:
         loopState = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).looping =  loopState
Example #12
0
 def loopStartCB(self, msg):
     type = msg[0] == '/live/clip/loopstart_id' and 1 or 0
     
     trackNumber = msg[2]
     clipNumber = msg[3]
 
     if len(msg) == 4:
         if type == 1:
             self.oscServer.sendOSC("/live/clip/loopstart", (trackNumber, clipNumber, float(LiveUtils.getClip(trackNumber, clipNumber).loop_start)))    
         else:
             self.oscServer.sendOSC("/live/clip/loopstart", (float(LiveUtils.getClip(trackNumber, clipNumber).loop_start)))    
 
     elif len(msg) == 5:
         loopStart = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).loop_start = loopStart
Example #13
0
 def loopStartCB(self, msg):
     type = msg[0] == '/live/clip/loopstart_id' and 1 or 0
     
     trackNumber = msg[2]
     clipNumber = msg[3]
 
     if len(msg) == 4:
         if type == 1:
             self.oscServer.sendOSC("/live/clip/loopstart", (trackNumber, clipNumber, float(LiveUtils.getClip(trackNumber, clipNumber).loop_start)))    
         else:
             self.oscServer.sendOSC("/live/clip/loopstart", (float(LiveUtils.getClip(trackNumber, clipNumber).loop_start)))    
 
     elif len(msg) == 5:
         loopStart = msg[4]
         LiveUtils.getClip(trackNumber, clipNumber).loop_start = loopStart
Example #14
0
    def clipInfoCB(self,msg, source):
        """Called when a /live/clip/info message is received.
        
        Messages:
        /live/clip/info     (int track, int clip)      Gets the status of a single clip in the form  /live/clip/info (tracknumber, clipnumber, state, length)
                                                       [state: 1 = Has Clip, 2 = Playing, 3 = Triggered]
        """
        
        if len(msg) == 4:
            trackNumber = msg[2]
            clipNumber = msg[3]    
            
            clip = LiveUtils.getClip(trackNumber, clipNumber)
            
            playing = 0
            length = 0
            
            if clip != None:
                length = clip.length
                playing = 1
                
                if clip.is_playing == 1:
                    playing = 2
                elif clip.is_triggered == 1:
                    playing = 3

            self.oscEndpoint.send("/live/clip/info", (trackNumber, clipNumber, playing, length))
        
        return
Example #15
0
    def clipInfoCB(self, msg):
        """Called when a /live/clip/info message is received.
        
        Messages:
        /live/clip/info     (int track, int clip)      Gets the status of a single clip in the form  /live/clip/info (tracknumber, clipnumber, state)
                                                       [state: 1 = Has Clip, 2 = Playing, 3 = Triggered]
        """

        if len(msg) == 4:
            trackNumber = msg[2]
            clipNumber = msg[3]

            clip = LiveUtils.getClip(trackNumber, clipNumber)

            playing = 0

            if clip != None:
                playing = 1

                if clip.is_playing == 1:
                    playing = 2
                elif clip.is_triggered == 1:
                    playing = 3

            self.oscEndpoint.send("/live/clip/info",
                                  (trackNumber, clipNumber, playing))

        return
Example #16
0
    def addNoteCB(self, msg, source):
        """Called when a /live/clip/add_note message is received

        Messages:
        /live/clip/add_note (int pitch) (double time) (double duration) (int velocity) (bool muted)    Add the given note to the clip
        """
        trackNumber = msg[2]
        clipNumber = msg[3]
        pitch = msg[4]
        time = msg[5]
        duration = msg[6]
        velocity = msg[7]
        muted = msg[8]
        LiveUtils.getClip(trackNumber, clipNumber).deselect_all_notes()

        notes = ((pitch, time, duration, velocity, muted),)
        LiveUtils.getClip(trackNumber, clipNumber).replace_selected_notes(notes)
        self.oscEndpoint.send('/live/clip/note', (trackNumber, clipNumber, pitch, time, duration, velocity, muted))
Example #17
0
    def addNoteCB(self, msg, source):
        """Called when a /live/clip/add_note message is received

        Messages:
        /live/clip/add_note (int pitch) (double time) (double duration) (int velocity) (bool muted)    Add the given note to the clip
        """
        trackNumber = msg[2]
        clipNumber = msg[3]
        pitch = msg[4]
        time = msg[5]
        duration = msg[6]
        velocity = msg[7]
        muted = msg[8]
        LiveUtils.getClip(trackNumber, clipNumber).deselect_all_notes()

        notes = ((pitch, time, duration, velocity, muted),)
        LiveUtils.getClip(trackNumber, clipNumber).replace_selected_notes(notes)
        self.oscEndpoint.send('/live/clip/note', (trackNumber, clipNumber, pitch, time, duration, velocity, muted))
Example #18
0
    def getNotesCB(self, msg):
        """Called when a /live/clip/notes message is received

        Messages:
        /live/clip/notes    Return all notes in the clip in /live/clip/note messages.  Each note is sent in the format
                            (int trackNumber) (int clipNumber) (int pitch) (double time) (double duration) (int velocity) (int muted)
        """
        trackNumber = msg[2]
        clipNumber = msg[3]
        LiveUtils.getClip(trackNumber, clipNumber).select_all_notes()
        for note in LiveUtils.getClip(trackNumber, clipNumber).get_selected_notes():
            pitch = note[0]
            time = note[1]
            duration = note[2]
            velocity = note[3]
            muted = 0
            if note[4]:
                muted = 1
            self.oscServer.sendOSC('/live/clip/note', (trackNumber, clipNumber, pitch, time, duration, velocity, muted));
Example #19
0
    def nameClipCB(self, msg, source):
        """Called when a /live/name/clip message is received.

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

        """
        #Requesting all clip names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackNumber = 0
            clipNumber = 0
            for track in LiveUtils.getTracks():
                bundle = OSC.OSCBundle()
                for clipSlot in track.clip_slots:
                    if clipSlot.clip != None:
                        bundle.append("/live/name/clip", (trackNumber, clipNumber, str(clipSlot.clip.name), clipSlot.clip.color))
                    clipNumber = clipNumber + 1
                self.oscEndpoint.sendMessage(bundle)
                clipNumber = 0
                trackNumber = trackNumber + 1
            self.oscEndpoint.send("/live/name/clip/done", "bundle sended")
            return
        #Requesting a single clip name
        if len(msg) == 4:
            trackNumber = msg[2]
            clipNumber = msg[3]
            self.oscEndpoint.send("/live/name/clip", (trackNumber, clipNumber, str(LiveUtils.getClip(trackNumber, clipNumber).name), LiveUtils.getClip(trackNumber, clipNumber).color))
            return
        #renaming a clip
        if len(msg) >= 5:
            trackNumber = msg[2]
            clipNumber = msg[3]
            name = msg[4]
            LiveUtils.getClip(trackNumber, clipNumber).name = name

        if len(msg) >= 6:
            trackNumber = msg[2]
            clipNumber = msg[3]
            color = msg[5]
            LiveUtils.getClip(trackNumber, clipNumber).color = color
Example #20
0
    def getNotesCB(self, msg, source):
        """Called when a /live/clip/notes message is received

        Messages:
        /live/clip/notes    Return all notes in the clip in /live/clip/note messages.  Each note is sent in the format
                            (int trackNumber) (int clipNumber) (int pitch) (double time) (double duration) (int velocity) (int muted)
        """
        trackNumber = msg[2]
        clipNumber = msg[3]
        LiveUtils.getClip(trackNumber, clipNumber).select_all_notes()
        bundle = OSC.OSCBundle()
        for note in LiveUtils.getClip(trackNumber, clipNumber).get_selected_notes():
            pitch = note[0]
            time = note[1]
            duration = note[2]
            velocity = note[3]
            muted = 0
            if note[4]:
                muted = 1
            bundle.append('/live/clip/note', (trackNumber, clipNumber, pitch, time, duration, velocity, muted))
        self.oscEndpoint.sendMessage(bundle)
Example #21
0
	def muteClipCB(self, msg, source):
		"""Called when a /live/clip/mute message is received.
		
		Messages:
		/live/clip/view	 (int track, int clip)	  Selects a clip to mute.
		"""
		# use LogServer.py to read logs
		# log("muting")
		trackNumber = msg[2]
		clipNumber = msg[3]
		muted = msg[4]
		
		clip = LiveUtils.getClip(trackNumber, clipNumber)
		clip.muted = bool(muted)
Example #22
0
    def nameClipBlockCB(self, msg, source):
        """Called when a /live/name/clipblock message is received.

        /live/name/clipblock    (int track, int clip, blocksize x/tracks, blocksize y/clipslots) Returns a list of clip names for a block of clips (int blockX, int blockY, clipname)

        """
        #Requesting a block of clip names X1 Y1 X2 Y2 where X1,Y1 is the first clip (track, clip) of the block, X2 the number of tracks to cover and Y2 the number of scenes
        
        if len(msg) == 6:
            block = []
            trackOffset = msg[2]
            clipOffset = msg[3]
            blocksizeX = msg[4]
            blocksizeY = msg[5]
            for clip in range(0, blocksizeY):
                for track in range(0, blocksizeX):
                        trackNumber = trackOffset+track
                        clipNumber = clipOffset+clip
                        if LiveUtils.getClip(trackNumber, clipNumber) != None:
                            block.extend([str(LiveUtils.getClip(trackNumber, clipNumber).name)])
                        else:
                            block.extend([""])
                            
            self.oscEndpoint.send("/live/name/clipblock", block)
Example #23
0
    def scene_change(self):
        selected_scene = self.song().view.selected_scene
        scenes = self.song().scenes
        index = 0
        selected_index = 0
        for scene in scenes:
            index = index + 1
            if scene == selected_scene:
                selected_index = index

        if selected_index != self.scene:
            self.scene = selected_index
            self.oscServer.sendOSC("/live/scene", (selected_index))
            if LiveUtils.getClip(0, (selected_index - 1)) == None:
                str1 = 'Empty'
            else:
                str1 = (str(LiveUtils.getClip(0, (selected_index - 1)).name))

            if LiveUtils.getClip(1, (selected_index - 1)) == None:
                str2 = 'Empty'
            else:
                str2 = (str(LiveUtils.getClip(1, (selected_index - 1)).name))

            if LiveUtils.getClip(2, (selected_index - 1)) == None:
                str3 = 'Empty'
            else:
                str3 = (str(LiveUtils.getClip(2, (selected_index - 1)).name))

            if LiveUtils.getClip(3, (selected_index - 1)) == None:
                str4 = 'Empty'
            else:
                str4 = (str(LiveUtils.getClip(3, (selected_index - 1)).name))

            self.oscServer.sendOSC("/live/name/clipfromscene/1", str1)
            self.oscServer.sendOSC("/live/name/clipfromscene/2", str2)
            self.oscServer.sendOSC("/live/name/clipfromscene/3", str3)
            self.oscServer.sendOSC("/live/name/clipfromscene/4", str4)
Example #24
0
    def scene_change(self):
        selected_scene = self.song().view.selected_scene
        scenes = self.song().scenes
        index = 0
        selected_index = 0
        for scene in scenes:
            index = index + 1        
            if scene == selected_scene:
                selected_index = index
                
        if selected_index != self.scene:
            self.scene = selected_index
            self.oscServer.sendOSC("/live/scene", (selected_index))
            if LiveUtils.getClip(0, (selected_index - 1)) == None:
                str1 = 'Empty'
            else:
                str1 = (str(LiveUtils.getClip(0, (selected_index - 1)).name))
                
            if LiveUtils.getClip(1, (selected_index - 1)) == None:
                str2 = 'Empty'
            else:
                str2 = (str(LiveUtils.getClip(1, (selected_index - 1)).name))

            if LiveUtils.getClip(2, (selected_index - 1)) == None:
                str3 = 'Empty'
            else:
                str3 = (str(LiveUtils.getClip(2, (selected_index - 1)).name))
                
            if LiveUtils.getClip(3, (selected_index - 1)) == None:
                str4 = 'Empty'
            else:
                str4 = (str(LiveUtils.getClip(3, (selected_index - 1)).name))

            self.oscServer.sendOSC("/live/name/clipfromscene/1", str1)
            self.oscServer.sendOSC("/live/name/clipfromscene/2", str2)
            self.oscServer.sendOSC("/live/name/clipfromscene/3", str3)
            self.oscServer.sendOSC("/live/name/clipfromscene/4", str4)
Example #25
0
    def nameClipFromSceneCB(self, msg):
        """Called when a /live/name/clip message is received.

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

        """
        if len(msg) == 3:
            selected_scene = LiveUtils.getSong().view.selected_scene
            scenes = LiveUtils.getScenes()
            index = 0
            selected_index = 0
            for scene in scenes:
                index = index + 1
                if scene == selected_scene:
                    selected_index = index
            trackNumber = msg[2]
            clipNumber = selected_index
            self.oscServer.sendOSC(
                "/live/name/clipfromscene/" + str(selected_index),
                (str(LiveUtils.getClip(trackNumber, clipNumber).name)))
            return
    def nameClipFromSceneCB(self, msg):
        """Called when a /live/name/clip message is received.

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

        """
        if len(msg) == 3:
            selected_scene = LiveUtils.getSong().view.selected_scene
            scenes = LiveUtils.getScenes()
            index = 0
            selected_index = 0
            for scene in scenes:
                index = index + 1        
                if scene == selected_scene:
                    selected_index = index
            trackNumber = msg[2]
            clipNumber = selected_index
            self.oscServer.sendOSC("/live/name/clipfromscene/" + str(selected_index), (str(LiveUtils.getClip(trackNumber, clipNumber).name)))
            return