mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-14 02:54:37 -04:00
fix(vm): change crush resolution to bits (closes #79)
BREAKING CHANGE: The problem with crush was that it had very few usable values. This changes the crush to map the value nonlinearly, so the crush resolution is bits. Still the upper portion of the values is not very usable (bits 12-24 i.e. hardly any crushing), but at least the lower portion is usable. But now crush resolution has slightly different meaning.
This commit is contained in:
parent
1ac2ad3c75
commit
7df8103bf9
@ -34,16 +34,19 @@ su_op_hold_holding:
|
||||
;-------------------------------------------------------------------------------
|
||||
; CRUSH opcode: quantize the signal to finite number of levels
|
||||
;-------------------------------------------------------------------------------
|
||||
; Mono: x -> e*int(x/e)
|
||||
; Mono: x -> e*int(x/e) where e=2**(-24*resolution)
|
||||
; Stereo: l r -> e*int(l/e) e*int(r/e)
|
||||
;-------------------------------------------------------------------------------
|
||||
{{.Func "su_op_crush" "Opcode"}}
|
||||
{{- if .Stereo "crush"}}
|
||||
{{.Call "su_effects_stereohelper"}}
|
||||
{{- end}}
|
||||
fdiv dword [{{.Input "crush" "resolution"}}]
|
||||
xor eax, eax
|
||||
{{.Call "su_nonlinear_map"}}
|
||||
fxch st0, st1
|
||||
fdiv st0, st1
|
||||
frndint
|
||||
fmul dword [{{.Input "crush" "resolution"}}]
|
||||
fmulp st1, st0
|
||||
ret
|
||||
{{end}}
|
||||
|
||||
|
Reference in New Issue
Block a user