From 953ad5539b8f0dd44431c75c765c2d5eba81d73c Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Thu, 18 Dec 2008 20:41:32 +0000 Subject: use TMP_DIR for temporary files --- diff --git a/TamTamEdit.activity/Edit/MainWindow.py b/TamTamEdit.activity/Edit/MainWindow.py index 952a799..356a4bc 100644 --- a/TamTamEdit.activity/Edit/MainWindow.py +++ b/TamTamEdit.activity/Edit/MainWindow.py @@ -643,7 +643,7 @@ class MainWindow( gtk.EventBox ): widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event if self.audioRecordState: - filename = Config.INSTANCE_DIR + "/perf.wav" + filename = Config.TMP_DIR + "/perf.wav" self.csnd.inputMessage( Config.CSOUND_RECORD_PERF % filename) time.sleep( 0.01 ) @@ -706,7 +706,7 @@ class MainWindow( gtk.EventBox ): widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event if self.audioRecordState: - filename = Config.INSTANCE_DIR + "/perf.wav" + filename = Config.TMP_DIR + "/perf.wav" self.csnd.inputMessage( Config.CSOUND_STOP_RECORD_PERF % filename) time.sleep( 0.01 ) @@ -722,8 +722,8 @@ class MainWindow( gtk.EventBox ): self.csnd.__del__() time.sleep(0.5) self.audioRecordState = False - command = "gst-launch-0.10 filesrc location=" + Config.INSTANCE_DIR + "/perf.wav ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=" + self.audioFileName - command2 = "rm " + Config.INSTANCE_DIR + "/perf.wav" + command = "gst-launch-0.10 filesrc location=" + Config.TMP_DIR + "/perf.wav ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=" + self.audioFileName + command2 = "rm " + Config.TMP_DIR + "/perf.wav" (status, output) = commands.getstatusoutput(command) (status2, output2) = commands.getstatusoutput(command2) diff --git a/TamTamSynthLab.activity/SynthLab/SynthLabMain.py b/TamTamSynthLab.activity/SynthLab/SynthLabMain.py index 157f15d..19e72ca 100644 --- a/TamTamSynthLab.activity/SynthLab/SynthLabMain.py +++ b/TamTamSynthLab.activity/SynthLab/SynthLabMain.py @@ -523,8 +523,8 @@ class SynthLabMain(gtk.EventBox): time.sleep(4) self.csnd.__del__() time.sleep(0.5) - command = "gst-launch-0.10 filesrc location=" + Config.INSTANCE_DIR + "/lab0 ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=" + self.audioFileName - command2 = "rm " + Config.INSTANCE_DIR + "/lab0" + command = "gst-launch-0.10 filesrc location=" + Config.TMP_DIR + "/lab0 ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=" + self.audioFileName + command2 = "rm " + Config.TMP_DIR + "/lab0" (status, output) = commands.getstatusoutput(command) (status2, output2) = commands.getstatusoutput(command2) @@ -579,7 +579,7 @@ class SynthLabMain(gtk.EventBox): cpsPitch = 261.626*pow(1.0594633, midiPitch-36) self.recCount += 1 if self.table == 85: - mess = "i5203." + str(self.recCount) + " 0 " + str(self.duration) + " " + str(cpsPitch) + " " + str(table) + " " + " ".join([str(n) for n in self.synthObjectsParameters.getOutputParameters()]) + ' "%s"' % Config.INSTANCE_DIR + mess = "i5203." + str(self.recCount) + " 0 " + str(self.duration) + " " + str(cpsPitch) + " " + str(table) + " " + " ".join([str(n) for n in self.synthObjectsParameters.getOutputParameters()]) + ' "%s"' % Config.TMP_DIR else: mess = "i5203." + str(self.recCount) + " 0 " + str(self.duration) + " " + str(cpsPitch) + " " + str(table) + " " + " ".join([str(n) for n in self.synthObjectsParameters.getOutputParameters()]) + ' "%s"' % Config.DATA_DIR self.csnd.inputMessage( mess ) @@ -1255,8 +1255,8 @@ class SynthLabMain(gtk.EventBox): self.audioFileName += '.ogg' chooser.destroy() - if os.path.isfile(Config.INSTANCE_DIR + '/lab0'): - os.system('rm ' + Config.INSTANCE_DIR + '/lab0') + if os.path.isfile(Config.TMP_DIR + '/lab0'): + os.system('rm ' + Config.TMP_DIR + '/lab0') self.recordButton = widget self.recordWait = 1 self.table = 85 diff --git a/TamTamSynthLab.activity/TamTamSynthLab.py b/TamTamSynthLab.activity/TamTamSynthLab.py index 4f74c78..345d2dc 100644 --- a/TamTamSynthLab.activity/TamTamSynthLab.py +++ b/TamTamSynthLab.activity/TamTamSynthLab.py @@ -86,7 +86,7 @@ class TamTamSynthLab(activity.Activity): csnd = new_csound_client() csnd.connect(False) else: - logging.debug(1, 'TamTamSynthLab.onActivate connecting csound') + logging.debug('TamTamSynthLab.onActivate connecting csound') csnd = new_csound_client() csnd.connect(True) diff --git a/common/Config.py b/common/Config.py index 7fe8371..9e2c069 100644 --- a/common/Config.py +++ b/common/Config.py @@ -22,23 +22,23 @@ else: logging.debug("Debug Level %d" % (DEBUG)) +#PATHS + TAM_TAM_ROOT = get_bundle_path() +INSTANCE_DIR = os.path.join(get_activity_root(), 'instance') +TMP_DIR = os.path.join(get_activity_root(), 'tmp') + logging.debug('INFO: loaded TAMTAM_ROOT=%s' % TAM_TAM_ROOT) -#PATHS if XO: - INSTANCE_DIR = os.path.join(get_activity_root(), 'instance') DATA_DIR = os.path.join(get_activity_root(), 'data') SNDS_INFO_DIR = os.path.join(get_activity_root(), 'data', 'snds_info') - TMP_DIR = os.path.join(get_activity_root(), 'tmp') FILES_DIR = os.path.join(TAM_TAM_ROOT, "..", "TamTamEdit.activity", "common", "Resources") SOUNDS_DIR = os.path.join(FILES_DIR, "Sounds", "") IMAGE_ROOT = os.path.join(FILES_DIR, "Images", "") else: - INSTANCE_DIR = os.path.join(os.getenv('HOME'), '.tamtam') DATA_DIR = os.path.join(os.getenv('HOME'), '.tamtam') SNDS_INFO_DIR = os.path.join(os.getenv('HOME'), '.tamtam', 'snds_info') - TMP_DIR = os.path.join(get_activity_root(), 'tmp') FILES_DIR = "/usr/share/tamtam/" SOUNDS_DIR = "/usr/share/tamtam/Sounds/" IMAGE_ROOT = '/usr/share/tamtam/Images/' -- cgit v0.9.1