@@ -120,6 +120,41 @@ fn test_switch_device_in_scope_while_paused(scope: Scope) {
120
120
stm. core_stream_data . input_unit
121
121
} ;
122
122
123
+ let check_devices = |current| {
124
+ stm. queue . run_sync ( || {
125
+ let ( bus, unit, id) = if scope == Scope :: Output {
126
+ (
127
+ AU_OUT_BUS ,
128
+ stm. core_stream_data . output_unit ,
129
+ stm. core_stream_data . output_device . id ,
130
+ )
131
+ } else {
132
+ (
133
+ AU_IN_BUS ,
134
+ stm. core_stream_data . input_unit ,
135
+ stm. core_stream_data . input_device . id ,
136
+ )
137
+ } ;
138
+ let mut device_id: AudioDeviceID = 0 ;
139
+ let mut size = std:: mem:: size_of :: < AudioDeviceID > ( ) ;
140
+ let status = audio_unit_get_property (
141
+ unit,
142
+ kAudioOutputUnitProperty_CurrentDevice,
143
+ kAudioUnitScope_Global,
144
+ bus,
145
+ & mut device_id,
146
+ & mut size,
147
+ ) ;
148
+ if status != NO_ERR {
149
+ panic ! ( "Could not get device ID from audiounit" ) ;
150
+ }
151
+ assert_eq ! ( id, current) ;
152
+ assert_eq ! ( device_id, current) ;
153
+ } ) ;
154
+ } ;
155
+
156
+ check_devices ( device_switcher. current ( ) ) ;
157
+
123
158
// Pause the stream, and change the default device
124
159
assert_eq ! ( unsafe { OPS . stream_stop. unwrap( ) ( stream) } , ffi:: CUBEB_OK ) ;
125
160
@@ -148,6 +183,8 @@ fn test_switch_device_in_scope_while_paused(scope: Scope) {
148
183
// Start the stream, and check that the device in use isn't the same as before pausing
149
184
assert_eq ! ( unsafe { OPS . stream_start. unwrap( ) ( stream) } , ffi:: CUBEB_OK ) ;
150
185
186
+ check_devices ( device_switcher. current ( ) ) ;
187
+
151
188
let after = if scope == Scope :: Output {
152
189
stm. core_stream_data . output_unit
153
190
} else {
0 commit comments