From 75bd9c591ec1a524c4c45de53f14fabbd82ce1e3 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:40:32 +0300 Subject: [PATCH] fix: do not include delay times from disabled delay units Closes #139. --- CHANGELOG.md | 6 ++++++ vm/delaytable.go | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8156acd..bb404cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased +### Fixed +- Do not include delay times in the delay time table if the delay unit is + disabled ([#139][i139]) + ## v0.4.0 ### Added - User can drop preset instruments into `os.UserConfigDir()/sointu/presets/` and @@ -167,3 +172,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). [i128]: https://github.com/vsariola/sointu/issues/128 [i129]: https://github.com/vsariola/sointu/issues/129 [i130]: https://github.com/vsariola/sointu/issues/130 +[i139]: https://github.com/vsariola/sointu/issues/139 diff --git a/vm/delaytable.go b/vm/delaytable.go index cfdd12b..3d21544 100644 --- a/vm/delaytable.go +++ b/vm/delaytable.go @@ -115,9 +115,10 @@ func constructDelayTimeTable(patch sointu.Patch, bpm int) ([]int, [][]int) { for i, instr := range patch { ind[i] = make([]int, len(instr.Units)) for j, unit := range instr.Units { - // only include delay times for delays. Only delays - // should use delay times - if unit.Type == "delay" { + // only include delay times for delays. Only delays should use delay + // times. Only delay times for enabled delay units should be in the + // table. + if unit.Type == "delay" && !unit.Disabled { ind[i][j] = len(subarrays) converted := make([]int, len(unit.VarArgs)) copy(converted, unit.VarArgs)