mirror of
https://github.com/vsariola/sointu.git
synced 2026-04-01 03:33:12 -04:00
fix: display correct exponent in tracker, switch directions, i.e. meaning of exp 0 <-> 128
This commit is contained in:
1
build_vst_plugin_native.ps1
Normal file
1
build_vst_plugin_native.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
go build -buildmode=c-shared -tags="plugin","native" -o sointu-vsti.dll .\cmd\sointu-vsti\
|
||||||
8
patch.go
8
patch.go
@ -257,6 +257,10 @@ func engineeringTime(sec float64) (string, string) {
|
|||||||
return fmt.Sprintf("%.2f", sec), "s"
|
return fmt.Sprintf("%.2f", sec), "s"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func envelopExpDisplayFunc(v int) (string, string) {
|
||||||
|
return fmt.Sprintf("= %.3f", math.Pow(2, 2*float64(64-v)/32)), ""
|
||||||
|
}
|
||||||
|
|
||||||
func formatFloat(f float64) string {
|
func formatFloat(f float64) string {
|
||||||
return strconv.FormatFloat(f, 'f', -1, 64)
|
return strconv.FormatFloat(f, 'f', -1, 64)
|
||||||
}
|
}
|
||||||
@ -469,7 +473,3 @@ func (p Patch) FindUnit(id int) (instrIndex int, unitIndex int, err error) {
|
|||||||
}
|
}
|
||||||
return 0, 0, fmt.Errorf("could not find a unit with id %v", id)
|
return 0, 0, fmt.Errorf("could not find a unit with id %v", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func envelopExpDisplayFunc(v int) (string, string) {
|
|
||||||
return fmt.Sprintf("= %.3f", math.Pow(2, float64(v-64)/32)), ""
|
|
||||||
}
|
|
||||||
|
|||||||
@ -145,41 +145,41 @@ su_op_envelopexp_statechange:
|
|||||||
su_op_envelopexp_applyexp:
|
su_op_envelopexp_applyexp:
|
||||||
fstp st1 ; x', where x' is the new value
|
fstp st1 ; x', where x' is the new value
|
||||||
; qm120: store the linear envelope in [level] because this is read again for the next value (cf. "envelope")
|
; qm120: store the linear envelope in [level] because this is read again for the next value (cf. "envelope")
|
||||||
fst dword [{{.WRK}} + 4] ; [level]=x'
|
fst dword [{{.WRK}} + 4] ; [level]=x'
|
||||||
; qm210: NOW THE ACTUAL EXPONENTIAL SCALING
|
; qm210: NOW THE ACTUAL EXPONENTIAL SCALING
|
||||||
; - scale the exponent in [0; 1] to [0.125; 8], call that kappa = 2^(6*(expo-0.5))
|
; - scale the exponent in [0; 1] to [0.125; 8], call that kappa = 2^(6*(expo-0.5))
|
||||||
fld dword [r10] ; stack: [ expo, x' ]
|
fld dword [r10] ; stack: [ expo, x' ]
|
||||||
{{.Prepare (.Float 0.5)}}
|
{{.Prepare (.Float 0.5)}}
|
||||||
fld dword [{{.Use (.Float 0.5)}}] ; stack: [ 0.5, expo, x' ]
|
fld dword [{{.Use (.Float 0.5)}}] ; stack: [ 0.5, expo, x' ]
|
||||||
fsubp st1, st0 ; stack: [ expo-0.5, x' ]
|
fsubrp st1, st0 ; stack: [ expo-0.5, x' ]
|
||||||
{{.Prepare (.Int 6)}}
|
{{.Prepare (.Int 6)}}
|
||||||
fimul dword [{{.Use (.Int 6)}}] ; stack: [ 6*(expo-0.5), x' ]
|
fimul dword [{{.Use (.Int 6)}}] ; stack: [ 6*(expo-0.5), x' ]
|
||||||
{{.Call "su_power"}} ; stack: [ kappa, x' ]
|
{{.Call "su_power"}} ; stack: [ kappa, x' ]
|
||||||
fxch st1 ; stack: [ x', kappa ]
|
fxch st1 ; stack: [ x', kappa ]
|
||||||
; - now we need (x')^(kappa), but care for x' == 0 first
|
; - now we need (x')^(kappa), but care for x' == 0 first
|
||||||
fldz ; stack: [ 0, x', kappa ]
|
fldz ; stack: [ 0, x', kappa ]
|
||||||
fucomip st1 ; stack [ x', kappa ] and ZF = (x' == 0)
|
fucomip st1 ; stack [ x', kappa ] and ZF = (x' == 0)
|
||||||
jz su_op_envelopexp_avoid_zero_glitch
|
jz su_op_envelopexp_avoid_zero_glitch
|
||||||
; - still around? calculate the actual x'' = x^kappa then
|
; - still around? calculate the actual x'' = x^kappa then
|
||||||
fyl2x ; stack: [ kappa * log2 x' ]
|
fyl2x ; stack: [ kappa * log2 x' ]
|
||||||
{{.Call "su_power"}} ; stack: [ x ^ kappa ]
|
{{.Call "su_power"}} ; stack: [ x ^ kappa ]
|
||||||
jmp short su_op_envelopexp_applybaseline
|
jmp short su_op_envelopexp_applybaseline
|
||||||
su_op_envelopexp_avoid_zero_glitch:
|
su_op_envelopexp_avoid_zero_glitch:
|
||||||
fstp st1
|
fstp st1
|
||||||
su_op_envelopexp_applybaseline:
|
su_op_envelopexp_applybaseline:
|
||||||
; - and scale the result to a different baseline: x''' = (B + (1 - B) * x'') for B != 0 (check not required)
|
; - and scale the result to a different baseline: x''' = (B + (1 - B) * x'') for B != 0 (check not required)
|
||||||
fld dword [{{.WRK}} + 12] ; stack: [ B, x'' ]
|
fld dword [{{.WRK}} + 12] ; stack: [ B, x'' ]
|
||||||
fld1 ; stack: [ 1, B, x'' ]
|
fld1 ; stack: [ 1, B, x'' ]
|
||||||
fsub st0, st1 ; stack: [ 1-B, B, x'' ]
|
fsub st0, st1 ; stack: [ 1-B, B, x'' ]
|
||||||
fmulp st2, st0 ; stack: [ (1-B) * x'', B ]
|
fmulp st2, st0 ; stack: [ (1-B) * x'', B ]
|
||||||
faddp st1, st0 ; stack: [ (1-B) * x'' + B ]
|
faddp st1, st0 ; stack: [ (1-B) * x'' + B ]
|
||||||
jmp short su_op_envelopexp_leave
|
jmp short su_op_envelopexp_leave
|
||||||
su_op_envelopexp_sustain:
|
su_op_envelopexp_sustain:
|
||||||
; qm210: overwrite level, because else the release cannot work
|
; qm210: overwrite level, because else the release cannot work
|
||||||
fld dword [{{.Input "envelopexp" "sustain"}}]
|
fld dword [{{.Input "envelopexp" "sustain"}}]
|
||||||
su_op_envelopexp_skipexp:
|
su_op_envelopexp_skipexp:
|
||||||
fst dword [{{.WRK}} + 4]
|
fst dword [{{.WRK}} + 4]
|
||||||
fstp st1
|
fstp st1
|
||||||
su_op_envelopexp_leave:
|
su_op_envelopexp_leave:
|
||||||
; qm210: scaling because I use my wave editor as a function plotter ;)
|
; qm210: scaling because I use my wave editor as a function plotter ;)
|
||||||
fmul dword [{{.Input "envelopexp" "gain"}}] ; [gain]*x''
|
fmul dword [{{.Input "envelopexp" "gain"}}] ; [gain]*x''
|
||||||
|
|||||||
Reference in New Issue
Block a user