Changeset 12
- Timestamp:
- 03/07/09 15:23:23 (14 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
LiveControl/RemixNet.py (modified) (1 diff)
-
LiveOSC/LiveOSC.py (modified) (1 diff)
-
LiveOSC/LiveOSCCallbacks.py (modified) (2 diffs)
-
LiveOSC/OSCAPI.txt (modified) (1 diff)
-
LiveOSC/RemixNet.py (modified) (1 diff)
-
LiveOSC/__init__.py (modified) (1 diff)
-
TouchOSC/TouchOSC.py (modified) (5 diffs)
-
TouchOSC/touchosc_config.txt (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LiveControl/RemixNet.py
r10 r12 59 59 # 10.5 60 60 try: 61 file = open("/usr/lib/python2.5/string.py ")61 file = open("/usr/lib/python2.5/string.pyc") 62 62 except IOError: 63 exists = 064 63 sys.path.append("/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5") 64 import socket_live8 as socket 65 65 else: 66 66 sys.path.append("/usr/lib/python2.5") 67 68 import socket_live8 as socket 67 import socket 69 68 70 69 import OSC -
trunk/LiveOSC/LiveOSC.py
r2 r12 29 29 30 30 import Live 31 import socket32 31 import LiveOSCCallbacks 33 32 import RemixNet -
trunk/LiveOSC/LiveOSCCallbacks.py
r7 r12 254 254 for track in LiveUtils.getTracks(): 255 255 for clipSlot in track.clip_slots: 256 if clipSlot :257 self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(clipSlot.clip.name) ))256 if clipSlot.clip != None: 257 self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(clipSlot.clip.name), str(clipSlot.clip.color_index))) 258 258 clipNumber = clipNumber + 1 259 259 clipNumber = 0 260 260 trackNumber = trackNumber + 1 261 261 return 262 #Requesting a single scenename262 #Requesting a single clip name 263 263 if len(msg) == 4: 264 264 trackNumber = msg[2] 265 265 clipNumber = msg[3] 266 self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(LiveUtils.getClip(trackNumber, clipNumber).name) ))267 return 268 #renaming a scene266 self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, str(LiveUtils.getClip(trackNumber, clipNumber).name), str(LiveUtils.getClip(trackNumber, clipNumber).color_index))) 267 return 268 #renaming a clip 269 269 if len(msg) == 5: 270 270 trackNumber = msg[2] … … 419 419 /live/track/info (int track) Returns clip slot status' for all clips in a track in the form /live/track/info (tracknumber, armed (clipnumber, state, length)) 420 420 [state: 1 = Has Clip, 2 = Playing, 3 = Triggered] 421 """ 422 tracknum = -1421 """ 422 423 423 clipslots = LiveUtils.getClipSlots() 424 424 425 for track in clipslots: 425 new = [] 426 if len(msg) == 3: 427 new.append(clipslots[msg[2]]) 428 tracknum = msg[2] - 1 429 else: 430 new = clipslots 431 tracknum = -1 432 433 for track in new: 426 434 tracknum = tracknum + 1 427 435 clipnum = -1 -
trunk/LiveOSC/OSCAPI.txt
r7 r12 23 23 /live/name/scene (int scene) Returns a single scene's name in the form /live/name/scene (int scene, string name) 24 24 /live/name/scene (int scene, string name) Sets scene number scene's name to name 25 /live/name/track Returns a a series of all the track names in the form /live/name/track (int track, string name )26 /live/name/track (int track) Returns a single track's name in the form /live/name/track (int track, string name )25 /live/name/track Returns a a series of all the track names in the form /live/name/track (int track, string name, int color) 26 /live/name/track (int track) Returns a single track's name in the form /live/name/track (int track, string name, int color) 27 27 /live/name/track (int track, string name) Sets track number track's name to name 28 28 /live/name/clip Returns a a series of all the clip names in the form /live/name/clip (int track, int clip, string name) -
trunk/LiveOSC/RemixNet.py
r10 r12 59 59 # 10.5 60 60 try: 61 file = open("/usr/lib/python2.5/string.py ")61 file = open("/usr/lib/python2.5/string.pyc") 62 62 except IOError: 63 exists = 064 63 sys.path.append("/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5") 64 import socket_live8 as socket 65 65 else: 66 66 sys.path.append("/usr/lib/python2.5") 67 68 import socket_live8 as socket 67 import socket 69 68 70 69 import OSC -
trunk/LiveOSC/__init__.py
r10 r12 20 20 """ 21 21 22 #import sys23 import Live22 import sys 23 #import Live 24 24 25 #path = "/Live 8.0.3 OS X/Live.app/Contents/App-Resources/MIDI Remote Scripts/LiveOSC"26 #errorLog = open(path + "/stderr.txt", "w")27 #errorLog.write("Starting Error Log")28 #sys.stderr = errorLog29 #stdoutLog = open(path + "/stdout.txt", "w")30 #stdoutLog.write("Starting Standard Out Log")31 #sys.stdout = stdoutLog25 path = "/Live 8.0.3 OS X/Live.app/Contents/App-Resources/MIDI Remote Scripts/LiveOSC" 26 errorLog = open(path + "/stderr.txt", "w") 27 errorLog.write("Starting Error Log") 28 sys.stderr = errorLog 29 stdoutLog = open(path + "/stdout.txt", "w") 30 stdoutLog.write("Starting Standard Out Log") 31 sys.stdout = stdoutLog 32 32 33 33 from LiveOSC import LiveOSC -
trunk/TouchOSC/TouchOSC.py
r11 r12 8 8 import OSC 9 9 import re 10 import os 10 11 from Logger import Logger 11 12 … … 23 24 self.log("Logging Enabled") 24 25 25 ip = RemixNet.get_ip() 26 self.log("Ableton IP: " + str(ip)) 27 28 self.oscServer = RemixNet.OSCServer(ip, 5001, None, 5000) 29 self.callbackManager = self.oscServer.callbackManager 30 self.oscServer.sendOSC('/touchosc/startup', 1) 31 32 self.c_instance.show_message("TouchOSC > Server Started on " + str(ip)) 26 local = RemixNet.get_ip() 27 self.log("Ableton IP: " + str(local)) 33 28 34 29 # Init all listeners 35 30 self.cc = [] 36 config = open('config.txt', 'r') 31 self.cache = [] 32 33 config = open(os.path.expanduser('~') + '/touchosc_config.txt', 'r') 37 34 35 first = 0 38 36 for line in config: 39 (page, item) = line.rsplit("/") 40 #item = re.sub("/\d^/", "", item) 37 line = line.rstrip() 41 38 42 if item == "rotary" or item == "toggle" or item == "fader" or item == "push": 43 pass 44 else if item == "xy": 45 pass 46 else if item == "multitoggle": 47 pass 48 else if item == "multifader": 49 pass 39 # First line is remote ip address 40 if first == 0: 41 remote = line 42 self.oscServer = RemixNet.OSCServer(remote, 5001, local, 5000) 43 self.callbackManager = self.oscServer.callbackManager 44 self.oscServer.sendOSC('/touchosc/startup', 1) 45 46 first = 1 47 else: 48 if re.search("xy", line): 49 self.cc.append(line) 50 self.cc.append(line) 51 self.cache.append(0) 52 self.cache.append(0) 53 else: 54 self.cc.append(line) 55 self.cache.append(0) 56 57 self.callbackManager.add(self.callback, line) 50 58 51 59 config.close() 52 53 60 54 for page in range(4): 55 for item in ("fader", "toggle", "xy", "push", "rotary"): 56 for no in range(6): 57 string = "/" + str(page) + "/" + str(item) + str(no) 58 self.cc.append(string) 59 self.callbackManager.add(self.callback, string) 61 self.c_instance.show_message("TouchOSC > Server Started on " + str(local) + ", sending data to: " + str(remote)) 62 63 self.song().add_current_song_time_listener(self.oscServer.processIncomingUDP) 60 64 61 65 ###################################################################### … … 75 79 76 80 def build_midi_map(self, midi_map_handle): 77 return 81 for i in range(0,20): 82 Live.MidiMap.forward_midi_cc(self.handle(), midi_map_handle, 0, i) 78 83 79 84 def send_midi(self, midi_bytes): 80 85 self.c_instance.send_midi(midi_bytes) 81 86 82 def receive_midi(self, midi_bytes): 83 return 87 def receive_midi(self, bytes): 88 cc = self.cc[bytes[1]] 89 val = float(bytes[2])/float(127) 90 91 if re.search("xy", cc): 92 self.cache[bytes[1]] = bytes[2] 93 xy1 = self.tuple_idx(self.cc, cc) 94 95 if bytes[1] == xy1: 96 val2 = float(self.cache[bytes[1] + 1])/float(127) 97 self.oscServer.sendOSC(str(self.cc[bytes[1]]), (val, val2)) 98 else: 99 val2 = float(self.cache[bytes[1] - 1])/float(127) 100 self.oscServer.sendOSC(str(self.cc[bytes[1]]), (val2, val)) 101 102 self.log("cc: " + str(bytes[1]) + " val: " + str(val) + " cc2: " + str((bytes[1] - 1)) + " val2: " + str(val2) + " control: " + str(self.cc[bytes[1]])) 103 104 else: 105 self.log("cc: " + str(bytes[1]) + " val: " + str(bytes[2]) + " control: " + str(self.cc[bytes[1]])) 106 self.oscServer.sendOSC(str(self.cc[bytes[1]]), val) 84 107 85 108 def can_lock_to_devices(self): … … 91 114 def suggest_output_port(self): 92 115 return '' 116 117 def suggest_map_mode(self, cc_no, channel): 118 return Live.MidiMap.MapMode.absolute 93 119 94 120 def __handle_display_switch_ids(self, switch_id, value): … … 127 153 # Main Touch OSC Functions 128 154 def callback(self, msg): 129 (page, item) = msg[0].rsplit("/") 130 item = re.sub("/\d^/", "", item) 155 if re.search("xy", msg[0]): 156 cc = self.tuple_idx(self.cc, msg[0]) 157 158 val = int(msg[2] * 127) 159 val2 = int(msg[3] * 127) 160 161 if abs(self.cache[cc] - val) > 0: 162 self.c_instance.send_midi((0xb0, cc, val)) 163 self.cache[cc] = val 164 165 self.log(str(msg[0]) + " cc: " + str(cc) + " val: " + str(val)) 166 167 if abs(self.cache[cc+1] - val2) > 0: 168 self.c_instance.send_midi((0xb0, cc + 1, val2)) 169 self.log(str(msg[0]) + " cc2: " + str(cc+1) + " val2: " + str(val2)) 170 171 self.cache[cc+1] = val2 172 173 else: 174 cc = self.tuple_idx(self.cc, msg[0]) 175 val = int(msg[2] * 127) 131 176 132 if item == "rotary" or item == "toggle" or item == "fader" or item == "push" or item == "multitoggle" or item == "multifader": 133 pass 134 135 else if item == "xy": 136 pass 137 138 cc = self.tuple_idx(self.cc, msg[0]) 139 val = int(msg[2] * 127) 140 141 self.log(str(msg[0]) + " cc: " + str(cc) + " val: " + str(val)) 142 self.c_instance.send_midi((0xb0, cc, val)) 177 self.c_instance.send_midi((0xb0, cc, val)) 143 178 179 self.log(str(msg[0]) + " cc: " + str(cc) + " val: " + str(val)) 180
Note: See TracChangeset
for help on using the changeset viewer.
