예제 #1
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)))
예제 #2
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)))
예제 #3
0
    def tempoCB(self, msg):
        """Called when a /live/tempo message is received.

        Messages:
        /live/tempo                 Request current tempo, replies with /live/tempo (float tempo)
        /live/tempo (float tempo)   Set the tempo, replies with /live/tempo (float tempo)
        """
        if len(msg) == 3:
            tempo = msg[2]
            LiveUtils.setTempo(tempo)
        self.oscServer.sendOSC("/live/tempo", LiveUtils.getTempo())
예제 #4
0
 def stateCB(self, msg):
     tempo = LiveUtils.getTempo()
     overdub = LiveUtils.getSong().overdub
     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.oscServer.sendOSC("/live/state", (tempo, overdub, selected_index))
예제 #5
0
    def tempoCB(self, msg, source):
        """Called when a /live/tempo message is received.

        Messages:
        /live/tempo                 Request current tempo, replies with /live/tempo (float tempo)
        /live/tempo (float tempo)   Set the tempo, replies with /live/tempo (float tempo)
        """
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            self.oscEndpoint.send("/live/tempo", LiveUtils.getTempo())
        
        elif len(msg) == 3:
            tempo = msg[2]
            LiveUtils.setTempo(tempo)
예제 #6
0
    def tempoCB(self, msg, source):
        """Called when a /live/tempo message is received.

        Messages:
        /live/tempo                 Request current tempo, replies with /live/tempo (float tempo)
        /live/tempo (float tempo)   Set the tempo, replies with /live/tempo (float tempo)
        """
        if len(msg) == 2 or (len(msg) == 3 and msg[2] == "query"):
            self.oscEndpoint.send("/live/tempo", LiveUtils.getTempo())

        elif len(msg) == 3:
            tempo = msg[2]
            LiveUtils.setTempo(tempo)
예제 #7
0
 def tempo_change(self):
     tempo = LiveUtils.getTempo()
     self.oscEndpoint.send("/live/tempo", (tempo))
예제 #8
0
 def tempo_change(self):
     tempo = LiveUtils.getTempo()
     self.oscServer.sendOSC("/live/tempo", (tempo))
예제 #9
0
 def tempo_change(self):
     tempo = LiveUtils.getTempo()
     self.oscEndpoint.send("/live/tempo", (tempo))
예제 #10
0
파일: LiveOSC.py 프로젝트: dinchak/pages-2
    def tempo_change(self):
	tempo = LiveUtils.getTempo()
	self.oscServer.sendOSC("/live/tempo", (tempo))
예제 #11
0
    def scanScenes(self, songID):
        #cycle through the scenes for IDs

        sceneNumber = 0
        self.sceneScanLengths = {}
        sceneIDs = []
        #songID = makeID()
        self.oscEndpoint.sendMessage(
            OSC.OSCMessage("/song/" + songID + "/start/"))
        tempo = LiveUtils.getTempo()
        self.oscEndpoint.sendMessage(
            OSC.OSCMessage("/song/" + songID + "/tempo/", float(tempo)))
        numerator = LiveUtils.getNumerator()
        self.oscEndpoint.sendMessage(
            OSC.OSCMessage("/song/" + songID + "/numerator/", int(numerator)))
        denominator = LiveUtils.getDenominator()
        self.oscEndpoint.sendMessage(
            OSC.OSCMessage("/song/" + songID + "/denominator/",
                           int(denominator)))
        #sceneBundle.append(OSC.OSCMessage("/scenes/start"))
        for scene in LiveUtils.getScenes():
            sceneArgs = {}
            sceneBundle = OSC.OSCBundle()
            sceneID = re.findall("(\#cS.{8})", scene.name)
            if (not sceneID):
                sceneID = SCENE_IDENTIFIER + self.makeID()
                sceneName = scene.name
                scene.name = scene.name + sceneID
            else:
                #sceneID = scene.name[idIndex:]
                try:
                    usedAlready = sceneIDs.index(sceneID)
                except ValueError:
                    usedAlready = -1
                if usedAlready != -1:
                    sceneID = SCENE_IDENTIFIER + self.makeID()
                    sceneName = scene.name[:usedAlready]
                    scene.name = sceneName + newID

            self.oscEndpoint.sendMessage(
                OSC.OSCMessage("/song/" + songID + "/scene/" + sceneID +
                               "/start/"))
            sceneIDs.append(sceneID)
            length, signature_numerator, signature_denominator = self.findLongestClip(
                sceneNumber)
            sceneSignature = re.findall("\d+\/\d+", scene.name)
            if (sceneSignature):
                separator = sceneSignature[0].find('/')
                signature_numerator = int(sceneSignature[0][:separator])
                separator += 1
                signature_denominator = int(sceneSignature[0][separator:])
                #log(signature_denominator)
            self.sceneScanLengths[sceneNumber] = {
                'length': length,
                'signature_numerator': signature_numerator,
                'signature_denominator': signature_denominator
            }
            sceneBundle.append(
                OSC.OSCMessage(
                    "/song/" + songID + "/scene/" + sceneID + "/abletonIndex/",
                    int(sceneNumber)))
            sceneBundle.append(
                OSC.OSCMessage(
                    "/song/" + songID + "/scene/" + sceneID + "/name/",
                    str(scene.name)))
            sceneBundle.append(
                OSC.OSCMessage(
                    "/song/" + songID + "/scene/" + sceneID + "/tempo/",
                    float(scene.tempo)))
            sceneBundle.append(
                OSC.OSCMessage(
                    "/song/" + songID + "/scene/" + sceneID + "/length/",
                    float(length)))
            sceneBundle.append(
                OSC.OSCMessage(
                    "/song/" + songID + "/scene/" + sceneID + "/numerator/",
                    int(signature_numerator)))
            sceneBundle.append(
                OSC.OSCMessage(
                    "/song/" + songID + "/scene/" + sceneID + "/denominator/",
                    int(signature_denominator)))

            self.oscEndpoint.sendMessage(sceneBundle)
            self.oscEndpoint.sendMessage(
                OSC.OSCMessage("/song/" + songID + "/scene/" + sceneID +
                               "/end/"))

            sceneNumber += 1
        self.oscEndpoint.sendMessage(
            OSC.OSCMessage("/song/" + songID + "/end/"))
        return