Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TamTam.py
diff options
context:
space:
mode:
authorJames <olpc@localhost.localdomain>2007-01-22 09:12:15 (GMT)
committer James <olpc@localhost.localdomain>2007-01-22 09:12:15 (GMT)
commit962b90d00c747532481560a44ca03a8205363232 (patch)
treefdaad30f332dc9d6c6ac616dd218942262529512 /TamTam.py
parent2fcb4c0d3d2a42dd89a6aab92838dda675230de1 (diff)
steady prog on new csound client
Diffstat (limited to 'TamTam.py')
-rwxr-xr-xTamTam.py60
1 files changed, 46 insertions, 14 deletions
diff --git a/TamTam.py b/TamTam.py
index 5a31cbe..df2b20b 100755
--- a/TamTam.py
+++ b/TamTam.py
@@ -11,15 +11,34 @@ from Util.Profiler import TP
from Player.StandalonePlayer import StandAlonePlayer
from Edit.MainWindow import MainWindow
+from Util.Clooper.SClient import *
#csnd = CSoundClient.CSoundClientSocket( Config.SERVER_ADDRESS, Config.SERVER_PORT, os.getpid() )
#csnd = CSoundClient.CSoundClientPerf( '/usr/share/olpc-csound-server/univorc.csd' )
-csnd = CSoundClient.CSoundClientPerf( Config.TAM_TAM_ROOT + '/Resources/univorc.csd' )
+def load_instruments( ):
+ home_path = env.get_profile_path() + Config.PREF_DIR
+ for instrumentSoundFile in Config.INSTRUMENTS.keys():
+ if instrumentSoundFile[0:3] == 'mic' or instrumentSoundFile[0:3] == 'lab':
+ fileName = home_path + '/' + instrumentSoundFile
+ else:
+ fileName = Config.SOUNDS_DIR + "/" + instrumentSoundFile
+ instrumentId = Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ instrumentSoundFile ].instrumentId
+ sc_instrumentLoad(instrumentId, fileName)
+
+USE_CSND = True
-csnd.initialize(True)
-csnd.setMasterVolume(100.0)
-CSoundClient.CSoundClient = csnd #Dodgy move: TODO: remove this global variable.
+if USE_CSND:
+ csnd = CSoundClient.CSoundClientPerf( Config.TAM_TAM_ROOT + '/Resources/univorc.csd' )
+ csnd.initialize(True)
+ csnd.setMasterVolume(100.0)
+ CSoundClient.CSoundClient = csnd #Dodgy move: TODO: remove this global variable.
+else:
+ sc_initialize( Config.TAM_TAM_ROOT + '/Resources/univorc.csd' )
+ sc_setMasterVolume(50.0)
+ load_instruments()
+ time.sleep(0.2)
+ csnd = None
if __name__ == "__main__":
def run_sugar_mode():
@@ -63,13 +82,17 @@ if __name__ == "__main__":
prof.close()
else:
run_edit_mode()
- csnd.initialize(False)
- print 'GOT BACK FROM UNINIT'
+ if USE_CSND:
+ csnd.initialize(False)
+ else:
+ sc_destroy()
sys.exit(0)
else:
run_sugar_mode()
- csnd.initialize(False)
- print 'GOT BACK FROM UNINIT'
+ if USE_CSND:
+ csnd.initialize(False)
+ else:
+ sc_destroy()
sys.exit(0)
from sugar.activity.Activity import Activity
@@ -102,19 +125,28 @@ class TamTam(Activity):
self.connect( "key-release-event", self.tamtam.keyboardStandAlone.onKeyRelease )
def handleFocusIn(self, event, data=None):
- csnd.initialize(True)
- csnd.setMasterVolume(100)
- self.tamtam.csnd.startTime()
- self.tamtam.noteLooper.startTime()
+ if USE_CSND:
+ csnd.initialize(True)
+ csnd.setMasterVolume(100)
+ self.tamtam.csnd.startTime()
+ self.tamtam.noteLooper.startTime()
+ else:
+ sc_something()
def handleFocusOut(self, event, data=None):
if self.tamtam.synthLabWindowOpen():
return
- csnd.initialize(False)
+ if USE_CSND:
+ csnd.initialize(False)
+ else:
+ sc_destroy()
def do_quit(self, arg2):
home_path = env.get_profile_path() + Config.PREF_DIR
os.system('rm ' + home_path + '/synthTemp*')
- csnd.initialize(False)
+ if USE_CSND:
+ csnd.initialize(False)
+ else:
+ sc_destroy()
del self.tamtam