|
|
@ -334,7 +334,8 @@ def convert_subdivisions(value, errorHandling): |
|
|
|
return result |
|
|
|
|
|
|
|
def set_numberOfMeasures(value): |
|
|
|
if session.data.numberOfMeasures == value: return |
|
|
|
if session.data.numberOfMeasures == value: |
|
|
|
return |
|
|
|
session.data.numberOfMeasures = value |
|
|
|
session.data.buildSongDuration() |
|
|
|
updatePlayback() |
|
|
@ -342,7 +343,8 @@ def set_numberOfMeasures(value): |
|
|
|
callbacks._scoreChanged() #redundant but cheap and convenient |
|
|
|
|
|
|
|
def set_measuresPerGroup(value): |
|
|
|
if session.data.measuresPerGroup == value: return |
|
|
|
if session.data.measuresPerGroup == value: |
|
|
|
return |
|
|
|
session.data.measuresPerGroup = value |
|
|
|
#No playback change |
|
|
|
callbacks._scoreChanged() |
|
|
@ -514,10 +516,16 @@ def setSwitchHalftoneTranspose(trackId, position, transpose): |
|
|
|
|
|
|
|
def insertSilence(howMany, beforeMeasureNumber): |
|
|
|
"""Insert empty measures into all tracks""" |
|
|
|
|
|
|
|
#In each track shift every switch to the right if it is before the dividing measure number |
|
|
|
#Keep the concept of a "group" even if there are multiplicators in the track. |
|
|
|
#If you insert 4 normal measures then a multiplicator-track of two gets only 2 new ones. |
|
|
|
for track in session.data.tracks: |
|
|
|
track.structure = set( (switch + howMany if switch >= beforeMeasureNumber else switch) for switch in track.structure ) |
|
|
|
track.whichPatternsAreScaleTransposed = { (k+howMany if k >= beforeMeasureNumber else k):v for k,v in track.whichPatternsAreScaleTransposed.items() } |
|
|
|
track.whichPatternsAreHalftoneTransposed = { (k+howMany if k >= beforeMeasureNumber else k):v for k,v in track.whichPatternsAreHalftoneTransposed.items() } |
|
|
|
thisTrackWhere = beforeMeasureNumber // track.patternLengthMultiplicator #integer division |
|
|
|
thisTrackHowMany = howMany // track.patternLengthMultiplicator #integer division |
|
|
|
track.structure = set( (switch + thisTrackHowMany if switch >= thisTrackWhere else switch) for switch in track.structure ) |
|
|
|
track.whichPatternsAreScaleTransposed = { (k+thisTrackHowMany if k >= thisTrackWhere else k):v for k,v in track.whichPatternsAreScaleTransposed.items() } |
|
|
|
track.whichPatternsAreHalftoneTransposed = { (k+thisTrackHowMany if k >= thisTrackWhere else k):v for k,v in track.whichPatternsAreHalftoneTransposed.items() } |
|
|
|
callbacks._trackStructureChanged(track) |
|
|
|
session.data.buildAllTracks() |
|
|
|
updatePlayback() |
|
|
|