Пример #1
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
Пример #2
0
 def mviewDeviceCB(self, msg, source):
     track = LiveUtils.getSong().master_track
     
     if len(msg) == 3:
         LiveUtils.getSong().view.selected_track = track
         LiveUtils.getSong().view.select_device(track.devices[msg[2]])
         Live.Application.get_application().view.show_view("Detail/DeviceChain")
Пример #3
0
    def stopCB(self, msg, source):
        """Called when a /live/stop message is received.

        Messages:
        /live/stop              Stops playing the song
        """
        LiveUtils.stop()
Пример #4
0
 def undoCB(self, msg):
     """Called when a /live/undo message is received.
     
     Messages:
     /live/undo      Requests the song to undo the last action
     """
     LiveUtils.getSong().undo()
Пример #5
0
 def devicerangeCB(self, msg, source):
     ty = msg[0] == '/live/return/device/range' and 1 or 0
     track = msg[2]
 
     if len(msg) == 4:
         device = msg[3]
         po = [track, device]
         
         if ty == 1:
             params = LiveUtils.getSong().return_tracks[track].devices[device].parameters
         else:
             params = LiveUtils.getSong().visible_tracks[track].devices[device].parameters
 
         for i in range(len(params)):
             po.append(i)
             po.append(params[i].min)
             po.append(params[i].max)
         
         self.oscEndpoint.send(ty == 1 and "/live/return/device/range" or "/live/device/range", tuple(po))
 
     elif len(msg) == 5:
         device = msg[3]
         param  = msg[4]
         
         if ty == 1:
             p = LiveUtils.getSong().return_tracks[track].devices[device].parameters[param]
         else: 
             p = LiveUtils.getSong().visible_tracks[track].devices[device].parameters[param]
     
         self.oscEndpoint.send(ty == 1 and "/live/return/device/range" or "/live/device/range", (track, device, param, p.min, p.max))
Пример #6
0
 def crossfaderCB(self, msg, source):
     if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
         self.oscEndpoint.send("/live/master/crossfader", float(LiveUtils.getSong().master_track.mixer_device.crossfader.value))
     
     elif len(msg) == 3:
         val = msg[2]
         LiveUtils.getSong().master_track.mixer_device.crossfader.value = val
Пример #7
0
    def playCB(self, msg, source):
        """Called when a /live/play message is received.

        Messages:
        /live/play              Starts the song playing
        """
        LiveUtils.play()
Пример #8
0
    def playContinueCB(self, msg, source):
        """Called when a /live/play/continue message is received.

        Messages:
        /live/play/continue     Continues playing the song from the current point
        """
        LiveUtils.continuePlaying()
Пример #9
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), 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
Пример #10
0
    def nextCueCB(self, msg, source):
        """Called when a /live/next/cue message is received.

        Messages:
        /live/next/cue              Jumps to the next cue point
        """
        LiveUtils.jumpToNextCue()
Пример #11
0
    def nameTrackCB(self, msg, source):
        """Called when a /live/name/track message is received.

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

        """
        #Requesting all track names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackNumber = 0
            bundle = OSC.OSCBundle()
            for track in LiveUtils.getTracks():
                bundle.append("/live/name/track", (trackNumber, str(track.name),int(track.has_midi_input),int(track.color)))
                trackNumber = trackNumber + 1
            self.oscEndpoint.sendMessage(bundle)
            return
        #Requesting a single track name
        if len(msg) == 3:
            trackNumber = msg[2]
            self.oscEndpoint.send("/live/name/track", (trackNumber, str(LiveUtils.getTrack(trackNumber).name),int(LiveUtils.getTrack(trackNumber).has_midi_input),int(LiveUtils.getTrack(trackNumber).color)))
            return
        #renaming a track
        if len(msg) == 4:
            trackNumber = msg[2]
            name = msg[3]
            LiveUtils.getTrack(trackNumber).name = name
Пример #12
0
    def playSelectionCB(self, msg, source):
        """Called when a /live/play/selection message is received.

        Messages:
        /live/play/selection    Plays the current selection
        """
        LiveUtils.playSelection()
Пример #13
0
    def nameTrackCB(self, msg):
        """Called when a /live/name/track message is received.

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

        """        
        #Requesting all track names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackNumber = 0
            for track in LiveUtils.getTracks():
                self.oscServer.sendOSC("/live/name/track", (trackNumber, str(track.name)))
                trackNumber = trackNumber + 1
            return
        #Requesting a single track name
        if len(msg) == 3:
            trackNumber = msg[2]
            self.oscServer.sendOSC("/live/name/track", (trackNumber, str(LiveUtils.getTrack(trackNumber).name)))
            return
        #renaming a track
        if len(msg) == 4:
            trackNumber = msg[2]
            name = msg[3]
            LiveUtils.getTrack(trackNumber).name = name
Пример #14
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
Пример #15
0
    def prevCueCB(self, msg, source):
        """Called when a /live/prev/cue message is received.

        Messages:
        /live/prev/cue              Jumps to the previous cue point
        """
        LiveUtils.jumpToPrevCue()
Пример #16
0
    def nameReturnCB(self, msg, source):
        """Called when a /live/name/return message is received.

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

        """
        #Requesting all track names
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackNumber = 0
            bundle = OSC.OSCBundle()
            for track in LiveUtils.getSong().return_tracks:
                bundle.append("/live/name/return", (trackNumber, str(track.name)))
                trackNumber = trackNumber + 1
            self.oscEndpoint.sendMessage(bundle)
            return
        #Requesting a single track name
        if len(msg) == 3:
            trackNumber = msg[2]
            self.oscEndpoint.send("/live/name/return", (trackNumber, str(LiveUtils.getSong().return_tracks[trackNumber].name)))
            return
        #renaming a track
        if len(msg) == 4:
            trackNumber = msg[2]
            name = msg[3]
            LiveUtils.getSong().return_tracks[trackNumber].name = name
Пример #17
0
 def redoCB(self, msg, source):
     """Called when a /live/redo message is received.
     
     Messages:
     /live/redo      Requests the song to redo the last action
     """
     LiveUtils.getSong().redo()
Пример #18
0
 def mdeviceCB(self, msg, source):
     if len(msg) == 3:
         device = msg[2]
         po = [device]
         
         params = LiveUtils.getSong().master_track.devices[device].parameters
 
         for i in range(len(params)):
             po.append(i)
             po.append(float(params[i].value))
             po.append(str(params[i].name))
         
         self.oscEndpoint.send("/live/master/device", tuple(po))
 
     elif len(msg) == 4:
         device = msg[2]
         param  = msg[3]
         
         p = LiveUtils.getSong().master_track.devices[device].parameters[param]
     
         self.oscEndpoint.send("/live/master/device", (device, param, p.value, str(p.name)))
 
     elif len(msg) == 5:
         device = msg[2]
         param  = msg[3]
         value  = msg[4]
     
         LiveUtils.getSong().master_track.devices[device].parameters[param].value = value
 def tactileY(self, msg):
     """Called when a "/mrmr/tactilezoneY/49/iPhone1 message is received."""
     value = msg[2]
     value *= 128.0
     LiveUtils.getSong().visible_tracks[38].devices[0].parameters[2].value = value
     LiveUtils.getSong().visible_tracks[39].devices[0].parameters[2].value = value
     LiveUtils.getSong().visible_tracks[40].devices[0].parameters[2].value = value
     LiveUtils.getSong().visible_tracks[41].devices[0].parameters[2].value = value
Пример #20
0
    def playSceneCB(self, msg, source):
        """Called when a /live/play/scene message is received.

        Messages:
        /live/play/scene    (int scene)     Launches scene number scene
        """
        if len(msg) == 3:
            scene = msg[2]
            LiveUtils.launchScene(scene)
Пример #21
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
Пример #22
0
    def unsoloTrackCB(self, msg):
        """Called when a /live/unsolo message is received.

        Messages:
        /live/unsolo     (int track)   Unsolos track number track
        """
        if len(msg) == 3:
            track = msg[2]
            LiveUtils.unsoloTrack(track)
Пример #23
0
    def stopTrackCB(self, msg, source):
        """Called when a /live/stop/track message is received.

        Messages:
        /live/stop/track     (int track, int clip)   Stops track number track
        """
        if len(msg) == 3:
            track = msg[2]
            LiveUtils.stopTrack(track)
Пример #24
0
    def disarmTrackCB(self, msg):
        """Called when a /live/disarm message is received.

        Messages:
        /live/disarm     (int track)   Disarms track number track
        """
        if len(msg) == 3:
            track = msg[2]
            LiveUtils.disarmTrack(track)
Пример #25
0
    def playClipCB(self, msg, source):
        """Called when a /live/play/clip message is received.

        Messages:
        /live/play/clip     (int track, int clip)   Launches clip number clip in track number track
        """
        if len(msg) == 4:
            track = msg[2]
            clip = msg[3]
            LiveUtils.launchClip(track, clip)
Пример #26
0
    def mviewTrackCB(self, msg, source):
        """Called when a /live/master/view message is received.
        
        Messages:
        /live/track/view     (int track)      Selects a track to view
        """
        track = LiveUtils.getSong().master_track

        LiveUtils.getSong().view.selected_track = track
        Live.Application.get_application().view.show_view("Detail/DeviceChain")        
Пример #27
0
    def stopClipCB(self, msg, source):
        """Called when a /live/stop/clip message is received.

        Messages:
        /live/stop/clip     (int track, int clip)   Stops clip number clip in track number track
        """
        if len(msg) == 4:
            track = msg[2]
            clip = msg[3]
            LiveUtils.stopClip(track, clip)
Пример #28
0
 def viewSceneCB(self, msg, source):
     """Called when a /live/scene/view message is received.
     
     Messages:
     /live/scene/view     (int track)      Selects a track to view
     """
     
     if len(msg) == 3:
         scene = msg[2]
         LiveUtils.getSong().view.selected_scene = LiveUtils.getSong().scenes[scene]
Пример #29
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
Пример #30
0
 def stateCB(self, msg, source):
     """Called when a /live/state is received.
     
     Messages:
     /live/state                    Returns the current tempo and overdub status
     """
     if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
         tempo = LiveUtils.getTempo()
         overdub = LiveUtils.getSong().overdub
         self.oscEndpoint.send("/live/state", (tempo, int(overdub)))
Пример #31
0
 def viewTrackCB(self, msg, source):
     """Called when a /live/track/view message is received.
     
     Messages:
     /live/track/view     (int track)      Selects a track to view
     """
     ty = msg[0] == '/live/return/view' and 1 or 0
     track_num = msg[2]
     
     if len(msg) == 3:
         if ty == 1:
             track = LiveUtils.getSong().return_tracks[track_num]
         else:
             track = LiveUtils.getSong().visible_tracks[track_num]
             
         LiveUtils.getSong().view.selected_track = track
         Live.Application.get_application().view.show_view("Detail/DeviceChain")
Пример #32
0
    def armTrackCB(self, msg, source):
        """Called when a /live/arm message is received.

        Messages:
        /live/arm     (int track)   (int armed/disarmed)     Arms track number track
        """
        track = msg[2]
        
        if len(msg) == 4:
            if msg[3] == 1:
                LiveUtils.armTrack(track)
            else:
                LiveUtils.disarmTrack(track)
        # Return arm status        
        elif len(msg) == 3:
            status = LiveUtils.getTrack(track).arm
            self.oscEndpoint.send("/live/arm", (track, int(status)))     
Пример #33
0
    def devicelistCB(self, msg):
        ty = msg[0] == '/live/return/devicelist' and 1 or 0

        track = msg[2]
    
        if len(msg) == 3:
            do = [track]
            
            if ty == 1:
                devices = LiveUtils.getSong().return_tracks[track].devices
            else:
                devices = LiveUtils.getSong().tracks[track].devices
        
            for i in range(len(devices)):
                do.append(i)
                do.append(str(devices[i].name))
            
            self.oscServer.sendOSC(ty == 1 and "/live/return/devicelist" or "/live/devicelist", tuple(do))
Пример #34
0
    def pitchCB(self, msg):
        """Called when a /live/pitch message is received.

        Messages:
        /live/pitch     (int track, int clip)                                               Returns the pan of track number track as: /live/pan (int track, int clip, int coarse(-48 to 48), int fine (-50 to 50))
        /live/pitch     (int track, int clip, int coarse(-48 to 48), int fine (-50 to 50))  Sets clip number clip in track number track's pitch to coarse / fine

        """
        if len(msg) == 6:
            track = msg[2]
            clip = msg[3]
            coarse = msg[4]
            fine = msg[5]
            LiveUtils.clipPitch(track, clip, coarse, fine)
        if len(msg) ==4:
            track = msg[2]
            clip = msg[3]
            self.oscServer.sendOSC("/live/pitch", LiveUtils.clipPitch(track, clip))
Пример #35
0
 def trname_changestate(self, tid, track, r=0):
     if r == 1:
         self.oscEndpoint.send('/live/name/return', (tid, str(track.name)))
     else:
         # self.oscEndpoint.send('/live/name/track', (tid, str(track.name), track.color))
         self.oscEndpoint.send(
             "/live/name/track",
             (tid, str(track.name), track.color, int(track.has_midi_input)))
         self.trBlock(0, len(LiveUtils.getTracks()))
Пример #36
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))
Пример #37
0
 def overdubCB(self, msg, source):
     """Called when a /live/overdub message is received.
     
     Messages:
     /live/overdub     (int on/off)      Enables/disables overdub
     """
     if len(msg) == 3:
         overdub = msg[2]
         LiveUtils.getSong().overdub = overdub
Пример #38
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
Пример #39
0
    def mdevicelistCB(self, msg, source):
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            do = []
            devices = LiveUtils.getSong().master_track.devices

            for i in range(len(devices)):
                do.append(i)
                do.append(str(devices[i].name))

            self.oscEndpoint.send("/live/master/devicelist", tuple(do))
Пример #40
0
 def loadedSongs(self):
     controlHashes = []
     controlTrack = LiveUtils.getTrack(0)
     for slot in controlTrack.clip_slots:
         if slot.has_clip:
             #slotName = slot.clip.name
             #nameParts = slotName.split(CONTROL_CLIP_IDENTIFIER)
             songID = findName(slot.clip.name, CONTROL_CLIP_IDENTIFIER)
             if not songID in controlHashes:
                 controlHashes.append(str(songID))
     return controlHashes
Пример #41
0
    def scenesCB(self, msg):
        """Called when a /live/scenes message is received.

        Messages:
        /live/scenes        no argument or 'query'  Returns the total number of scenes

        """
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            sceneTotal = len(LiveUtils.getScenes())
            self.oscServer.sendOSC("/live/scenes", (sceneTotal))
            return
Пример #42
0
    def trackJump(self, msg, source):
        """Called when a /live/track/jump message is received.

        Messages:
        /live/track/jump     (int track, float beats)   Jumps in track's currently running session clip by beats
        """
        if len(msg) == 4:
            track = msg[2]
            beats = msg[3]
            track = LiveUtils.getTrack(track)
            track.jump_in_running_session_clip(beats)
Пример #43
0
    def tracksCB(self, msg, source):
        """Called when a /live/tracks message is received.

        Messages:
        /live/tracks       no argument or 'query'  Returns the total number of scenes

        """
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            trackTotal = len(LiveUtils.getTracks())
            self.oscEndpoint.send("/live/tracks", (trackTotal))
            return
Пример #44
0
    def scanMulti(self, msg, source):

        self.oscEndpoint.sendMessage(OSC.OSCMessage("/multi/start/"))
        index = 0
        for scene in LiveUtils.getSong().scenes:
            self.oscEndpoint.sendMessage(
                OSC.OSCMessage("/multi/section/",
                               (int(index), str(scene.is_empty), str(
                                   scene.name), float(scene.tempo))))
            index += 1
        self.oscEndpoint.sendMessage(OSC.OSCMessage("/multi/end/"))
Пример #45
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
Пример #46
0
    def playSelectedClipCB(self, msg):
        """Called when a /live/play/clipslot message is received.

        Messages:
        /live/play/clipslot     (int track)   Launches current scenes clipslot in track number track
        """
        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
            track_num = msg[2]
            clip_num = (selected_index - 1)
            track = LiveUtils.getTrack(track_num)
            clipslot = track.clip_slots[clip_num]
            clipslot.fire()
Пример #47
0
    def __init__(self, trackID):
        self.trackID = trackID

        self.track = LiveUtils.getTrack(self.trackID)

        callback = lambda: self.slot_changed()

        # make sure we get notified whenever a new clip starts playing by putting a listener on the Track
        self.track.add_playing_slot_index_listener(callback)

        log("Clip Monitor initialized on Track " + str(self.trackID))
Пример #48
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
            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
Пример #49
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
Пример #50
0
 def mdevicerangeCB(self, msg):
     if len(msg) == 3:
         device = msg[2]
         po = [device]
         
         params = LiveUtils.getSong().master_track.devices[device].parameters
 
         for i in range(len(params)):
             po.append(i)
             po.append(params[i].max)
             po.append(params[i].min)
         
         self.oscServer.sendOSC("/live/master/device/range", tuple(po))
 
     elif len(msg) == 4:
         device = msg[2]
         param  = msg[3]
         
         p = LiveUtils.getSong().master_track.devices[device].parameters[param]
     
         self.oscServer.sendOSC("/live/master/device/range", (device, param, p.min, p.max))
Пример #51
0
 def sceneCB(self, msg, source):
     """Called when a /live/scene message is received.
     
     Messages:
     /live/scene         no argument or 'query'  Returns the currently playing scene number
     """
     if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
         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
                 
         self.oscEndpoint.send("/live/scene", (selected_index))
         
     elif len(msg) == 3:
         scene = msg[2]
         LiveUtils.getSong().view.selected_scene = LiveUtils.getSong().scenes[scene]
Пример #52
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)
Пример #53
0
 def playClipSlotCB(self, msg, source):
     """Called when a /live/play/clipslot message is received.
     
     Messages:
     /live/play/clipslot     (int track, int clip)   Launches clip number clip in track number track
     """
     if len(msg) == 4:
         track_num = msg[2]
         clip_num = msg[3]
         track = LiveUtils.getTrack(track_num)
         clipslot = track.clip_slots[clip_num]
         clipslot.fire()
Пример #54
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)
Пример #55
0
    def nameTrackBlockCB(self, msg):
        """Called when a /live/name/trackblock message is received.

        /live/name/trackblock    (int offset, int blocksize) Returns a list of blocksize track names starting at offset
        """
        if len(msg) == 4:
            block = []
            trackOffset = msg[2]
            blocksize = msg[3]
            for track in range(0, blocksize):
                block.extend([str(LiveUtils.getTrack(trackOffset+track).name)])                            
            self.oscServer.sendOSC("/live/name/trackblock", block)
Пример #56
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
Пример #57
0
 def addControlClips(self, songID):
     controlTrack = LiveUtils.getTrack(0)
     slotNumber = 0
     for slot in controlTrack.clip_slots:
         if not slot.has_clip:
             signature_denominator = LiveUtils.getSong(
             ).signature_denominator
             signature_numerator = LiveUtils.getSong().signature_numerator
             if slotNumber in self.sceneScanLengths.keys():
                 info = self.sceneScanLengths[slotNumber]
                 length = info['length']
                 signature_numerator = int(info['signature_numerator'])
                 signature_denominator = int(info['signature_denominator'])
             else:
                 length = 4.0
             slot.create_clip(length)
             slot.clip.signature_numerator = signature_numerator
             slot.clip.signature_denominator = signature_denominator
             slot.length = length
             slot.clip.name = CONTROL_CLIP_IDENTIFIER + " " + songID
         slotNumber = slotNumber + 1
Пример #58
0
    def device_changestate(self, track, tid, type):

        did = self.tuple_idx(track.devices, track.view.selected_device)

        if type == 2:
            devices = LiveUtils.getSong().master_track.devices
            nm = str(devices[int(did)].name)
            params = LiveUtils.getSong().master_track.devices[did].parameters
            onoff = params[0].value
            num = len(devices)
            self.oscEndpoint.send('/master/selected_device',
                                  (1, did, nm, onoff, num))
        elif type == 1:
            devices = LiveUtils.getSong().return_tracks[tid].devices
            nm = str(devices[int(did)].name)
            params = LiveUtils.getSong(
            ).return_tracks[tid].devices[did].parameters
            onoff = params[0].value
            num = len(devices)
            self.oscEndpoint.send('/return/selected_device',
                                  (2, tid, did, nm, onoff, num))
        else:
            devices = LiveUtils.getSong().tracks[tid].devices
            nm = str(devices[int(did)].name)
            params = LiveUtils.getSong().tracks[tid].devices[did].parameters
            onoff = params[0].value
            num = len(devices)
            self.oscEndpoint.send('/track/selected_device',
                                  (0, tid, did, nm, onoff, num))
Пример #59
0
    def trackxfaderCB(self, msg, source):
        """ Called when a /live/track/crossfader or /live/return/crossfader message is received
        """
        ty = msg[0] == '/live/return/crossfader' and 1 or 0

        if len(msg) == 3:
            track = msg[2]

            if ty == 1:
                assign = LiveUtils.getSong(
                ).return_tracks[track].mixer_device.crossfade_assign
                name = LiveUtils.getSong().return_tracks[
                    track].mixer_device.crossfade_assignments.values[assign]

                self.oscEndpoint.send("/live/return/crossfader",
                                      (track, str(assign), str(name)))
            else:
                assign = LiveUtils.getSong(
                ).visible_tracks[track].mixer_device.crossfade_assign
                name = LiveUtils.getSong().visible_tracks[
                    track].mixer_device.crossfade_assignments.values[assign]

                self.oscEndpoint.send("/live/track/crossfader",
                                      (track, str(assign), str(name)))

        elif len(msg) == 4:
            track = msg[2]
            assign = msg[3]

            if ty == 1:
                LiveUtils.getSong(
                ).return_tracks[track].mixer_device.crossfade_assign = assign
            else:
                LiveUtils.getSong(
                ).visible_tracks[track].mixer_device.crossfade_assign = assign
Пример #60
0
    def add_clip_listeners(self):
        self.rem_clip_listeners()

        track = LiveUtils.getTrack(LIVE_CONTROL_TRACK)
        slot_index = 0
        for slot in track.clip_slots:
            if slot.has_clip:
                self.add_cliplistener(slot.clip, LIVE_CONTROL_TRACK,
                                      slot_index)
                log("Added clip listener track: " + str(LIVE_CONTROL_TRACK) +
                    " clip: " + str(slot_index))
            slot_index += 1
        """