Fx
This commit is contained in:
@@ -30,13 +30,20 @@ external class MIDIOutput {
|
||||
val type: String
|
||||
val version: String
|
||||
|
||||
fun send(message: dynamic)
|
||||
fun send(message: dynamic, timestamp: dynamic)
|
||||
|
||||
fun open()
|
||||
fun close()
|
||||
}
|
||||
|
||||
object Midi {
|
||||
var inputChannel: Int = -1
|
||||
var outputChannel: Int = -1
|
||||
|
||||
var inputs = mutableListOf<MIDIInput>()
|
||||
var outputs = mutableListOf<MIDIInput>()
|
||||
var outputs = mutableListOf<MIDIOutput>()
|
||||
var currentInput: MIDIInput? = null
|
||||
var currentOutput: MIDIOutput? = null
|
||||
|
||||
fun start() {
|
||||
val navigator = window.navigator.asDynamic()
|
||||
@@ -68,7 +75,7 @@ object Midi {
|
||||
)
|
||||
}
|
||||
|
||||
fun setInput(input: MIDIInput) {
|
||||
fun setInput(input: MIDIInput?) {
|
||||
console.log("Setting input", input)
|
||||
currentInput?.close()
|
||||
|
||||
@@ -94,4 +101,17 @@ object Midi {
|
||||
currentInput?.open()
|
||||
}
|
||||
|
||||
fun setOutput(output: MIDIOutput?) {
|
||||
console.log("Setting output", output)
|
||||
currentOutput?.close()
|
||||
|
||||
currentOutput = output
|
||||
|
||||
currentOutput?.open()
|
||||
}
|
||||
|
||||
fun send(data: Uint8Array, timestamp: dynamic? = null) {
|
||||
currentOutput?.send(data, timestamp)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user