|
@ -514,7 +514,7 @@ def setSwitchHalftoneTranspose(trackId, position, transpose): |
|
|
callbacks._trackStructureChanged(track) |
|
|
callbacks._trackStructureChanged(track) |
|
|
return True |
|
|
return True |
|
|
|
|
|
|
|
|
def insertSilence(howMany, beforeMeasureNumber): |
|
|
def insertSilence(howMany:int, beforeMeasureNumber:int): |
|
|
"""Insert empty measures into all tracks""" |
|
|
"""Insert empty measures into all tracks""" |
|
|
|
|
|
|
|
|
#In each track shift every switch to the right if it is before the dividing measure number |
|
|
#In each track shift every switch to the right if it is before the dividing measure number |
|
@ -532,16 +532,20 @@ def insertSilence(howMany, beforeMeasureNumber): |
|
|
|
|
|
|
|
|
def duplicateSwitchGroup(startMeasureForGroup:int, endMeasureExclusive:int): |
|
|
def duplicateSwitchGroup(startMeasureForGroup:int, endMeasureExclusive:int): |
|
|
groupSize = endMeasureExclusive-startMeasureForGroup |
|
|
groupSize = endMeasureExclusive-startMeasureForGroup |
|
|
insertSilence(groupSize, endMeasureExclusive) |
|
|
insertSilence(groupSize, endMeasureExclusive) #insert silence handles multiplicator-tracks on its own |
|
|
|
|
|
|
|
|
for track in session.data.tracks: |
|
|
for track in session.data.tracks: |
|
|
for switch in range(startMeasureForGroup+groupSize, endMeasureExclusive+groupSize): #One group after the given one. |
|
|
thisTrackStartMeasure = startMeasureForGroup // track.patternLengthMultiplicator #integer division |
|
|
if switch-groupSize in track.structure: |
|
|
thisTrackEndMeasure = endMeasureExclusive // track.patternLengthMultiplicator |
|
|
|
|
|
thisGroupSize = groupSize // track.patternLengthMultiplicator |
|
|
|
|
|
|
|
|
|
|
|
for switch in range(thisTrackStartMeasure+thisGroupSize, thisTrackEndMeasure+thisGroupSize): #One group after the given one. |
|
|
|
|
|
if switch-thisGroupSize in track.structure: |
|
|
track.structure.add(switch) |
|
|
track.structure.add(switch) |
|
|
if switch-groupSize in track.whichPatternsAreScaleTransposed: |
|
|
if switch-thisGroupSize in track.whichPatternsAreScaleTransposed: |
|
|
track.whichPatternsAreScaleTransposed[switch] = track.whichPatternsAreScaleTransposed[switch-groupSize] |
|
|
track.whichPatternsAreScaleTransposed[switch] = track.whichPatternsAreScaleTransposed[switch-thisGroupSize] |
|
|
if switch-groupSize in track.whichPatternsAreHalftoneTransposed: |
|
|
if switch-thisGroupSize in track.whichPatternsAreHalftoneTransposed: |
|
|
track.whichPatternsAreHalftoneTransposed[switch] = track.whichPatternsAreHalftoneTransposed[switch-groupSize] |
|
|
track.whichPatternsAreHalftoneTransposed[switch] = track.whichPatternsAreHalftoneTransposed[switch-thisGroupSize] |
|
|
callbacks._trackStructureChanged(track) |
|
|
callbacks._trackStructureChanged(track) |
|
|
session.data.buildAllTracks() |
|
|
session.data.buildAllTracks() |
|
|
updatePlayback() |
|
|
updatePlayback() |
|
|