diff options
author | amartin <olpc@xo-05-28-21.localdomain> | 2007-08-27 12:34:58 (GMT) |
---|---|---|
committer | amartin <olpc@xo-05-28-21.localdomain> | 2007-08-27 12:34:58 (GMT) |
commit | 66de29ff7807cbc2d0849ece71146fc9e72e1fe4 (patch) | |
tree | e689472523fe3a86909ec401e07c95fd0df789a0 /Jam/JamMain.py | |
parent | 6f57fcb7286d28d3d483c1f8ce7d3ee6f439a52b (diff) |
Jam loops
Diffstat (limited to 'Jam/JamMain.py')
-rw-r--r-- | Jam/JamMain.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Jam/JamMain.py b/Jam/JamMain.py index 28e19f6..5763ffa 100644 --- a/Jam/JamMain.py +++ b/Jam/JamMain.py @@ -43,7 +43,7 @@ class JamMain(SubActivity): self.reverb = 0 self.csnd = new_csound_client() - for i in range(1,9): + for i in range(0,9): self.csnd.setTrackVolume( 100, i ) self.csnd.setMasterVolume( self.volume ) self.csnd.setTempo( self.tempo ) @@ -339,8 +339,14 @@ class JamMain(SubActivity): self.drumFillin.stop() self.csnd.loopPause() - def _playLoop( self, id, volume, tune ): - loopId = self.csnd.loopCreate() + def _playLoop( self, id, volume, tune, loopId = None ): + if loopId == None: # create new loop + loopId = self.csnd.loopCreate() + startTick = 0 + else: # update loop + startTick = self.csnd.loopGetTick( loopId ) + self.csnd.loopDestroy( loopId ) + loopId = self.csnd.loopCreate() offset = 0 print "------------", loopId, tune @@ -359,6 +365,11 @@ class JamMain(SubActivity): self.csnd.loopSetNumTicks( offset, loopId ) + while startTick > offset: # align with last beat + startTick -= Config.TICK_PER_BEAT + + self.csnd.loopSetTick( startTick, loopId ) + # TODO update for beat syncing self.csnd.loopStart( loopId ) @@ -366,7 +377,6 @@ class JamMain(SubActivity): return loopId def _stopLoop( self, loopId ): - print "===============", loopId self.csnd.loopDestroy( loopId ) #========================================================== |