Skip to content

Commit fa27be2

Browse files
Merge pull request #9 from specta-rs/by-id
Identify ports by ID not name
2 parents 96ebb2b + 4cc6034 commit fa27be2

File tree

6 files changed

+325
-254
lines changed

6 files changed

+325
-254
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "tauri-plugin-midi"
33
links = "tauri-plugin-midi"
44
description = "A WebMIDI-compatible plugin for Tauri"
55
license = "MIT"
6-
version = "0.1.1"
6+
version = "0.1.2"
77
authors = ["Brendan Allan", "Oscar Beaumont"]
88
edition = "2021"
99
rust-version = "1.60"
@@ -20,7 +20,7 @@ rustc-args = ["--cfg", "docsrs"]
2020
rustdoc-args = ["--cfg", "docsrs"]
2121

2222
[dependencies]
23-
midir = "0.9.1"
23+
midir = "0.10.1"
2424
serde = "1.0.195"
2525
specta = "=2.0.0-rc.20"
2626
tauri = { version = "^2.0.0-rc.16" }

guest-js/bindings.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66

77
export const commands = {
8-
async openInput(name: string) : Promise<void> {
9-
await TAURI_INVOKE("plugin:midi|open_input", { name });
8+
async openInput(id: string) : Promise<null> {
9+
return await TAURI_INVOKE("plugin:midi|open_input", { id });
1010
},
11-
async closeInput(name: string) : Promise<void> {
12-
await TAURI_INVOKE("plugin:midi|close_input", { name });
11+
async closeInput(id: string) : Promise<void> {
12+
await TAURI_INVOKE("plugin:midi|close_input", { id });
1313
},
14-
async openOutput(name: string) : Promise<void> {
15-
await TAURI_INVOKE("plugin:midi|open_output", { name });
14+
async openOutput(id: string) : Promise<null> {
15+
return await TAURI_INVOKE("plugin:midi|open_output", { id });
1616
},
17-
async closeOutput(name: string) : Promise<void> {
18-
await TAURI_INVOKE("plugin:midi|close_output", { name });
17+
async closeOutput(id: string) : Promise<void> {
18+
await TAURI_INVOKE("plugin:midi|close_output", { id });
1919
},
20-
async outputSend(name: string, msg: number[]) : Promise<void> {
21-
await TAURI_INVOKE("plugin:midi|output_send", { name, msg });
20+
async outputSend(id: string, msg: number[]) : Promise<null> {
21+
return await TAURI_INVOKE("plugin:midi|output_send", { id, msg });
2222
}
2323
}
2424

@@ -40,7 +40,7 @@ stateChange: "plugin:midi:state-change"
4040
/** user-defined types **/
4141

4242
export type MIDIMessage = [string, number[]]
43-
export type StateChange = { inputs: string[]; outputs: string[] }
43+
export type StateChange = { inputs: ([string, string])[]; outputs: ([string, string])[] }
4444

4545
/** tauri-specta globals **/
4646

0 commit comments

Comments
 (0)