track.structure=track.structure.union(setOfPositions)#merge: add setOfPositions to the existing one
else:
track.structure=track.structure.difference(setOfPositions)#replace: remove everything from setOfPositions that is in the existing one, ignore entries from setOfPositions not in existing.
track.structure=track.structure.union(setOfPositions)#merge: add setOfPositions to the existing one
else:
track.structure=track.structure.difference(setOfPositions)#replace: remove everything from setOfPositions that is in the existing one, ignore entries from setOfPositions not in existing.
track.buildTrack()
updatePlayback()
callbacks._trackStructureChanged(track)
defsetSwitch(trackId,position,newBool):
"""e.g. for GUI Single click operations. Switch on and off a measure"""
session.history.register(lambdatrId=trackId,v=track.whichPatternsAreHalftoneTransposed.copy():_setSwitchHalftoneTranspose(trId,v),descriptionString="Set Half Tone Shift")
#First clean all modifications from the default value.
#We test for k in self.structure to not have modifications for measures that will be switched on later
#TODO: Can this possibly lead to a race condition where we load modifications first and then load the structure, which results in the mods getting perma-deleted here. e.g. we could not set default value in init, even for testing purposes.
#TODO: Yes, this happened with undo. every {comprehension} had a "and if k in self.structure" at the end. We took that out without remembering what that was for.
#We test for k in self.structure to not have modifications for measures that will be switched on later. This way when you deactivate a measure it will delete modifications. However, that was inconvenient. See below:
#Can this possibly lead to a race condition where we load modifications first and then load the structure, which results in the mods getting perma-deleted here. e.g. we could not set default value in init, even for testing purposes.
#Yes, this happened with undo. every {comprehension} had a "and if k in self.structure" at the end. We took that out without remembering what that was for.