diff options
author | Oli <olpc@localhost.localdomain> | 2007-02-02 23:09:55 (GMT) |
---|---|---|
committer | Oli <olpc@localhost.localdomain> | 2007-02-02 23:09:55 (GMT) |
commit | 46242076d8df0aca0a1cc88a38cde92c27d7feb8 (patch) | |
tree | c9f926c2d90e70752c868256d38a7e72508428aa /SynthLab | |
parent | 954725648ae65ea09d09776457accdda30bd3b4b (diff) | |
parent | 5b4df75fbac9794d85e56a03c51ebb95ef0e7e37 (diff) |
Merge branch 'master' of git+ssh://olipet@dev.laptop.org/git/projects/tamtam
Diffstat (limited to 'SynthLab')
-rw-r--r-- | SynthLab/SynthLabWindow.py | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/SynthLab/SynthLabWindow.py b/SynthLab/SynthLabWindow.py index d0e5082..c6734f4 100644 --- a/SynthLab/SynthLabWindow.py +++ b/SynthLab/SynthLabWindow.py @@ -8,7 +8,6 @@ import gobject import time import shelve import os -from sugar import env import Config from Util.ThemeWidgets import * @@ -175,8 +174,7 @@ class SynthLabWindow( gtk.Window ): self.tooltips.set_tip(closeButton, Tooltips.CLOSE) self.add(self.mainBox) tempFile = 'synthTemp' + str(self.table - 85) - home_path = env.get_profile_path() + Config.PREF_DIR - if tempFile in os.listdir(home_path): + if tempFile in os.listdir(Config.PREF_DIR): self.handleLoadTemp() else: self.presetCallback(self.presets,0) @@ -193,7 +191,7 @@ class SynthLabWindow( gtk.Window ): self.playingPitch.append( midiPitch ) self.playNote( midiPitch ) else: - self.csnd.sendText("perf.InputMessage('i5204 0.02 4 " + str(self.table) + "')") + self.csnd.inputMessage("i5204 0.02 4 " + str(self.table) ) self.recordWait = 0 time.sleep(0.02) self.playingPitch.append( midiPitch ) @@ -248,8 +246,8 @@ class SynthLabWindow( gtk.Window ): def playNote( self, midiPitch ): cpsPitch = 261.626*pow(1.0594633, midiPitch-36) - mess = "perf.InputMessage('i5203 0 " + str(self.duration) + " " + str(cpsPitch) + " " + " " .join([str(n) for n in self.synthObjectsParameters.getOutputParameters()]) + "')" - self.csnd.sendText( mess ) + mess = "i5203 0 " + str(self.duration) + " " + str(cpsPitch) + " " + " " .join([str(n) for n in self.synthObjectsParameters.getOutputParameters()]) + self.csnd.inputMessage( mess ) def handleClose( self, widget, data ): if self.instanceOpen: @@ -774,21 +772,21 @@ class SynthLabWindow( gtk.Window ): self.dirty = True def writeTables( self, typesTable, controlParametersTable, sourceParametersTable, fxParametersTable ): - mess = "perf.InputMessage('f5200 0 16 -2 " + " " .join([str(n) for n in controlParametersTable]) + "')" - self.csnd.sendText( mess ) + mess = 'f5200 0 16 -2 ' + " ".join([str(n) for n in controlParametersTable]) + self.csnd.inputMessage( mess ) + time.sleep(0.01) + mess = "f5201 0 16 -2 " + " " .join([str(n) for n in sourceParametersTable]) + self.csnd.inputMessage( mess ) time.sleep(.01) - mess = "perf.InputMessage('f5201 0 16 -2 " + " " .join([str(n) for n in sourceParametersTable]) + "')" - self.csnd.sendText( mess ) - time.sleep(.01) - mess = "perf.InputMessage('f5202 0 16 -2 " + " " .join([str(n) for n in fxParametersTable]) + "')" - self.csnd.sendText( mess ) + mess = "f5202 0 16 -2 " + " " .join([str(n) for n in fxParametersTable]) + self.csnd.inputMessage( mess ) time.sleep(.01) lastTable = [0]*12 for i in range(12): if i in self.outputs: lastTable[i] = (typesTable[i]+1) - mess = "perf.InputMessage('f5203 0 16 -2 " + " " .join([str(n) for n in lastTable]) + " 0 0 0 0')" - self.csnd.sendText( mess ) + mess = "f5203 0 16 -2 " + " " .join([str(n) for n in lastTable]) + " 0 0 0 0" + self.csnd.inputMessage( mess ) time.sleep(.01) if lastTable[4] == 8: snd = Config.SOUNDS_DIR + '/' + self.sample_names[int(sourceParametersTable[1])] @@ -813,8 +811,7 @@ class SynthLabWindow( gtk.Window ): def recordSound( self, widget, data=None ): if widget.get_active() == True: self.recordWait = 1 - home_path = env.get_profile_path() + Config.PREF_DIR - os.system('rm ' + home_path + '/lab' + str(self.table - 85)) + os.system('rm ' + Config.PREF_DIR + '/lab' + str(self.table - 85)) else: self.recordWait = 0 @@ -829,8 +826,8 @@ class SynthLabWindow( gtk.Window ): for i in range(12): if i in self.outputs: lastTable[i] = (self.synthObjectsParameters.types[i]+1) - mess = "perf.InputMessage('f5203 0 16 -2 " + " " .join([str(n) for n in lastTable]) + " 0 0 0 0')" - self.csnd.sendText( mess ) + mess = "f5203 0 16 -2 " + " " .join([str(n) for n in lastTable]) + " 0 0 0 0" + self.csnd.inputMessage( mess ) time.sleep(.01) def controlToSrcConnections( self ): @@ -845,8 +842,8 @@ class SynthLabWindow( gtk.Window ): for entre in range(4): value = sum([2**(li[0]+1) for li in self.contSrcConnections if li[1] == source and li[2] == entre], 1) table[(source % 4) * 4 + entre] = value - mess = "perf.InputMessage('f5204 0 16 -2 " + " " .join([str(n) for n in table]) + "')" - self.csnd.sendText( mess ) + mess = "f5204 0 16 -2 " + " " .join([str(n) for n in table]) + self.csnd.inputMessage( mess ) def controlToFxConnections( self ): self.contFxConnections = [] @@ -861,8 +858,8 @@ class SynthLabWindow( gtk.Window ): for entre in range(4): value = sum([2**(li[0]+1) for li in self.contFxConnections if li[1] == fx and li[2] == entre], 1) table[(fx % 4) * 4 + entre] = value - mess = "perf.InputMessage('f5205 0 16 -2 " + " " .join([str(n) for n in table]) + "')" - self.csnd.sendText( mess ) + mess = "f5205 0 16 -2 " + " " .join([str(n) for n in table]) + self.csnd.inputMessage( mess ) def audioConnections( self ): self.srcFxConnections = [i for i in self.straightConnections if 3 < i[0] < 8 and 7 < i[1] < 12] @@ -889,8 +886,8 @@ class SynthLabWindow( gtk.Window ): if sig in self.outConnections: value = 1 table.append(value) - mess = "perf.InputMessage('f5206 0 16 -2 " + " " .join([str(n) for n in table]) + "')" - self.csnd.sendText( mess ) + mess = "f5206 0 16 -2 " + " " .join([str(n) for n in table]) + self.csnd.inputMessage( mess ) def loadPixmaps( self, typesList ): win = gtk.gdk.get_default_root_window() @@ -957,16 +954,14 @@ class SynthLabWindow( gtk.Window ): chooser.destroy() def handleSaveTemp( self ): - home_path = env.get_profile_path() + Config.PREF_DIR - file = home_path + '/synthTemp' + str(self.table - 85) + file = Config.PREF_DIR + '/synthTemp' + str(self.table - 85) print file f = shelve.open(file, 'n') self.saveState(f) f.close() def handleLoadTemp( self ): - home_path = env.get_profile_path() + Config.PREF_DIR - file = home_path + '/synthTemp' + str(self.table - 85) + file = Config.PREF_DIR + '/synthTemp' + str(self.table - 85) f = shelve.open(file, 'r') self.loadState(f) f.close() |