diff --git a/engine/api.py b/engine/api.py index e099bc7..79ff5b3 100644 --- a/engine/api.py +++ b/engine/api.py @@ -417,8 +417,6 @@ def setTrackPatternLengthMultiplicator(trackId, newMultiplicator:int): callbacks._patternLengthMultiplicatorChanged(track) callbacks._patternChanged(track) - - #Track Switches def setSwitches(trackId, setOfPositions, newBool): diff --git a/engine/pattern.py b/engine/pattern.py index 184be9b..c466983 100644 --- a/engine/pattern.py +++ b/engine/pattern.py @@ -121,7 +121,7 @@ class Pattern(object): l = len(self.scale) lst = [] vel = self.averageVelocity - for index in range(self.parentTrack.parentData.howManyUnits): + for index in range(self.parentTrack.parentData.howManyUnits * self.parentTrack.patternLengthMultiplicator): for pitchindex in range(l): lst.append({"index":index, "factor": 1, "pitch": pitchindex, "velocity":vel}) self.data = lst @@ -134,7 +134,7 @@ class Pattern(object): lst = [] existing = [(d["index"], d["pitch"]) for d in self.data] vel = self.averageVelocity - for index in range(self.parentTrack.parentData.howManyUnits): + for index in range(self.parentTrack.parentData.howManyUnits * self.parentTrack.patternLengthMultiplicator): for pitchindex in range(l): if not (index, pitchindex) in existing: lst.append({"index":index, "factor": 1, "pitch": pitchindex, "velocity":vel}) @@ -163,14 +163,14 @@ class Pattern(object): existingSteps = self.getRow(pitchindex) existingIndices = set(s["index"] for s in existingSteps) - result = [False] * self.parentTrack.parentData.howManyUnits + result = [False] * self.parentTrack.parentData.howManyUnits * self.parentTrack.patternLengthMultiplicator for i in existingIndices: result[i] = True return result def _getRowWithNoneFillers(self, pitchindex): existingSteps = self.getRow(pitchindex) - result = [None] * self.parentTrack.parentData.howManyUnits + result = [None] * self.parentTrack.parentData.howManyUnits * self.parentTrack.patternLengthMultiplicator for st in existingSteps: result[st["index"]] = st return result @@ -183,7 +183,7 @@ class Pattern(object): vel = self.averageVelocity rowAsBools = self._rowAsBooleans(pitchindex) toRepeatChunk = rowAsBools[:stepIndex+1] - numberOfRepeats, rest = divmod(self.parentTrack.parentData.howManyUnits, stepIndex+1) + numberOfRepeats, rest = divmod(self.parentTrack.parentData.howManyUnits * self.parentTrack.patternLengthMultiplicator, stepIndex+1) index = 0 newRow = [] @@ -201,7 +201,7 @@ class Pattern(object): """ originalRow = self._getRowWithNoneFillers(pitchindex) toRepeatChunk = originalRow[:stepIndex+1] - numberOfRepeats, rest = divmod(self.parentTrack.parentData.howManyUnits, stepIndex+1) + numberOfRepeats, rest = divmod(self.parentTrack.parentData.howManyUnits * self.parentTrack.patternLengthMultiplicator, stepIndex+1) newRow = [] for i in range(numberOfRepeats): for st in toRepeatChunk: @@ -219,7 +219,7 @@ class Pattern(object): for step in existingSteps: self.data.remove(step) - for index in range(self.parentTrack.parentData.howManyUnits): + for index in range(self.parentTrack.parentData.howManyUnits * self.parentTrack.patternLengthMultiplicator): if not index in existingIndices: self.data.append({"index":index, "factor": 1, "pitch": pitchindex, "velocity":vel})