Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Config.py21
-rw-r--r--common/Util/CSoundClient.py7
2 files changed, 12 insertions, 16 deletions
diff --git a/common/Config.py b/common/Config.py
index 72ae993..7fe8371 100644
--- a/common/Config.py
+++ b/common/Config.py
@@ -2,6 +2,7 @@
import os, sys, time
from sugar.activity.activity import get_bundle_path, get_activity_root
from sugar import env
+import logging
#QUICKLOAD = os.path.isfile("QUICKLOAD") # skip loading inessential comenents to speed things up
@@ -17,21 +18,12 @@ if os.path.isfile("DEBUG"):
if len(l): DEBUG = int( l )
else: DEBUG = 99
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()
+ DEBUG = int(os.getenv("TAMTAM_DEBUG", "0"))
+
+logging.debug("Debug Level %d" % (DEBUG))
TAM_TAM_ROOT = get_bundle_path()
-print 'INFO: loaded TAMTAM_ROOT=%s' % TAM_TAM_ROOT
+logging.debug('INFO: loaded TAMTAM_ROOT=%s' % TAM_TAM_ROOT)
#PATHS
if XO:
@@ -55,7 +47,8 @@ for i in (INSTANCE_DIR, DATA_DIR, SNDS_INFO_DIR, TMP_DIR):
if not os.path.isdir(i): os.makedirs(i)
#PLUGIN
-PLUGIN_DEBUG = "STDERR"
+PLUGIN_DEBUG = os.getenv("CSOUND_LOGFILE")
+if PLUGIN_DEBUG == "": PLUGIN_DEBUG = "STDERR"
PLUGIN_VERBOSE = DEBUG
PLUGIN_UNIVORC = os.path.join(FILES_DIR, "tamtamorc.csd")
PLUGIN_KSMPS = 64
diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py
index 2ce3238..1fee0cb 100644
--- a/common/Util/CSoundClient.py
+++ b/common/Util/CSoundClient.py
@@ -104,9 +104,12 @@ class _CSoundClientPlugin:
def load_instrument(self, inst):
if not inst in loadedInstruments:
if inst[0:3] == 'mic' or inst[0:3] == 'lab' or self.instrumentDB.instNamed[inst].category == 'mysounds':
- fileName = Config.DATA_DIR + '/' + inst
+ if os.path.isfile(os.path.join(Config.DATA_DIR, inst)):
+ fileName = os.path.join(Config.DATA_DIR, inst)
+ else:
+ fileName = os.path.join(Config.SOUNDS_DIR, 'armbone')
else:
- fileName = Config.SOUNDS_DIR + "/" + inst
+ fileName = os.path.join(Config.SOUNDS_DIR, inst)
instrumentId = Config.INSTRUMENT_TABLE_OFFSET + self.instrumentDB.instNamed[ inst ].instrumentId
sc_inputMessage( Config.CSOUND_LOAD_INSTRUMENT % (instrumentId, fileName) )
loadedInstruments.append(inst)