Beispiel #1
0
def counterMaker(beatLength, numTicks):
    # Create a MeasureCount from an 'old style' specification, where
    # all we are given is the number of ticks in a beat and the total number
    # of ticks in the bar
    defaultRegistry = CounterRegistry()
    counts = [count[1] for count in defaultRegistry.countsByTicks(beatLength)]
    count = counts[0]
    mc = MeasureCount()
    mc.addSimpleBeats(count, numTicks / beatLength)
    return mc
Beispiel #2
0
def counterMaker(beatLength, numTicks):
    # Create a MeasureCount from an 'old style' specification, where
    # all we are given is the number of ticks in a beat and the total number
    # of ticks in the bar
    defaultRegistry = CounterRegistry()
    counts = [count[1] for count in
              defaultRegistry.countsByTicks(beatLength)]
    count = counts[0]
    mc = MeasureCount()
    mc.addSimpleBeats(count, numTicks / beatLength)
    return mc
Beispiel #3
0
 def makeEmptyScore(cls, numMeasures, counter, kit):
     score = Score()
     if kit is None:
         kit = DrumKit.getNamedDefaultKit()
     score.drumKit = kit
     if counter is None:
         registry = CounterRegistry()
         counter = list(registry.countsByTicks(2))
         counter = counter[0][1]
         counter = makeSimpleCount(counter, 4)
     for dummy in range(0, numMeasures):
         score.insertMeasureByIndex(len(counter), counter = counter)
     score.scoreData.makeEmpty()
     return score
Beispiel #4
0
 def makeEmptyScore(cls, numMeasures, counter, kit):
     score = Score()
     if kit is None:
         kit = DrumKit.getNamedDefaultKit()
     score.drumKit = kit
     if counter is None:
         registry = CounterRegistry()
         counter = list(registry.countsByTicks(2))
         counter = counter[0][1]
         counter = makeSimpleCount(counter, 4)
     for dummy in range(0, numMeasures):
         score.insertMeasureByIndex(len(counter), counter=counter)
     score.scoreData.makeEmpty()
     return score
Beispiel #5
0
 def read(scoreIterator):
     targetValues = {"numTicks" : None, "counter" : None }
     registry = CounterRegistry()
     def readCount(lineData):
         if lineData[0] == "|" and lineData[-1] == "|":
             lineData = lineData[1:-1]
         lineData = BEAT_COUNT + lineData[1:]
         try:
             targetValues["counter"] = registry.findMaster(lineData)
         except KeyError:
             raise DBErrors.BadCount(scoreIterator)
     with scoreIterator.section("BEAT_START", "BEAT_END") as section:
         section.readPositiveInteger("NUM_TICKS", targetValues, "numTicks")
         section.readCallback("COUNT", readCount)
     return Beat(targetValues["counter"], targetValues["numTicks"])
Beispiel #6
0
 def __init__(self):
     '''
     Constructor
     '''
     self._staffs = []
     self.drumKit = DrumKit.DrumKit()
     self._callBack = None
     self._callBacksEnabled = True
     self.scoreData = ScoreMetaData()
     self._sections = []
     self._formatState = None
     self.paperSize = "Letter"
     counter = CounterRegistry().getCounterByIndex(0)
     self.defaultCount = makeSimpleCount(counter, 4)
     self.systemSpacing = 25
     self.fontOptions = FontOptions()
     self.lilysize = 20
     self.lilypages = 0
     self.lilyFill = False