Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Util/InstrumentDB.py
diff options
context:
space:
mode:
authoramartin <olpc@xo-05-28-21.localdomain>2007-08-26 11:40:29 (GMT)
committer amartin <olpc@xo-05-28-21.localdomain>2007-08-26 11:40:29 (GMT)
commit87defb862218ca2e4d706e1affa200a6cae2032e (patch)
tree06fc2af30b193d180a571e4a3bc81a65733a8f3c /Util/InstrumentDB.py
parent6a209f15052e84430279a5fa66c2d661513c067f (diff)
Jam
Diffstat (limited to 'Util/InstrumentDB.py')
-rw-r--r--Util/InstrumentDB.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/Util/InstrumentDB.py b/Util/InstrumentDB.py
index 34b7be0..b88a77a 100644
--- a/Util/InstrumentDB.py
+++ b/Util/InstrumentDB.py
@@ -49,13 +49,27 @@ class InstrumentDB:
self.kit = [] # all kits. kits are lists of 13 instruments
self.kitNamed = {} # <name> -> kit with that name
+ # TEMP? add instrument from args
+ def addInstrumentFromArgs( self, name, csoundInstrumentName, register, loopStart,
+ loopEnd, crossDur, wav, img, labels ):
+ i = Instrument(len(self.inst))
+ self.inst += [ i ]
+ i.loadFromArgs( name, csoundInstrumentName, register, loopStart, loopEnd, crossDur, wav, img, labels )
+ #print 'labelSet... ', self.labelSet
+ self.labelSet['all'].add(i)
+ for l in i.labels:
+ if l not in self.labelSet:
+ self.labelSet[l] = set([])
+ self.labelSet[l].add( i )
+
+
# add an instrument to the DB by reading from an instrument definition file
def addInstrument( self, path ):
i = Instrument(len(self.inst))
self.inst += [ i ]
i.loadFromPath( path )
self.instNamed[ i.name ] = i
- print 'labelSet... ', self.labelSet
+ #print 'labelSet... ', self.labelSet
self.labelSet['all'].add(i)
for l in i.labels:
if l not in self.labelSet:
@@ -91,6 +105,15 @@ class InstrumentDB:
except :
print 'ERROR: scanning kit path %s: file %s invalid' % (path, fpath)
+ def getLabels( self ):
+ return self.labelSet.keys()
+
+ def getSet( self, label ):
+ return self.labelSet[label]
+
+ def getInstrument( self, id ):
+ return self.inst[id]
+
def debug_summarize(self):
for i in self.inst:
print i.id, i.name