diff --git a/src/jsMain/kotlin/nl/astraeus/vst/chip/audio/VstChipWorklet.kt b/src/jsMain/kotlin/nl/astraeus/vst/chip/audio/VstChipWorklet.kt index b07cd70..38f3905 100644 --- a/src/jsMain/kotlin/nl/astraeus/vst/chip/audio/VstChipWorklet.kt +++ b/src/jsMain/kotlin/nl/astraeus/vst/chip/audio/VstChipWorklet.kt @@ -6,6 +6,7 @@ object VstChipWorklet : AudioNode( "vst-chip-worklet.js", "vst-chip-processor" ) { + var volume = 0.75 override fun onMessage(message: MessageEvent) { console.log("Message from worklet: ", message) diff --git a/src/jsMain/kotlin/nl/astraeus/vst/chip/view/MainView.kt b/src/jsMain/kotlin/nl/astraeus/vst/chip/view/MainView.kt index b3eb1e7..76936a0 100644 --- a/src/jsMain/kotlin/nl/astraeus/vst/chip/view/MainView.kt +++ b/src/jsMain/kotlin/nl/astraeus/vst/chip/view/MainView.kt @@ -11,12 +11,13 @@ import nl.astraeus.komp.HtmlBuilder import nl.astraeus.komp.Komponent import nl.astraeus.vst.chip.audio.VstChipWorklet import nl.astraeus.vst.chip.midi.Midi -import nl.astraeus.vst.ui.components.ExpKnobComponent +import nl.astraeus.vst.ui.components.KnobComponent import nl.astraeus.vst.ui.css.Css import nl.astraeus.vst.ui.css.Css.defineCss import nl.astraeus.vst.ui.css.Css.noTextSelect import nl.astraeus.vst.ui.css.CssName import nl.astraeus.vst.ui.css.hover +import nl.astraeus.vst.util.formatDouble import org.khronos.webgl.Uint8Array import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLSelectElement @@ -170,9 +171,18 @@ object MainView : Komponent(), CssName { } div { include( - ExpKnobComponent( - - ) + KnobComponent( + value = VstChipWorklet.volume, + label = "Volume", + minValue = 0.0, + maxValue = 1.0, + step = 2.0 / 127.0, + width = 200, + height = 160 + ) { value -> + println("Value changed: ${formatDouble(value, 2)}") + VstChipWorklet.volume = value + } ) } } diff --git a/src/jvmMain/resources/index.html b/src/jsMain/resources/index.html similarity index 100% rename from src/jvmMain/resources/index.html rename to src/jsMain/resources/index.html