Skip to content

Commit

Permalink
Fix Quiz mode crash on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ZaneH committed Jul 9, 2022
1 parent fcdd82e commit 5fa80e5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "export GENERATE_SOURCEMAP=false; cross-env BROWSER=none react-scripts start",
"start": "cross-env BROWSER=none react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand Down
16 changes: 8 additions & 8 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 18 additions & 19 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,29 @@ fn open_midi_connection(
let mut midi_in = MidiInput::new("piano-trainer-input").unwrap();
midi_in.ignore(Ignore::None);
let midi_in_ports = midi_in.ports();
*midi_state.input.lock().unwrap() = None;

if let Some(in_port) = midi_in_ports.get(input_idx) {
let conn_in = midi_in
.connect(
in_port,
"midir",
move |stamp, message, _log| {
// The last of the three callback parameters is the object that we pass in as last parameter of `connect`.
.connect(
in_port,
"midir",
move |stamp, message, _log| {
// The last of the three callback parameters is the object that we pass in as last parameter of `connect`.

handle
.emit_all(
"midi_message",
MidiMessage {
message: message.to_vec(),
},
)
.map_err(|err| println!("{:?}", err))
.ok();
handle
.emit_all(
"midi_message",
MidiMessage {
message: message.to_vec(),
},
)
.map_err(|err| println!("{:?}", err))
.ok();

println!("{}: {:?} (len = {})", stamp, message, message.len());
}, ()).unwrap();

println!("{}: {:?} (len = {})", stamp, message, message.len());
},
(),
)
.unwrap();
*midi_state.input.lock().unwrap() = Some(conn_in);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": {
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "pkill MIDIServer; npm run start",
"beforeDevCommand": "npm run start",
"devPath": "http://localhost:3000",
"distDir": "../build"
},
"package": {
"productName": "Piano Trainer",
"version": "1.0.2"
"version": "1.0.3"
},
"tauri": {
"allowlist": {
Expand Down
7 changes: 0 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8884,13 +8884,6 @@ tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==

"tauri-plugin-store-api@github:tauri-apps/tauri-plugin-store":
version "0.1.0"
resolved "https://codeload.github.com/tauri-apps/tauri-plugin-store/tar.gz/9e3732e0cf53b72ced6903583660cd7c5f756781"
dependencies:
"@tauri-apps/api" "1.0.1"
tslib "2.4.0"

"tauri-plugin-store-api@https://github.com/tauri-apps/tauri-plugin-store#dev":
version "0.1.0"
resolved "https://github.com/tauri-apps/tauri-plugin-store#9e3732e0cf53b72ced6903583660cd7c5f756781"
Expand Down

0 comments on commit 5fa80e5

Please sign in to comment.