Skip to content

Commit

Permalink
Update windows to 0.54
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Mar 4, 2024
1 parent 9e2d3c3 commit 9071660
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -43,7 +43,7 @@ coremidi = "0.6.0"
coremidi = "0.6.0"

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.43", features = [
windows = { version = "0.54", features = [
"Win32_Foundation",
"Win32_Media",
"Win32_Media_Multimedia",
Expand Down
9 changes: 3 additions & 6 deletions src/backend/winrt/mod.rs
@@ -1,4 +1,3 @@
use std::convert::TryInto;
use std::sync::{Arc, Mutex};

use crate::errors::*;
Expand All @@ -9,7 +8,7 @@ use windows::core::HSTRING;
use windows::{
Devices::Enumeration::DeviceInformation,
Devices::Midi::*,
Foundation::{EventRegistrationToken, IClosable, TypedEventHandler},
Foundation::{EventRegistrationToken, TypedEventHandler},
Storage::Streams::{DataReader, DataWriter},
};

Expand Down Expand Up @@ -161,8 +160,7 @@ pub struct MidiInputConnection<T> {
impl<T> MidiInputConnection<T> {
pub fn close(self) -> (MidiInput, T) {
let _ = self.port.0.RemoveMessageReceived(self.event_token);
let closable: IClosable = self.port.0.try_into().unwrap();
let _ = closable.Close();
let _ = self.port.0.Close();
let device_selector = MidiInPort::GetDeviceSelector().expect("GetDeviceSelector failed"); // probably won't ever fail here, because it worked previously
let mut handler_data_locked = self.handler_data.lock().unwrap();
(
Expand Down Expand Up @@ -263,8 +261,7 @@ unsafe impl Send for MidiOutputConnection {}

impl MidiOutputConnection {
pub fn close(self) -> MidiOutput {
let closable: IClosable = self.port.try_into().unwrap();
let _ = closable.Close();
let _ = self.port.Close();
let device_selector = MidiOutPort::GetDeviceSelector().expect("GetDeviceSelector failed"); // probably won't ever fail here, because it worked previously
MidiOutput {
selector: device_selector,
Expand Down

0 comments on commit 9071660

Please sign in to comment.