diff options
author | amartin <olpc@localhost.localdomain> | 2007-03-01 23:23:38 (GMT) |
---|---|---|
committer | amartin <olpc@localhost.localdomain> | 2007-03-01 23:23:38 (GMT) |
commit | 4a2707833481847966876009c21b4842671df4b4 (patch) | |
tree | e1031144155c1383936d68a7a0f7b21cfae390cb /Util/NoteDB.py | |
parent | b048a6c2cf509e5f78bda23c0888abd4d230b626 (diff) |
CSoundNote now uses .instrumentId, and .instrument and .instrumentFlag are no longer valid
BE WARNED!?
Diffstat (limited to 'Util/NoteDB.py')
-rw-r--r-- | Util/NoteDB.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Util/NoteDB.py b/Util/NoteDB.py index b845f27..2adcf49 100644 --- a/Util/NoteDB.py +++ b/Util/NoteDB.py @@ -354,7 +354,7 @@ class NoteDB: elif parameter == PARAMETER.DURATION: self.noteD[page][track][id].cs.duration = value elif parameter == PARAMETER.INSTRUMENT: - self.noteD[page][track][id].cs.instrumentFlag = value + self.noteD[page][track][id].cs.instrumentId = value for par in self.parasiteList.keys(): self.parasiteD[page][track][par][id].updateParameter( parameter, value ) @@ -474,7 +474,8 @@ class NoteDB: return self.clipboardArea # trackMap = { X: Y, W: Z, ... }; X,W are track indices, Y,Z are clipboard indices - def pasteClipboard( self, pages, offset, trackMap ): + # instrumentMap = { X: Y, W: Z, ... }; X,W are track indices, Y,Z are instrument ids + def pasteClipboard( self, pages, offset, trackMap, instrumentMap = {} ): if not len(self.clipboard): return deleteStream = [] @@ -490,6 +491,11 @@ class NoteDB: area["limit"][1] += offset for t in trackMap.keys(): if not area["tracks"][trackMap[t]]: continue + if instrumentMap.has_key(t): + updateInstrument = True + instrumentName = Config.INSTRUMENTS_BY_ID[ instrumentMap[t] ] + else: + updateInstrument = False tdeleteStream = [] tupdateOStream = [] tupdateDStream = [] @@ -523,7 +529,9 @@ class NoteDB: newcs.duration = ticks - newcs.onset newcs.pageId = p newcs.trackId = t - # TODO update the cs.instrument or any other parameters? + if updateInstrument: + newcs.instrumentFlag = instrumentName + # TODO update any other parameters? taddStream.append( newcs ) if len(taddStream): addStream += [ p, t, len(taddStream) ] + taddStream @@ -531,6 +539,8 @@ class NoteDB: pp += 1 if pp == ppMax: pp -= ppMax + + if len(deleteStream): self.deleteNotes( deleteStream + [-1] ) if len(updateStream): |