Change loadnote to load values from [-1,1], to allow using notes for both positive and negative modulations.

Also change SPEED to take this change into account.
This commit is contained in:
Veikko Sariola
2020-05-26 18:58:49 +03:00
parent 3cdada41e0
commit e049bf2dce
4 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ su_op_addp_mono:
%endif %endif
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
; LOADNOTE opcode: load the current note, scaled to [0,1] ; LOADNOTE opcode: load the current note, scaled to [-1,1]
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
; Mono: (empty) -> n, where n is the note ; Mono: (empty) -> n, where n is the note
; Stereo: (empty) -> n n ; Stereo: (empty) -> n n
@ -80,6 +80,8 @@ su_op_loadnote_mono:
%endif %endif
fild dword [INP-su_voice.inputs+su_voice.note] fild dword [INP-su_voice.inputs+su_voice.note]
do fmul dword [,c_i128,] do fmul dword [,c_i128,]
do fsub dword [,c_0_5,] ; s-.5
fadd st0, st0 ; 2*s-1
ret ret
%endif %endif

View File

@ -47,8 +47,6 @@ su_op_advance_finish:
SECT_TEXT(suspeed) SECT_TEXT(suspeed)
EXPORT MANGLE_FUNC(su_op_speed,0) EXPORT MANGLE_FUNC(su_op_speed,0)
do fsub dword [,c_0_5,] ; s-.5
fadd st0, st0 ; 2*s-1
do fmul dword [,c_bpmscale,] ; (2*s-1)*64/24, let's call this p from now on do fmul dword [,c_bpmscale,] ; (2*s-1)*64/24, let's call this p from now on
call MANGLE_FUNC(su_power,0) ; 2^p, this is how many ticks we should be taking call MANGLE_FUNC(su_power,0) ; 2^p, this is how many ticks we should be taking
fld1 ; 1 2^p fld1 ; 1 2^p