diff options
author | james <james@loggerhead.localdomain> | 2006-11-03 19:12:31 (GMT) |
---|---|---|
committer | james <james@loggerhead.localdomain> | 2006-11-03 19:12:31 (GMT) |
commit | cc9abf4ae7146c8ec116cc40ef31094fd3de23f1 (patch) | |
tree | a4bbe1ae7adfa14fc01e6d9cc04585a46a40970d /TamTam.py | |
parent | 8ad5a99dc7d225361be1d60c7c62b0dcc58e18e8 (diff) |
moving instruments to 5000
Diffstat (limited to 'TamTam.py')
-rwxr-xr-x | TamTam.py | 62 |
1 files changed, 20 insertions, 42 deletions
@@ -18,56 +18,36 @@ import time from GUI.StandalonePlayer import StandAlonePlayer if __name__ == "__main__": - # TODO this should get started outside of TamTam (perhaps by Sugar?) - # start the CSoundServer - def do_quit(event, param): - CSoundClient.sendText('off()') - print 'do_quit() waiting' - #we know that quitting doesn't really work - time.sleep(0.5) - os.kill(pid, signal.SIGKILL) - time.sleep(0.3) - os.wait() - print '... phew!' - - try : - pid = os.fork() - - if pid > 0 : - time.sleep(1) - CSoundClient.initialize() - CSoundClient.setMasterVolume(100) - tamtam = StandAlonePlayer() - #tamtam = gtk.Button("adsf") - mainwin = gtk.Window(gtk.WINDOW_TOPLEVEL) - mainwin.set_title('TamTam Player') - mainwin.set_resizable(False) - mainwin.connect('destroy', do_quit, pid) - mainwin.connect('destroy' , tamtam.destroy ) - mainwin.connect( "key-press-event", tamtam.keyboardStandAlone.onKeyPress ) - mainwin.connect( "key-release-event", tamtam.keyboardStandAlone.onKeyRelease ) - mainwin.add(tamtam) - tamtam.show() - mainwin.show() - gtk.main() - else: - server = CsoundServerMult( ( CSoundConstants.SERVER_ADDRESS, CSoundConstants.SERVER_PORT ) ) - server.interpret() - - except OSError, e: - print >>sys.stderr, "fork failed: %d (%s)" % (e.errno, e.strerror) - sys.exit(1) + CSoundClient.initialize() + CSoundClient.setMasterVolume(100) + tamtam = StandAlonePlayer() + #tamtam = gtk.Button("adsf") + mainwin = gtk.Window(gtk.WINDOW_TOPLEVEL) + mainwin.set_title('TamTam Player') + mainwin.set_resizable(False) + mainwin.connect('destroy' , gtk.main_quit ) + mainwin.connect( "key-press-event", tamtam.keyboardStandAlone.onKeyPress ) + mainwin.connect( "key-release-event", tamtam.keyboardStandAlone.onKeyRelease ) + mainwin.add(tamtam) + tamtam.show() + mainwin.show() + gtk.main() + + sys.exit(0) from sugar.activity.Activity import Activity class TamTam(Activity): def __init__(self): + def do_quit(): + del self.tamtam + Activity.__init__(self) CSoundClient.initialize() CSoundClient.setMasterVolume(100) self.tamtam = StandAlonePlayer() - self.connect('destroy', self.do_quit) + self.connect('destroy', do_quit) self.add(self.tamtam) self.tamtam.show() self.set_title('TamTam') @@ -75,5 +55,3 @@ class TamTam(Activity): self.connect( "key-press-event", self.tamtam.keyboardStandAlone.onKeyPress ) self.connect( "key-release-event", self.tamtam.keyboardStandAlone.onKeyRelease ) - def do_quit(self): - del self.tamtam |