feat: add the ability to use Sointu as a sync-tracker

There is a new "sync" opcode that saves the top-most signal every 256 samples to the new "syncBuffer" output. Additionally, you can enable saving the current fractional row as sync[0], avoiding calculating the beat in the shader, but also calculating the beat correctly when the beat is modulated.
This commit is contained in:
vsariola
2021-03-09 23:47:27 +02:00
parent a3bdf565fd
commit 99dbdfe223
30 changed files with 375 additions and 88 deletions

View File

@ -14,12 +14,22 @@ su_synth_obj:
; the output buffer. Renders the compile time hard-coded song to the buffer.
; Stack: output_ptr
;-------------------------------------------------------------------------------
{{- if or .RowSync (.HasOp "sync")}}
{{.ExportFunc "su_render_song" "OutputBufPtr" "SyncBufPtr"}}
{{- else}}
{{.ExportFunc "su_render_song" "OutputBufPtr"}}
{{- end}}
{{- if .Amd64}}
{{- if eq .OS "windows"}}
{{- .PushRegs "rcx" "OutputBufPtr" "rdi" "NonVolatileRsi" "rsi" "NonVolatile" "rbx" "NonVolatileRbx" "rbp" "NonVolatileRbp" | indent 4}} ; rcx = ptr to buf. rdi,rsi,rbx,rbp nonvolatile
{{- if or .RowSync (.HasOp "sync")}}
{{- .PushRegs "rdx" "SyncBufPtr" | indent 4}}
{{- end}}
{{- else}} ; SystemV amd64 ABI, linux mac or hopefully something similar
{{- .PushRegs "rdi" "OutputBufPtr" "rbx" "NonVolatileRbx" "rbp" "NonVolatileRbp" | indent 4}}
{{- if or .RowSync (.HasOp "sync")}}
{{- .PushRegs "rsi" "SyncBufPtr" | indent 4}}
{{- end}}
{{- end}}
{{- else}}
{{- .PushRegs | indent 4}}
@ -68,6 +78,9 @@ su_render_sampleloop: ; loop through every sample in the row
{{$.Pop $.AX}}
{{- end}}
{{- if .Amd64}}
{{- if or .RowSync (.HasOp "sync")}}
{{.Pop .AX}} ; pop the sync buf ptr away
{{- end}}
{{- if eq .OS "windows"}}
; Windows64 ABI, rdi rsi rbx rbp non-volatile
{{- .PopRegs "rcx" "rdi" "rsi" "rbx" "rbp" | indent 4}}
@ -78,8 +91,12 @@ su_render_sampleloop: ; loop through every sample in the row
ret
{{- else}}
{{- .PopRegs | indent 4}}
{{- if or .RowSync (.HasOp "sync")}}
ret 8
{{- else}}
ret 4
{{- end}}
{{- end}}
;-------------------------------------------------------------------------------
; su_update_voices function: polyphonic & chord implementation