Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TamTamJam.activity
diff options
context:
space:
mode:
Diffstat (limited to 'TamTamJam.activity')
-rw-r--r--TamTamJam.activity/Jam/JamMain.py27
-rw-r--r--TamTamJam.activity/Jam/Toolbars.py13
-rw-r--r--TamTamJam.activity/TamTamJam.py21
3 files changed, 25 insertions, 36 deletions
diff --git a/TamTamJam.activity/Jam/JamMain.py b/TamTamJam.activity/Jam/JamMain.py
index 9029265..53f2798 100644
--- a/TamTamJam.activity/Jam/JamMain.py
+++ b/TamTamJam.activity/Jam/JamMain.py
@@ -284,7 +284,7 @@ class JamMain(gtk.EventBox):
path = Config.TAM_TAM_ROOT+"/common/Resources/Desktops/"
filelist = os.listdir( path )
for file in filelist:
- shutil.copyfile( path+file, Config.SCRATCH_DIR+file )
+ shutil.copyfile( path+file, Config.TMP_DIR + '/' + file )
#-- Network -------------------------------------------
self.network = Net.Network()
@@ -327,7 +327,7 @@ class JamMain(gtk.EventBox):
self.activity._shared_activity.connect( "buddy-left", self.buddy_left )
self.activity.connect( "joined", self.joined )
self.network.setMode( Net.MD_WAIT )
-
+
#-- Final Set Up --------------------------------------
self.setVolume( self.volume )
self.setTempo( self.tempo )
@@ -346,10 +346,10 @@ class JamMain(gtk.EventBox):
self.network.shutdown()
#clear up scratch folder
- path = Config.SCRATCH_DIR
+ path = Config.TMP_DIR
filelist = os.listdir( path )
for file in filelist:
- os.remove( path+file )
+ os.remove( path + '/' + file )
#==========================================================
@@ -532,7 +532,7 @@ class JamMain(gtk.EventBox):
if inst.kit: # drum kit
if n.cs.pitch in GenerationConstants.DRUMPITCH:
n.cs.pitch = GenerationConstants.DRUMPITCH[n.cs.pitch]
- n.cs.onset += ticks
+ n.cs.onset += ticks
self.csnd.loopPlay( n, 1, loopId = loopId )
n.popState()
for n in self.noteDB.getNotesByTrack( page, 1 ): # metronome track
@@ -693,12 +693,13 @@ class JamMain(gtk.EventBox):
#==========================================================
# Mic recording
def micRec(self, widget, mic):
- os.system('rm ' + Config.SNDS_DIR + '/' + mic)
+ if os.path.isfile(os.path.join(Config.DATA_DIR, mic)):
+ os.system('rm ' + Config.DATA_DIR + '/' + mic)
self.csnd.inputMessage("i5600 0 4")
- (s1,o1) = commands.getstatusoutput("arecord -f S16_LE -t wav -r 16000 -d 4 " + Config.SNDS_DIR + "/tempMic.wav")
- (s2, o2) = commands.getstatusoutput("csound " + Config.FILES_DIR + "/crop.csd")
- (s3, o3) = commands.getstatusoutput("mv " + Config.SNDS_DIR + "/micTemp " + Config.SNDS_DIR + "/" + mic)
- (s4, o4) = commands.getstatusoutput("rm " + Config.SNDS_DIR + "/tempMic.wav")
+ (s1,o1) = commands.getstatusoutput("arecord -f S16_LE -t wav -r 16000 -d 4 " + Config.DATA_DIR + "/tempMic.wav")
+ (s2, o2) = commands.getstatusoutput("csound " + "--strset999=" + Config.DATA_DIR + " " + Config.FILES_DIR + "/crop.csd")
+ (s3, o3) = commands.getstatusoutput("mv " + Config.DATA_DIR + "/micTemp.wav " + Config.DATA_DIR + "/" + mic)
+ (s4, o4) = commands.getstatusoutput("rm " + Config.DATA_DIR + "/tempMic.wav")
self.csnd.load_mic_instrument(mic)
@@ -960,7 +961,7 @@ class JamMain(gtk.EventBox):
if Config.DEBUG > 3: print "IOError:: _saveDesktop:", errno, strerror
def getDesktopScratchFile( self, i ):
- return Config.SCRATCH_DIR+"desktop%d" % i
+ return Config.TMP_DIR+"/desktop%d" % i
def handleJournalLoad( self, filepath ):
@@ -1134,7 +1135,7 @@ class JamMain(gtk.EventBox):
self.offsetTicks = (offset + self.offsetTicks) % (self.syncTicks*HEARTBEAT_BUFFER)
elapsedTicks += offset
- newTick = elapsedTicks % (self.syncTicks*HEARTBEAT_BUFFER)
+ newTick = elapsedTicks % (self.syncTicks*HEARTBEAT_BUFFER)
self.csnd.loopSetTick( newTick, self.heartbeatLoop )
self.csnd.loopSetNumTicks( self.syncTicks*HEARTBEAT_BUFFER, self.heartbeatLoop )
@@ -1144,7 +1145,7 @@ class JamMain(gtk.EventBox):
def _setBeat( self, beat ):
curTick = self.csnd.loopGetTick( self.heartbeatLoop ) % self.syncTicks
curBeat = int(curTick) // Config.TICKS_PER_BEAT
- offset = (beat - curBeat) * Config.TICKS_PER_BEAT
+ offset = (beat - curBeat) * Config.TICKS_PER_BEAT
if offset > self.syncTicks//2:
offset -= self.syncTicks
elif offset < -self.syncTicks//2:
diff --git a/TamTamJam.activity/Jam/Toolbars.py b/TamTamJam.activity/Jam/Toolbars.py
index 4b2533e..5e4ab6c 100644
--- a/TamTamJam.activity/Jam/Toolbars.py
+++ b/TamTamJam.activity/Jam/Toolbars.py
@@ -104,7 +104,7 @@ class JamToolbar( gtk.Toolbar ):
def setTempo( self, tempo, quiet = False ):
if self.tempoSliderActive:
- self.delayedTempo = tempo
+ self.delayedTempo = tempo
elif quiet:
self.tempoAdjustment.handler_block( self.tempoAdjustmentHandler )
self.tempoAdjustment.set_value( tempo )
@@ -218,7 +218,7 @@ class PlaybackToolbar( gtk.Toolbar ):
def setBeat( self, widget, beat ):
if not self.blockBeat and widget.get_active():
- self.owner._setBeat( beat )
+ self.owner._setBeat( beat )
def updateBeatWheel( self, beat ):
self.blockBeat = True
@@ -369,7 +369,7 @@ class LoopSettingsPalette( Palette ):
self.soundBox = gtk.HBox()
self.soundLabel = gtk.Label(_('Sound: '))
self.soundMenuBox = BigComboBox()
- self.sounds = os.listdir(Config.SNDS_DIR)
+ self.sounds = [snd for snd in os.listdir(Config.DATA_DIR) if snd != 'snds_info']
for sound in self.sounds:
self.soundMenuBox.append_item(self.sounds.index(sound), sound)
self.soundMenuBox.connect('changed', self.handleSound)
@@ -469,7 +469,7 @@ class LoopSettingsPalette( Palette ):
def handlePopup(self, widget, data=None):
self.setButtonState()
self.soundMenuBox.remove_all()
- self.sounds = os.listdir(Config.SNDS_DIR)
+ self.sounds = [snd for snd in os.listdir(Config.DATA_DIR) if snd != 'snds_info']
for sound in self.sounds:
self.soundMenuBox.append_item(self.sounds.index(sound), sound)
self.nameEntry.set_text("name_of_the_sound")
@@ -480,7 +480,7 @@ class LoopSettingsPalette( Palette ):
def handleSound(self, widget, data=None):
self.sndname = self.sounds[widget.props.value]
- fullname = Config.SNDS_DIR + '/' + self.sndname
+ fullname = Config.DATA_DIR + '/' + self.sndname
results = commands.getstatusoutput("du -b %s" % fullname)
if results[0] == 0:
list = results[1].split()
@@ -528,7 +528,7 @@ class LoopSettingsPalette( Palette ):
ofile.write(category)
ofile.close()
if copy:
- (s,o) = commands.getstatusoutput('cp ' + Config.SNDS_DIR + '/' + oldName + ' ' + Config.SNDS_DIR + '/' + self.sndname)
+ (s,o) = commands.getstatusoutput('cp ' + Config.DATA_DIR + '/' + oldName + ' ' + Config.DATA_DIR + '/' + self.sndname)
def set_values(self, soundLength):
self.soundLength = soundLength
@@ -580,4 +580,3 @@ class LoopSettingsPalette( Palette ):
self.playStopButton.set_active(False)
gobject.source_remove(self.timeoutStop)
self.ok = True
-
diff --git a/TamTamJam.activity/TamTamJam.py b/TamTamJam.activity/TamTamJam.py
index ef66ffd..b52cb10 100644
--- a/TamTamJam.activity/TamTamJam.py
+++ b/TamTamJam.activity/TamTamJam.py
@@ -26,7 +26,11 @@ class TamTamJam(activity.Activity):
gtk.gdk.threads_init()
activity.Activity.__init__(self, handle)
- self.ensure_dirs()
+
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ if not os.path.isfile(os.path.join(Config.DATA_DIR, snd)):
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.DATA_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.DATA_DIR + '/' + snd + ' &')
color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
self.modify_bg(gtk.STATE_NORMAL, color)
@@ -93,7 +97,6 @@ class TamTamJam(activity.Activity):
def onDestroy(self, arg2):
if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
- os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
self.jam.onDestroy()
@@ -112,20 +115,6 @@ class TamTamJam(activity.Activity):
if not os.access(dir, rw):
print 'ERROR: directory %s is missing required r/w access\n' % dir
- def ensure_dirs(self):
- self.ensure_dir(Config.TUNE_DIR)
- self.ensure_dir(Config.SYNTH_DIR)
- self.ensure_dir(Config.SNDS_DIR)
- self.ensure_dir(Config.SNDS_INFO_DIR)
- self.ensure_dir(Config.SCRATCH_DIR)
-
- if not os.path.isdir(Config.PREF_DIR):
- os.mkdir(Config.PREF_DIR)
- os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
- for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
- shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
- os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
-
def read_file(self,file_path):
self.jam.handleJournalLoad(file_path)