Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/SynthLab/SynthLabWindow.py
diff options
context:
space:
mode:
authorOli <olpc@localhost.localdomain>2007-02-06 00:29:04 (GMT)
committer Oli <olpc@localhost.localdomain>2007-02-06 00:29:04 (GMT)
commitdbf0e2d924840be32f60611ae7ae8e09111a8740 (patch)
treedf2891724d878845dfec00e7eadcaf79abaa39d7 /SynthLab/SynthLabWindow.py
parentbb6ba47652bbf684192d2ba0b104928abf8dcf92 (diff)
synthlab allow polyphonic recording
Diffstat (limited to 'SynthLab/SynthLabWindow.py')
-rw-r--r--SynthLab/SynthLabWindow.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/SynthLab/SynthLabWindow.py b/SynthLab/SynthLabWindow.py
index 7ce1dc6..3e9085a 100644
--- a/SynthLab/SynthLabWindow.py
+++ b/SynthLab/SynthLabWindow.py
@@ -41,6 +41,7 @@ class SynthLabWindow( gtk.Window ):
self.updateBounds(i)
self.instanceOpen = 0
self.recordWait = 0
+ self.recCount = 0
self.duration = 1.5
self.durString = '%.2f' % self.duration
self.playingPitch = []
@@ -189,13 +190,13 @@ class SynthLabWindow( gtk.Window ):
if midiPitch not in self.playingPitch:
if self.recordWait == 0:
self.playingPitch.append( midiPitch )
- self.playNote( midiPitch )
+ self.playNote( midiPitch, 0 )
else:
- self.csnd.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)
+ #time.sleep(0.02)
self.playingPitch.append( midiPitch )
- self.playNote( midiPitch )
+ self.playNote( midiPitch, self.table )
self.waitRecording()
def resetRecord( self ):
@@ -204,7 +205,7 @@ class SynthLabWindow( gtk.Window ):
return True
def waitRecording(self):
- self.wait = gobject.timeout_add((int(self.duration*1000)) , self.resetRecord )
+ self.wait = gobject.timeout_add(4000 , self.resetRecord )
def onKeyRelease( self, widget, event ):
key = event.hardware_keycode
@@ -220,6 +221,7 @@ class SynthLabWindow( gtk.Window ):
img = int((self.duration - .5) * 1.425 + 1)
self.durLabel.set_from_file(Config.IMAGE_ROOT + 'dur' + str(img) + '.png')
self.parameterUpdate(self.durString)
+ self.tooltips.set_tip(self.durationSlider, Tooltips.SOUNDDUR + ': ' + self.durString)
def showParameter( self, widget, data=None ):
if not self.parameterOpen:
@@ -244,10 +246,12 @@ class SynthLabWindow( gtk.Window ):
if self.parameterOpen:
self.parameter.update(durString)
- def playNote( self, midiPitch ):
+ def playNote( self, midiPitch, table ):
cpsPitch = 261.626*pow(1.0594633, midiPitch-36)
- mess = "i5203 0 " + str(self.duration) + " " + str(cpsPitch) + " " + " " .join([str(n) for n in self.synthObjectsParameters.getOutputParameters()])
+ self.recCount += 1
+ mess = "i5203." + str(self.recCount) + " 0 " + str(self.duration) + " " + str(cpsPitch) + " " + str(table) + " " + " " .join([str(n) for n in self.synthObjectsParameters.getOutputParameters()])
self.csnd.inputMessage( mess )
+ if self.recCount >= 9: self.recCount = 0
def handleClose( self, widget, data ):
if self.instanceOpen:
@@ -372,6 +376,7 @@ class SynthLabWindow( gtk.Window ):
for i in range(self.objectCount):
if self.locations[i] == SynthLabConstants.INIT_LOCATIONS[i] \
and i != self.objectCount-1: continue
+
if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
if gate: