diff --git a/CHANGELOG.md b/CHANGELOG.md index bb404cc..772b68b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased ### Fixed +- In x86 templates, do not optimize away phase modulations when unisons are used + even if all phase inputs are zeros, as unisons use the phase modulation + mechanism to offset the different oscillators - Do not include delay times in the delay time table if the delay unit is disabled ([#139][i139]) diff --git a/vm/compiler/templates/amd64-386/sources.asm b/vm/compiler/templates/amd64-386/sources.asm index f6bf727..872f82a 100644 --- a/vm/compiler/templates/amd64-386/sources.asm +++ b/vm/compiler/templates/amd64-386/sources.asm @@ -189,7 +189,7 @@ su_op_oscillat_normalized: test al, byte 0x80 jz short su_op_oscillat_not_sample fst dword [{{.WRK}}] ; for samples, we store the phase without mod(p,1) -{{- if or (.SupportsParamValueOtherThan "oscillator" "phase" 0) (.SupportsModulation "oscillator" "phase")}} +{{- if or (.SupportsParamValueOtherThan "oscillator" "phase" 0) (.SupportsModulation "oscillator" "phase") (.SupportsParamValueOtherThan "oscillator" "unison" 0)}} fadd dword [{{.Input "oscillator" "phase"}}] {{- end}} {{.Call "su_oscillat_sample"}} @@ -202,7 +202,7 @@ su_op_oscillat_not_sample: fprem ; we actually computed mod(p+1,1) instead of mod(p,1) as the fprem takes mod fstp st1 ; towards zero fst dword [{{.WRK}}] ; store back the updated phase -{{- if or (.SupportsParamValueOtherThan "oscillator" "phase" 0) (.SupportsModulation "oscillator" "phase")}} +{{- if or (.SupportsParamValueOtherThan "oscillator" "phase" 0) (.SupportsModulation "oscillator" "phase") (.SupportsParamValueOtherThan "oscillator" "unison" 0)}} fadd dword [{{.Input "oscillator" "phase"}}] fld1 ; this is a bit stupid, but we need to take mod(x,1) again after phase modulations fadd st1, st0 ; as the actual oscillator functions expect x in [0,1]