diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2008-12-19 00:24:50 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2008-12-19 23:50:57 (GMT) |
commit | df75dd3b08c5ae87cc0c9d43870a5a73467eeb0f (patch) | |
tree | 877c8d81c47c71a38b824ca3f73c69edc7b5e783 /TamTamJam.activity | |
parent | 9bb74bd2bb85cb5fc51f81b6f28e4291c3cdf286 (diff) |
add kitStage member to Instrument class; refactor code to use .kit and .kitStage instead of .name parsing
Diffstat (limited to 'TamTamJam.activity')
-rw-r--r-- | TamTamJam.activity/Jam/JamMain.py | 6 | ||||
-rw-r--r-- | TamTamJam.activity/Jam/Picker.py | 25 |
2 files changed, 24 insertions, 7 deletions
diff --git a/TamTamJam.activity/Jam/JamMain.py b/TamTamJam.activity/Jam/JamMain.py index 53f2798..77e97d1 100644 --- a/TamTamJam.activity/Jam/JamMain.py +++ b/TamTamJam.activity/Jam/JamMain.py @@ -173,11 +173,13 @@ class JamMain(gtk.EventBox): self.pixelsPerTick = Block.Loop.BEAT/float(Config.TICKS_PER_BEAT) self.ticksPerPixel = 1.0/self.pixelsPerTick - #-- Instrument Images --------------------------------- + #-- Instruments --------------------------------------- self.instrumentImage = {} self.instrumentImageActive = {} for inst in self.instrumentDB.getSet( "All" ): - self.prepareInstrumentImage( inst.instrumentId, inst.img ) + if not inst.kitStage: + self.prepareInstrumentImage( inst.instrumentId, inst.img ) + self.csnd.load_instrument(inst.name) #-- Loop Images --------------------------------------- self.loopImage = {} # get filled in through updateLoopImage diff --git a/TamTamJam.activity/Jam/Picker.py b/TamTamJam.activity/Jam/Picker.py index f44c29f..aec2ae0 100644 --- a/TamTamJam.activity/Jam/Picker.py +++ b/TamTamJam.activity/Jam/Picker.py @@ -118,13 +118,30 @@ class Instrument( Picker ): def __init__( self, owner, filter = ( "All" ) ): Picker.__init__( self, owner, filter ) - self.csnd = new_csound_client() self.type = Instrument self.instrumentDB = InstrumentDB.getRef() - list = [inst for inst in self.instrumentDB.getSet( "All" ) if not inst.name.startswith('lab')] - for inst in list: + all = [] + lab = [] + mic = [] + + for i in self.instrumentDB.getSet( "All" ): + if i.name.startswith('lab'): + lab.append(i) + elif i.name.startswith('mic'): + mic.append(i) + elif not i.kitStage and not i.kit: + all.append(i) + + if not Config.XO: + lab.sort() + all += lab + + mic.sort() + all += mic + + for inst in all: self.addBlock( inst.instrumentId ) def addBlock( self, id ): @@ -132,8 +149,6 @@ class Instrument( Picker ): data = { "name": _(self.instrumentDB.instId[id].name), "id": id } - self.csnd.load_instrument(self.instrumentDB.instId[id].name) - win = gtk.gdk.get_default_root_window() width = Block.Instrument.WIDTH height = Block.Instrument.HEIGHT |