diff --git a/CHANGELOG.md b/CHANGELOG.md index 309ab7f..36e8ab0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - In the WebAssembly core, $WRK was messed after stereo oscillators, making modulations not work +- The Webassembly implementation of mono version of "out" unit ### Changed - The crush resolution is now in bits instead of linear range; this is a diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cc917ba..897896d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -65,6 +65,7 @@ endfunction(regression_test) regression_test(test_envelope "" ENVELOPE) regression_test(test_envelope_stereo ENVELOPE) +regression_test(test_out ENVELOPE) regression_test(test_loadval "" LOADVAL) regression_test(test_loadval_stereo LOADVAL LOADVAL_STEREO) regression_test(test_gain LOADVAL GAIN) diff --git a/tests/expected_output/test_out.raw b/tests/expected_output/test_out.raw new file mode 100644 index 0000000..01ac885 Binary files /dev/null and b/tests/expected_output/test_out.raw differ diff --git a/tests/test_out.yml b/tests/test_out.yml new file mode 100644 index 0000000..a7cdf52 --- /dev/null +++ b/tests/test_out.yml @@ -0,0 +1,16 @@ +bpm: 100 +rowsperbeat: 4 +score: + rowsperpattern: 16 + length: 1 + tracks: + - numvoices: 1 + order: [0] + patterns: [[64, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]] +patch: + - numvoices: 1 + units: + - type: envelope + parameters: {attack: 64, decay: 64, gain: 64, release: 80, stereo: 0, sustain: 64} + - type: out + parameters: {gain: 128, stereo: 0} diff --git a/vm/compiler/templates/wasm/sinks.wat b/vm/compiler/templates/wasm/sinks.wat index 3e3c53a..fce3635 100644 --- a/vm/compiler/templates/wasm/sinks.wat +++ b/vm/compiler/templates/wasm/sinks.wat @@ -147,7 +147,11 @@ (f32.load (local.get $ptr)) ) ) - (local.set $ptr (i32.const {{add (index .Labels "su_globalports") 4}})) ;; synth.right, note that ATM does not seem to support mono ocpode at all + {{- if .StereoAndMono "out"}} + (if (local.get $stereo)(then + {{- end}} + {{- if .Stereo "out"}} + (local.set $ptr (i32.const {{add (index .Labels "su_globalports") 4}})) ;; synth.right (f32.store (local.get $ptr) (f32.add (f32.mul @@ -157,6 +161,10 @@ (f32.load (local.get $ptr)) ) ) + {{- end}} + {{- if .StereoAndMono "out"}} + )) + {{- end}} ) {{end}}