fix(vm/compiler/templates/wasm): add support for mono out

Adds also a test case to make sure mono out also works.
This commit is contained in:
5684185+vsariola@users.noreply.github.com 2023-09-24 10:25:07 +03:00
parent 7df8103bf9
commit f35f948118
5 changed files with 27 additions and 1 deletions

View File

@ -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

View File

@ -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)

Binary file not shown.

16
tests/test_out.yml Normal file
View File

@ -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}

View File

@ -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}}