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