diff options
author | Nathanaël Lécaudé <Nat@localhost.localdomain> | 2007-01-29 05:32:48 (GMT) |
---|---|---|
committer | Nathanaël Lécaudé <Nat@localhost.localdomain> | 2007-01-29 05:32:48 (GMT) |
commit | d1bd5c3afca2aad09701af702d018f3e99496d07 (patch) | |
tree | b1e9a11facf7adf87eb7aec1f1e5497f89bb126f /Util | |
parent | 9b3d8e0a679913b29390fab8f2da7c68acc9bd1c (diff) |
TamTam will run in non-sugar env
Diffstat (limited to 'Util')
-rw-r--r-- | Util/CSoundClient.py | 13 | ||||
-rw-r--r-- | Util/CSoundNote.py | 11 |
2 files changed, 20 insertions, 4 deletions
diff --git a/Util/CSoundClient.py b/Util/CSoundClient.py index 3da180a..01385f4 100644 --- a/Util/CSoundClient.py +++ b/Util/CSoundClient.py @@ -5,7 +5,6 @@ import select import sys import threading import time -from sugar import env import Config @@ -15,6 +14,13 @@ import Config #---------------------------------------------------------------------- CSoundClient = None class CSoundClientBase: + def __init__(self): + self.SugarMode = True + try : + from sugar import env + except ImportError : + self.SugarMode = False + def setMasterVolume(self, volume): self.sendText("csound.SetChannel('masterVolume', %f)\n" % volume) @@ -23,7 +29,10 @@ class CSoundClientBase: self.sendText( mess ) def load_mic_instrument( self, inst ): - home_path = env.get_profile_path() + Config.PREF_DIR + if self.SugarMode == True: + home_path = env.get_profile_path() + Config.PREF_DIR + else: + home_path = Config.SOUNDS_DIR + '/temp' fileName = home_path + '/' + inst instrumentId = Config.INSTRUMENT_TABLE_OFFSET + int(fileName[-1]) + 6 mess = Config.LOAD_INSTRUMENT_COMMAND % ( instrumentId, fileName ) diff --git a/Util/CSoundNote.py b/Util/CSoundNote.py index bf215ca..148f9b1 100644 --- a/Util/CSoundNote.py +++ b/Util/CSoundNote.py @@ -3,10 +3,17 @@ from Util.CSoundClient import CSoundClient from Generation.GenerationConstants import GenerationConstants from Util.Clooper.SClient import * -from sugar import env +SugarMode = True +try: + from sugar import env +except ImportError: + SugarMode = False def CSound_loadInstruments( ): - home_path = env.get_profile_path() + Config.PREF_DIR + if SugarMode == True: + home_path = env.get_profile_path() + Config.PREF_DIR + else: + home_path = Config.SOUNDS_DIR + '/temp' for instrumentSoundFile in Config.INSTRUMENTS.keys(): if instrumentSoundFile[0:3] == 'mic' or instrumentSoundFile[0:3] == 'lab': fileName = home_path + '/' + instrumentSoundFile |