Skip to content

Commit

Permalink
fix(amd64-386): do not optimize away phase modulations with unisons
Browse files Browse the repository at this point in the history
  • Loading branch information
vsariola committed Aug 17, 2024
1 parent 5bc6dc6 commit bf1e05f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased
### Fixed
- 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])

Expand Down
4 changes: 2 additions & 2 deletions vm/compiler/templates/amd64-386/sources.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand All @@ -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]
Expand Down

0 comments on commit bf1e05f

Please sign in to comment.