From 28b9e3f98c07d72b2208a385e347fcbb117a7926 Mon Sep 17 00:00:00 2001 From: C. Scott Ananian Date: Wed, 12 Dec 2007 18:34:37 +0000 Subject: Improve speed of 'import pippy' by removing the 'from sugar import env'. We only do this step for 'audioOut' now. --- (limited to 'library') diff --git a/library/pippy/sound.py b/library/pippy/sound.py index 03e3d1f..570c10c 100755 --- a/library/pippy/sound.py +++ b/library/pippy/sound.py @@ -3,17 +3,12 @@ # added frequency modulation genertor # audioOut write a wave file if a string is given as argument import os -from sugar import env orchlines = [] scorelines = [] instrlist = [] fnum = [100] -temp_path = env.get_profile_path() + '/pippy' -if not os.path.isdir(temp_path): - os.mkdir(temp_path) - def quit(self): perf.Stop() perf.Join() @@ -175,6 +170,12 @@ def getSoundList(): def audioOut(file=None): """Compile a .csd file and start csound to run it. If a string is given as argument, it write a wave file on disk instead of sending sound to hp. (file = [None])""" + global temp_path + if temp_path is None: + from sugar import env + temp_path = env.get_profile_path() + '/pippy' + if not os.path.isdir(temp_path): + os.mkdir(temp_path) path = temp_path csd = open(path + "/temp.csd", "w") csd.write("\n\n") -- cgit v0.9.1