Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2008-12-19 15:37:01 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2008-12-19 23:50:58 (GMT)
commit53210daa96f6b7e51299a2eb15532cb296fab25d (patch)
tree23b40b55ddae9a79a5ca095131ac159f7ba3bc7f /common
parentcbf35672f9aa09bbae141b6599c27d9de8b0e57c (diff)
update lab&mic files on the fly
Diffstat (limited to 'common')
-rw-r--r--common/Util/CSoundClient.py11
-rw-r--r--common/Util/InstrumentDB.py5
-rw-r--r--common/Util/Instruments.py24
3 files changed, 27 insertions, 13 deletions
diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py
index 1fee0cb..44f61c5 100644
--- a/common/Util/CSoundClient.py
+++ b/common/Util/CSoundClient.py
@@ -319,6 +319,17 @@ class _CSoundClientPlugin:
rval=storage
instrument = self.instrumentDB.instId[instrumentId]
+
+ if instrument.volatile != None:
+ sound = os.path.join(Config.DATA_DIR, instrument.name)
+ if os.path.isfile(sound):
+ st_mtime = os.stat(sound).st_mtime
+ if st_mtime != instrument.volatile:
+ instrument.volatile = st_mtime
+ loadedInstruments.remove(instrument.name)
+ self.load_instrument(instrument.name)
+ time.sleep(0.2)
+
if instrument.kit != None:
instrument = self.instrumentDB.instNamed[instrument.kit[pitch]]
pitch = 1
diff --git a/common/Util/InstrumentDB.py b/common/Util/InstrumentDB.py
index 68928a5..0958989 100644
--- a/common/Util/InstrumentDB.py
+++ b/common/Util/InstrumentDB.py
@@ -9,6 +9,7 @@ class Instrument:
def __init__(self, id):
self.instrumentId = id
self.kitStage = False
+ self.volatile = None
# build an Instrument instance from argument list
def loadFromArgs( self, name, csoundInstrumentId, register, loopStart,
@@ -55,11 +56,13 @@ class InstrumentDB:
# TEMP? add instrument from args
def addInstrumentFromArgs( self, name, csoundInstrumentId, register, loopStart,
- loopEnd, crossDur, ampScale, kit, wav, img, category, kitStage = False ):
+ loopEnd, crossDur, ampScale, kit, wav, img, category,
+ kitStage = False, volatile = False ):
i = Instrument(len(self.inst))
self.inst += [ i ]
i.loadFromArgs( name, csoundInstrumentId, register, loopStart, loopEnd, crossDur, ampScale, kit, wav, img, category )
i.kitStage = kitStage
+ if volatile: i.volatile = 0
self.instNamed[ i.name ] = i
self.instId[i.instrumentId] = i
diff --git a/common/Util/Instruments.py b/common/Util/Instruments.py
index b4aa318..f616811 100644
--- a/common/Util/Instruments.py
+++ b/common/Util/Instruments.py
@@ -17,22 +17,22 @@ INST_PERC = Config.INST_PERC
instrumentDB = InstrumentDB.getRef()
-def _addInstrument( name, csoundInstrumentId, instrumentRegister, category, loopStart, loopEnd, crossDur, ampScale = 1, kit = None, kitStage = False ):
- instrumentDB.addInstrumentFromArgs( name, csoundInstrumentId, instrumentRegister, loopStart, loopEnd, crossDur, ampScale, kit, name, Config.IMAGE_ROOT+"/"+name+".png", category, kitStage = kitStage )
+def _addInstrument( name, csoundInstrumentId, instrumentRegister, category, loopStart, loopEnd, crossDur, ampScale = 1, kit = None, kitStage = False, volatile = False ):
+ instrumentDB.addInstrumentFromArgs( name, csoundInstrumentId, instrumentRegister, loopStart, loopEnd, crossDur, ampScale, kit, name, Config.IMAGE_ROOT+"/"+name+".png", category, kitStage = kitStage, volatile = volatile )
if Config.MIC:
- _addInstrument( "mic1", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 )
- _addInstrument( "mic2", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 )
- _addInstrument( "mic3", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 )
- _addInstrument( "mic4", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 )
+ _addInstrument( "mic1", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1, volatile = True )
+ _addInstrument( "mic2", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1, volatile = True )
+ _addInstrument( "mic3", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1, volatile = True )
+ _addInstrument( "mic4", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1, volatile = True )
if not Config.XO:
- _addInstrument( "lab1", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 )
- _addInstrument( "lab2", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 )
- _addInstrument( "lab3", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 )
- _addInstrument( "lab4", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 )
- _addInstrument( "lab5", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 )
- _addInstrument( "lab6", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 )
+ _addInstrument( "lab1", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1, volatile = True )
+ _addInstrument( "lab2", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1, volatile = True )
+ _addInstrument( "lab3", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1, volatile = True )
+ _addInstrument( "lab4", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1, volatile = True )
+ _addInstrument( "lab5", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1, volatile = True )
+ _addInstrument( "lab6", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1, volatile = True )
_addInstrument( "ounk", INST_SIMP, MID, 'animals', 0, 0, 0, 1 )
_addInstrument( "gam", INST_TIED, HIGH, 'percussions', .69388, .7536, .02922, 1.4 )