mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
refactor(templates,tests): make sync an extern instead of parameter to render
This is to be able to use CreateThread with su_render_song; let's worry about multicore rendering sometime in the future.
This commit is contained in:
parent
8ef6de7ffd
commit
38c0cea40f
@ -7,6 +7,15 @@ su_synth_obj:
|
|||||||
resb su_synthworkspace.size
|
resb su_synthworkspace.size
|
||||||
resb {{.Song.Patch.NumDelayLines}}*su_delayline_wrk.size
|
resb {{.Song.Patch.NumDelayLines}}*su_delayline_wrk.size
|
||||||
|
|
||||||
|
{{- if or .RowSync (.HasOp "sync")}}
|
||||||
|
{{- if or (and (eq .OS "windows") (not .Amd64)) (eq .OS "darwin")}}
|
||||||
|
extern _syncBuf
|
||||||
|
{{- else}}
|
||||||
|
extern syncBuf
|
||||||
|
{{- end}}
|
||||||
|
{{- end}}
|
||||||
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; su_render_song function: the entry point for the synth
|
; su_render_song function: the entry point for the synth
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
@ -14,27 +23,26 @@ su_synth_obj:
|
|||||||
; the output buffer. Renders the compile time hard-coded song to the buffer.
|
; the output buffer. Renders the compile time hard-coded song to the buffer.
|
||||||
; Stack: output_ptr
|
; Stack: output_ptr
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
{{- if or .RowSync (.HasOp "sync")}}
|
|
||||||
{{.ExportFunc "su_render_song" "OutputBufPtr" "SyncBufPtr"}}
|
|
||||||
{{- else}}
|
|
||||||
{{.ExportFunc "su_render_song" "OutputBufPtr"}}
|
{{.ExportFunc "su_render_song" "OutputBufPtr"}}
|
||||||
{{- end}}
|
|
||||||
{{- if .Amd64}}
|
{{- if .Amd64}}
|
||||||
{{- if eq .OS "windows"}}
|
{{- 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
|
{{- .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
|
{{- else}} ; SystemV amd64 ABI, linux mac or hopefully something similar
|
||||||
{{- .PushRegs "rdi" "OutputBufPtr" "rbx" "NonVolatileRbx" "rbp" "NonVolatileRbp" | indent 4}}
|
{{- .PushRegs "rdi" "OutputBufPtr" "rbx" "NonVolatileRbx" "rbp" "NonVolatileRbp" | indent 4}}
|
||||||
{{- if or .RowSync (.HasOp "sync")}}
|
|
||||||
{{- .PushRegs "rsi" "SyncBufPtr" | indent 4}}
|
|
||||||
{{- end}}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- .PushRegs | indent 4}}
|
{{- .PushRegs | indent 4}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- $prologsize := len .Stacklocs}}
|
{{- $prologsize := len .Stacklocs}}
|
||||||
|
{{- if or .RowSync (.HasOp "sync")}}
|
||||||
|
{{- if or (and (eq .OS "windows") (not .Amd64)) (eq .OS "darwin")}}
|
||||||
|
{{- .Prepare "_syncBuf"}}
|
||||||
|
{{.Push (.Use "_syncBuf") "SyncBufPtr"}}
|
||||||
|
{{- else}}
|
||||||
|
{{- .Prepare "syncBuf"}}
|
||||||
|
{{.Push (.Use "syncBuf") "SyncBufPtr"}}
|
||||||
|
{{- end}}
|
||||||
|
{{- end}}
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
{{- if ne .VoiceTrackBitmask 0}}
|
{{- if ne .VoiceTrackBitmask 0}}
|
||||||
{{.Push (.VoiceTrackBitmask | printf "%v") "VoiceTrackBitmask"}}
|
{{.Push (.VoiceTrackBitmask | printf "%v") "VoiceTrackBitmask"}}
|
||||||
@ -78,9 +86,6 @@ su_render_sampleloop: ; loop through every sample in the row
|
|||||||
{{$.Pop $.AX}}
|
{{$.Pop $.AX}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- if .Amd64}}
|
{{- if .Amd64}}
|
||||||
{{- if or .RowSync (.HasOp "sync")}}
|
|
||||||
{{.Pop .AX}} ; pop the sync buf ptr away
|
|
||||||
{{- end}}
|
|
||||||
{{- if eq .OS "windows"}}
|
{{- if eq .OS "windows"}}
|
||||||
; Windows64 ABI, rdi rsi rbx rbp non-volatile
|
; Windows64 ABI, rdi rsi rbx rbp non-volatile
|
||||||
{{- .PopRegs "rcx" "rdi" "rsi" "rbx" "rbp" | indent 4}}
|
{{- .PopRegs "rcx" "rdi" "rsi" "rbx" "rbp" | indent 4}}
|
||||||
@ -91,12 +96,8 @@ su_render_sampleloop: ; loop through every sample in the row
|
|||||||
ret
|
ret
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- .PopRegs | indent 4}}
|
{{- .PopRegs | indent 4}}
|
||||||
{{- if or .RowSync (.HasOp "sync")}}
|
|
||||||
ret 8
|
|
||||||
{{- else}}
|
|
||||||
ret 4
|
ret 4
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end}}
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; su_update_voices function: polyphonic & chord implementation
|
; su_update_voices function: polyphonic & chord implementation
|
||||||
|
@ -49,11 +49,10 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
{{- if or .RowSync (.HasOp "sync")}}
|
{{- if or .RowSync (.HasOp "sync")}}
|
||||||
void SU_CALLCONV su_render_song(SUsample *buffer,float *syncBuffer);
|
|
||||||
#define SU_SYNC
|
#define SU_SYNC
|
||||||
{{- else}}
|
|
||||||
void SU_CALLCONV su_render_song(SUsample *buffer);
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
void SU_CALLCONV su_render_song(SUsample *buffer);
|
||||||
|
|
||||||
{{- if gt (.SampleOffsets | len) 0}}
|
{{- if gt (.SampleOffsets | len) 0}}
|
||||||
void SU_CALLCONV su_load_gmdls();
|
void SU_CALLCONV su_load_gmdls();
|
||||||
#define SU_LOAD_GMDLS
|
#define SU_LOAD_GMDLS
|
||||||
|
@ -41,11 +41,7 @@ int main(int argc, char* argv[]) {
|
|||||||
su_load_gmdls();
|
su_load_gmdls();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SU_SYNC
|
|
||||||
su_render_song(buf, syncBuf);
|
|
||||||
#else
|
|
||||||
su_render_song(buf);
|
su_render_song(buf);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
CreateDirectory(actual_output_folder, NULL);
|
CreateDirectory(actual_output_folder, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user