possible to disable wasm render on start

This commit is contained in:
Peter Salomonsen 2023-04-05 18:57:42 +00:00
parent c429178758
commit 53a8429a69
4 changed files with 11 additions and 6 deletions

View File

@ -16,6 +16,7 @@ type Song struct {
Score Score Score Score
Patch Patch Patch Patch
CreateEmptyPatterns bool CreateEmptyPatterns bool
WasmDisableRenderOnStart bool
} }
// Copy makes a deep copy of a Score. // Copy makes a deep copy of a Score.

View File

@ -880,7 +880,9 @@
(export "render_128_samples" (func $render_128_samples)) (export "render_128_samples" (func $render_128_samples))
(export "update_voices" (func $su_update_voices)) (export "update_voices" (func $su_update_voices))
{{- if .RenderOnStart }}
(start $render) ;; we run render automagically when the module is instantiated (start $render) ;; we run render automagically when the module is instantiated
{{- end}}
(func $render (param) (func $render (param)
{{- if .Output16Bit }} (local $channel i32) {{- end }} {{- if .Output16Bit }} (local $channel i32) {{- end }}

View File

@ -1,6 +1,7 @@
bpm: 120 bpm: 120
rowsperbeat: 4 rowsperbeat: 4
createemptypatterns: true createemptypatterns: true
wasmdisablerenderonstart: false
score: score:
length: 1 length: 1
rowsperpattern: 16 rowsperpattern: 16

View File

@ -126,7 +126,8 @@ func (com *Compiler) Song(song *sointu.Song) (map[string]string, error) {
PatternLength int PatternLength int
SequenceLength int SequenceLength int
Hold int Hold int
}{compilerMacros, featureSetMacros, wasmMacros, songMacros, encodedPatch, patterns, sequences, len(patterns[0]), len(sequences[0]), 1} RenderOnStart bool
}{compilerMacros, featureSetMacros, wasmMacros, songMacros, encodedPatch, patterns, sequences, len(patterns[0]), len(sequences[0]), 1, !song.WasmDisableRenderOnStart}
populatedTemplate, extension, err = com.compile(templateName, &data) populatedTemplate, extension, err = com.compile(templateName, &data)
} }
if err != nil { if err != nil {