Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbergstra <james@xo-05-28-3A.localdomain>2008-02-13 02:13:10 (GMT)
committer bergstra <james@xo-05-28-3A.localdomain>2008-02-13 02:13:10 (GMT)
commit4069e31deead331593be3827b696a98b6ea37e61 (patch)
treedcf32dd3db9a8dfe0767964d456e9653c147cbe2
parent7883aaaa52dec4ba53dfeb765004e0e91446aad5 (diff)
added logging of csound connect to Jam, Synth
-rw-r--r--TamTamJam.activity/TamTamJam.py2
-rw-r--r--TamTamSynthLab.activity/TamTamSynthLab.py2
-rw-r--r--common/Config.py17
3 files changed, 18 insertions, 3 deletions
diff --git a/TamTamJam.activity/TamTamJam.py b/TamTamJam.activity/TamTamJam.py
index bbd3d03..6f28e43 100644
--- a/TamTamJam.activity/TamTamJam.py
+++ b/TamTamJam.activity/TamTamJam.py
@@ -72,9 +72,11 @@ class TamTamJam(activity.Activity):
def onActive(self, widget = None, event = None):
if widget.props.active == False:
+ Config.logwrite(1, 'Jam.onActivate disconnecting csound')
csnd = new_csound_client()
csnd.connect(False)
else:
+ Config.logwrite(1, 'Jam.onActivate connecting csound')
csnd = new_csound_client()
csnd.connect(True)
diff --git a/TamTamSynthLab.activity/TamTamSynthLab.py b/TamTamSynthLab.activity/TamTamSynthLab.py
index b115ec2..496dd97 100644
--- a/TamTamSynthLab.activity/TamTamSynthLab.py
+++ b/TamTamSynthLab.activity/TamTamSynthLab.py
@@ -77,9 +77,11 @@ class TamTamSynthLab(activity.Activity):
def onActive(self, widget = None, event = None):
if widget.props.active == False:
+ Config.logwrite(1, 'TamTamSynthLab.onActivate disconnecting csound')
csnd = new_csound_client()
csnd.connect(False)
else:
+ Config.logwrite(1, 'TamTamSynthLab.onActivate connecting csound')
csnd = new_csound_client()
csnd.connect(True)
diff --git a/common/Config.py b/common/Config.py
index 3a0ed11..8019334 100644
--- a/common/Config.py
+++ b/common/Config.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-import os
+import os, sys, time
from sugar.activity.activity import get_bundle_path
from sugar import env
@@ -18,6 +18,17 @@ else:
DEBUG = 0
print "Debug Level %d" % (DEBUG)
+# TODO: move this into a logging file in Util/
+# TODO: consider python's logging utility from the stdlib
+def logwrite(level, msg):
+ global DEBUG
+ if level <= DEBUG:
+ if not hasattr(logwrite, 'file'):
+ logwrite.file = sys.stdout
+ print >> logwrite.file, 'L%i:%f: %s'% (level, time.time(), msg)
+ logwrite.file.flush()
+
+
TAM_TAM_ROOT = get_bundle_path()
print 'INFO: loaded TAMTAM_ROOT=%s' % TAM_TAM_ROOT
@@ -49,8 +60,8 @@ else:
SCRATCH_DIR = PREF_DIR + "/.scratch/"
#PLUGIN
-PLUGIN_DEBUG = PREF_DIR + "/clooper.log"
-PLUGIN_VERBOSE = 0
+PLUGIN_DEBUG = "STDERR"
+PLUGIN_VERBOSE = DEBUG
PLUGIN_UNIVORC = TAM_TAM_ROOT + "/common/Resources/tamtamorc.csd"
PLUGIN_KSMPS = 64
PLUGIN_RATE = 16000