diff --git a/engine/api.py b/engine/api.py index 14d8fb5..86f962c 100644 --- a/engine/api.py +++ b/engine/api.py @@ -1340,10 +1340,12 @@ def setStep(trackId, stepExportDict): This function checks if the new step is within the limits of the current sounding pattern and will prevent changes or additions outside the current limits. """ + track = session.data.trackById(trackId) if not track: return - inRange = stepExportDict["index"] < session.data.howManyUnits and stepExportDict["pitch"] < track.pattern.numberOfSteps + #index is from 0 and howManyUnits*Multp is from 1 (because it is length), so we just need <, and not <=. + inRange = stepExportDict["index"] < session.data.howManyUnits*track.patternLengthMultiplicator and stepExportDict["pitch"] < track.pattern.numberOfSteps if not inRange: return session.history.register(lambda trId=trackId, v=track.pattern.copyData(): setPattern(trId, v, "Change Step"), descriptionString="Change Step") @@ -1365,7 +1367,7 @@ def removeStep(trackId, index, pitch): track = session.data.trackById(trackId) if not track: return - inRange = index < session.data.howManyUnits and pitch < track.pattern.numberOfSteps + inRange = index < session.data.howManyUnits*track.patternLengthMultiplicator and pitch < track.pattern.numberOfSteps if not inRange: return session.history.register(lambda trId=trackId, v=track.pattern.copyData(): setPattern(trId, v, "Remove Step"), descriptionString="Remove Step")