class ScoreStructureV0(FileStructure): tag = None targetClass = Data.Score.Score autoMake = True scoreData = MetadataStructureV0() drumKit = DrumKitStructureV0() measures = MeasureStructureV0( singleton=False, getter=lambda score: list(score.iterMeasures()), setter=lambda score, msr: score.insertMeasureByIndex(0, measure=msr)) _sections = StringField("SECTION_TITLE", singleton=False) paperSize = StringField("PAPER_SIZE") lilysize = PositiveIntegerField("LILYSIZE") lilypages = NonNegativeIntegerField("LILYPAGES") lilyFill = conditionalWriteField(YesNoField("LILYFILL"), lambda score: score.lilyFill) lilyFormat = NonNegativeIntegerField("LILYFORMAT") defaultCount = MeasureCountStructureV0(singleton=True, startTag="DEFAULT_COUNT_INFO_START") systemSpacing = NonNegativeIntegerField("SYSTEM_SPACE") fontOptions = FontOptionsStructureV0() def postProcessObject(self, instance): instance.postReadProcessing() return instance
class MeasureStructureV0(FileStructure): tag = "BAR" targetClass = Data.Measure.Measure counter = MeasureCountStructureV0() startBarLine = BarlineFieldWriteV0(" STARTBARLINE", getter=startBarlineString) barlines = BarlineReadFieldV0("BARLINE") notes = NoteFieldV0("NOTE", getter=list, singleton=False) endBarLine = BarlineFieldWriteV0(" ENDBARLINE", getter=endBarlineString) beatLength = BeatLengthFieldV0("BEATLENGTH") repeatCount = conditionalWriteField( PositiveIntegerField("REPEAT_COUNT"), lambda measure: measure.repeatCount > 1) alternateText = StringField("ALTERNATE") def hasSimile(measure): return measure.simileDistance > 0 simileDistance = conditionalWriteField(NonNegativeIntegerField("SIMILE"), hasSimile) simileIndex = conditionalWriteField(NonNegativeIntegerField("SIMINDEX"), hasSimile) def makeObject(self, objectData): return self.targetClass(int(objectData)) def startTagData(self, source): return str(len(source))
class NoteHeadStructureV1(FileStructure): tag = "NOTEHEAD" targetClass = Data.Drum.HeadData midiNote = NonNegativeIntegerField("MIDINOTE") midiVolume = NonNegativeIntegerField("MIDIVOLUME") effect = StringField("EFFECT") notationHead = StringField("NOTATIONHEAD") notationLine = IntegerField("NOTATIONLINE") notationEffect = StringField("NOTATIONEFFECT") stemDirection = IntegerField("STEM") shortcut = StringField("SHORTCUT")
class MeasureStructureV1(FileStructure): tag = "MEASURE" targetClass = Data.Measure.Measure counter = MeasureCountStructureV1() startBar = NonNegativeIntegerField("STARTBARLINE") notes = dbfsv0.NoteFieldV0("NOTE", getter = list, singleton = False) endBar = NonNegativeIntegerField("ENDBARLINE") repeatCount = PositiveIntegerField("REPEAT_COUNT") alternateText = StringField("ALTERNATE") simileDistance = conditionalWriteField(NonNegativeIntegerField("SIMILE"), lambda measure: measure.simileDistance > 0) simileIndex = conditionalWriteField(NonNegativeIntegerField("SIMINDEX"), lambda measure: measure.simileIndex > 0) showAbove = BooleanField("SHOWABOVE") aboveText = conditionalWriteField(Base64StringField("ABOVETEXT"), lambda measure: any(ch != " " for ch in measure.aboveText)) showBelow = BooleanField("SHOWBELOW") belowText = conditionalWriteField(Base64StringField("BELOWTEXT"), lambda measure: any(ch != " " for ch in measure.belowText)) newBpm = conditionalWriteField(NonNegativeIntegerField("NEWBPM"), lambda measure: measure.newBpm > 0)
class ScoreStructureV1(FileStructure): tag = "SCORE" targetClass = Data.Score.Score scoreData = dbfsv0.MetadataStructureV0() drumKit = DrumKitStructureV1() measures = MeasureStructureV1(singleton = False, getter = lambda score:list(score.iterMeasures()), setter = lambda score, msr: score.insertMeasureByIndex(0, measure = msr)) _sections = StringField("SECTION_TITLE", singleton = False) paperSize = StringField("PAPER_SIZE") lilysize = PositiveIntegerField("LILYSIZE") lilypages = NonNegativeIntegerField("LILYPAGES") lilyFill = BooleanField("LILYFILL") lilyFormat = NonNegativeIntegerField("LILYFORMAT") defaultCount = DefaultMeasureCountStructureV1() systemSpacing = NonNegativeIntegerField("SYSTEM_SPACE") fontOptions = dbfsv0.FontOptionsStructureV0() def postProcessObject(self, instance): instance.postReadProcessing() return instance
class MetadataStructureV2(FileStructure): tag = "SCORE_METADATA" startTag = "SCORE_METADATA" targetClass = Data.ScoreMetaData.ScoreMetaData title = StringField("TITLE") artist = StringField("ARTIST") artistVisible = BooleanField("ARTISTVISIBLE") creator = StringField("CREATOR") creatorVisible = BooleanField("CREATORVISIBLE") bpm = PositiveIntegerField("BPM") bpmVisible = BooleanField("BPMVISIBLE") width = PositiveIntegerField("WIDTH") kitDataVisible = BooleanField("KITDATAVISIBLE") metadataVisible = BooleanField("METADATAVISIBLE") beatCountVisible = BooleanField("BEATCOUNTVISIBLE") emptyLinesVisible = BooleanField("EMPTYLINESVISIBLE") measureCountsVisible = BooleanField("MEASURECOUNTSVISIBLE") swing = NonNegativeIntegerField("SWING")