Listen to midi
This commit is contained in:
@@ -7,14 +7,19 @@ import daw.style.CssId
|
||||
import daw.style.CssName
|
||||
import daw.style.hover
|
||||
import kotlinx.html.FlowContent
|
||||
import kotlinx.html.P
|
||||
import kotlinx.html.a
|
||||
import kotlinx.html.br
|
||||
import kotlinx.html.classes
|
||||
import kotlinx.html.div
|
||||
import kotlinx.html.h1
|
||||
import kotlinx.html.hr
|
||||
import kotlinx.html.js.onChangeFunction
|
||||
import kotlinx.html.js.onClickFunction
|
||||
import kotlinx.html.js.onMouseDownFunction
|
||||
import kotlinx.html.js.onMouseUpFunction
|
||||
import kotlinx.html.option
|
||||
import kotlinx.html.select
|
||||
import kotlinx.html.span
|
||||
import nl.astraeus.css.properties.BoxSizing
|
||||
import nl.astraeus.css.properties.FontWeight
|
||||
@@ -27,7 +32,9 @@ import nl.astraeus.komp.Komponent
|
||||
import nl.astraeus.vst.Note
|
||||
import nl.astraeus.vst.chip.audio.VstChipWorklet
|
||||
import nl.astraeus.vst.chip.channel.Broadcaster
|
||||
import nl.astraeus.vst.chip.midi.Midi
|
||||
import org.khronos.webgl.Int32Array
|
||||
import org.w3c.dom.HTMLSelectElement
|
||||
|
||||
object MainView : Komponent() {
|
||||
private var messages: MutableList<String> = ArrayList()
|
||||
@@ -68,31 +75,27 @@ object MainView : Komponent() {
|
||||
}
|
||||
}
|
||||
div {
|
||||
a {
|
||||
href = "#"
|
||||
+"Send broadcast test message"
|
||||
onClickFunction = {
|
||||
Broadcaster.send("Test message")
|
||||
}
|
||||
}
|
||||
}
|
||||
div {
|
||||
a {
|
||||
href = "#"
|
||||
+"Note on"
|
||||
onClickFunction = {
|
||||
VstChipWorklet.postMessage("test_on")
|
||||
}
|
||||
}
|
||||
a {
|
||||
href = "#"
|
||||
+"Note off"
|
||||
onClickFunction = {
|
||||
VstChipWorklet.postMessage("test_off")
|
||||
+ "Midi input: "
|
||||
select {
|
||||
for (mi in Midi.inputs) {
|
||||
option {
|
||||
+mi.name
|
||||
value = mi.id
|
||||
}
|
||||
}
|
||||
|
||||
onChangeFunction = { event ->
|
||||
val target = event.target as HTMLSelectElement
|
||||
val selected = Midi.inputs.find { it.id == target.value }
|
||||
if (selected != null) {
|
||||
Midi.setInput(selected)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
br {}
|
||||
|
||||
hr {}
|
||||
|
||||
repeat(9) {
|
||||
|
||||
Reference in New Issue
Block a user