Add channel selection

This commit is contained in:
2024-06-26 14:10:03 +02:00
parent 2bcd1e0b71
commit f7e088bb67
6 changed files with 53 additions and 29 deletions

View File

@@ -54,6 +54,9 @@ abstract class AudioNode(
abstract fun onMessage(message: MessageEvent)
open fun postMessage(msg: Any) {
if (port == null) {
console.log("postMessage port is NULL!")
}
port?.postMessage(msg)
}

View File

@@ -13,6 +13,7 @@ import kotlinx.html.h1
import kotlinx.html.input
import kotlinx.html.js.onChangeFunction
import kotlinx.html.js.onClickFunction
import kotlinx.html.js.onInputFunction
import kotlinx.html.option
import kotlinx.html.select
import kotlinx.html.span
@@ -111,9 +112,11 @@ object MainView : Komponent() {
input {
type = InputType.number
value = Midi.inputChannel.toString()
onChangeFunction = { event ->
onInputFunction = { event ->
val target = event.target as HTMLInputElement
Midi.inputChannel = target.value.toInt()
println("onInput channel: ${Midi.inputChannel}")
VstChipWorklet.postMessage("set_channel\n${Midi.inputChannel}")
}
}
}
@@ -155,7 +158,7 @@ object MainView : Komponent() {
input {
type = InputType.number
value = Midi.outputChannel.toString()
onChangeFunction = { event ->
onInputFunction = { event ->
val target = event.target as HTMLInputElement
Midi.outputChannel = target.value.toInt()
}
@@ -230,6 +233,8 @@ object MainView : Komponent() {
margin(1.rem)
padding(1.rem)
backgroundColor(Css.currentStyle.buttonBackgroundColor)
borderColor(Css.currentStyle.buttonBorderColor)
borderWidth(Css.currentStyle.buttonBorderWidth)
color(Css.currentStyle.mainFontColor)
hover {

View File

@@ -13,7 +13,7 @@ class StyleDefinition(
val inputBackgroundColor : Color = mainBackgroundColor.lighten(15),
val buttonBackgroundColor : Color = mainBackgroundColor.lighten(15),
val buttonBorderColor : Color = mainFontColor.changeAlpha(0.25),
val buttonBorderWidth : Measurement = 2.px,
val buttonBorderWidth : Measurement = 1.px,
)
object NoTextSelectCls : CssName("no-text-select")