fix(tracker): loading preset did not update the ids

When a preset was loaded, its IDs were not updated,
causing ID collisions in the song and send targets
going wrong.
This commit is contained in:
5684185+vsariola@users.noreply.github.com 2024-08-10 15:14:54 +03:00
parent db2d9cac9d
commit e09af5ab34
2 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
x87 stack.
### Fixed
- Loading a preset did not update the IDs of the newly loaded instrument,
causing ID collisions and sends target wrong units.
- The x87 native filter unit was denormalizing and eating up a lot of CPU ([#68][i68])
- Modulating delaytime in wasm could crash, because delay time was converted to
int with i32.trunc_f32_u. Using i32.trunc_f32_s fixed this.

View File

@ -145,7 +145,9 @@ func (m *Model) LoadPreset(index int) Action {
for m.d.InstrIndex >= len(m.d.Song.Patch) {
m.d.Song.Patch = append(m.d.Song.Patch, defaultInstrument.Copy())
}
m.d.Song.Patch[m.d.InstrIndex] = instrumentPresets[index].Copy()
newInstr := instrumentPresets[index].Copy()
(*Model)(m).assignUnitIDs(newInstr.Units)
m.d.Song.Patch[m.d.InstrIndex] = newInstr
}, allowed: func() bool {
return true
}}