File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ mod stream;
2525///
2626/// ASIO only supports loading a single driver at a time globally, so all Host instances
2727/// must share the same underlying sys::Asio wrapper to properly coordinate driver access.
28- static GLOBAL_ASIO : OnceLock < Arc < sys:: Asio > > = OnceLock :: new ( ) ;
28+ pub ( crate ) static GLOBAL_ASIO : OnceLock < Arc < sys:: Asio > > = OnceLock :: new ( ) ;
2929
3030/// The host for ASIO.
3131#[ derive( Debug ) ]
Original file line number Diff line number Diff line change @@ -31,11 +31,27 @@ impl AsioDeviceExt for Device {
3131 }
3232
3333 fn asio_open_control_panel ( & self ) -> Result < ( ) , BackendSpecificError > {
34+ use crate :: host:: asio:: GLOBAL_ASIO ;
3435 use crate :: platform:: DeviceInner ;
3536
3637 if let DeviceInner :: Asio ( ref asio_device) = self . as_inner ( ) {
37- asio_device
38- . driver
38+ let description = asio_device
39+ . description ( )
40+ . map_err ( |e| BackendSpecificError {
41+ description : format ! ( "Could not get device name: {:?}" , e) ,
42+ } ) ?;
43+
44+ let driver = GLOBAL_ASIO
45+ . get ( )
46+ . ok_or ( BackendSpecificError {
47+ description : "ASIO not initialized." . into ( ) ,
48+ } ) ?
49+ . load_driver ( description. name ( ) )
50+ . map_err ( |e| BackendSpecificError {
51+ description : format ! ( "Failed to load driver: {:?}" , e) ,
52+ } ) ?;
53+
54+ driver
3955 . open_control_panel ( )
4056 . map_err ( |e| BackendSpecificError {
4157 description : format ! ( "Failed to open control panel: {:?}" , e) ,
You can’t perform that action at this time.
0 commit comments