diff options
author | Wu-Hsi Li <wuhsi@media.mit.edu> | 2014-03-02 08:22:02 (GMT) |
---|---|---|
committer | Wu-Hsi Li <wuhsi@media.mit.edu> | 2014-03-02 08:22:02 (GMT) |
commit | b611f5478ff7ca55755c0bca11de3f676e8c8af2 (patch) | |
tree | 198337d2c3466547d8d01d4d50d05bbfdcd11092 | |
parent | d01c66e757b835f5feba0f995694f0f9fc5cb630 (diff) |
-rw-r--r-- | Musicpainter.py | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/Musicpainter.py b/Musicpainter.py index 03fc9e6..96301ea 100644 --- a/Musicpainter.py +++ b/Musicpainter.py @@ -9,7 +9,8 @@ import pygtk pygtk.require('2.0') import gtk -import gobject +#import gobject +from gi.repository import GObject import cairo import pango import random @@ -68,7 +69,7 @@ class Musicpainter: def destroy_callback(self, data): if _showFunctionCall: print "Musicpainter::destroy_callback()" - self.csound.api.after_gtk_destroy() + #self.csound.api.after_gtk_destroy() self.destroy(self) def main(self): @@ -97,13 +98,13 @@ class Musicpainter: def deactivate(self): if _showFunctionCall: print "Musicpainter::deactivate()" - if self.hasCSound == True: + #if self.hasCSound == True: #self.score.stop_music(self.csound) - self.csound.sendClearLines() - self.score.play_state = -2 - self.csound.api._deactivate = True - self.csound.api.sendDeactivate() - time.sleep(1) + # self.csound.sendClearLines() + # self.score.play_state = -2 + # self.csound.api._deactivate = True + # self.csound.api.sendDeactivate() + # time.sleep(1) def reactivate(self): if _showFunctionCall: @@ -113,14 +114,14 @@ class Musicpainter: else: print "hasCSound = " + str(self.hasCSound) time.sleep(1) - if self.hasCSound == True and self.csound.api._isConnected == True: - self.csound.api._deactivate = False - self.csound.api.sendReactivateWithCallback(self.rcallback) - else: - if self.hasCSound == True: - self.csound.api._deactivate = False - print "To call csound.recover()...." - self.hasCSound = self.csound.recover() + #if self.hasCSound == True and self.csound.api._isConnected == True: + # self.csound.api._deactivate = False + # self.csound.api.sendReactivateWithCallback(self.rcallback) + #else: + # if self.hasCSound == True: + # self.csound.api._deactivate = False + # print "To call csound.recover()...." + # self.hasCSound = self.csound.recover() def initSugar(self, toplevel_window, name): self.platform = "sugar-xo" #called from MusicpainterActivity, set platform to sugar @@ -181,11 +182,13 @@ class Musicpainter: def init_csound(self): self.hasCSound = False if not _noCsound and self.hasCSound == False: - self.csound = CsoundXOAgent("localhost", random, self.score.timeUpdate, self.platform) - time.sleep(2) - self.hasCSound = (self.csound.status == 1) - if self.hasCSound == False: - self.hasCSound = self.csound.recover() + self.instrumentDB = InstrumentDB.getRef() + self.csnd = new_csound_client() + # self.csound = CsoundXOAgent("localhost", random, self.score.timeUpdate, self.platform) + # time.sleep(2) + # self.hasCSound = (self.csound.status == 1) + # if self.hasCSound == False: + # self.hasCSound = self.csound.recover() def init_graphics(self): |