@@ -132,23 +132,23 @@ impl AudioBackendManager for CpalBackend {
132
132
133
133
let device = if options. sink_id . is_empty ( ) {
134
134
host. default_output_device ( )
135
- . expect ( "no output device available" )
135
+ . expect ( "InvalidStateError - no output device available" )
136
136
} else {
137
137
Self :: enumerate_devices_sync ( )
138
138
. into_iter ( )
139
139
. find ( |e| e. device_id ( ) == options. sink_id )
140
140
. map ( |e| * e. device ( ) . downcast :: < cpal:: Device > ( ) . unwrap ( ) )
141
141
. unwrap_or_else ( || {
142
142
host. default_output_device ( )
143
- . expect ( "no output device available" )
143
+ . expect ( "InvalidStateError - no output device available" )
144
144
} )
145
145
} ;
146
146
147
147
log:: info!( "Output device: {:?}" , device. name( ) ) ;
148
148
149
149
let default_device_config = device
150
150
. default_output_config ( )
151
- . expect ( "error while querying config" ) ;
151
+ . expect ( "InvalidStateError - error while querying device output config" ) ;
152
152
153
153
// we grab the largest number of channels provided by the soundcard
154
154
// clamped to MAX_CHANNELS, this value cannot be changed by the user
@@ -247,11 +247,15 @@ impl AudioBackendManager for CpalBackend {
247
247
Arc :: clone ( & output_latency) ,
248
248
) ;
249
249
250
- spawned. expect ( "OutputStream build failed with default config" )
250
+ spawned
251
+ . expect ( "InvalidStateError - Unable to spawn output stream with default config" )
251
252
}
252
253
} ;
253
254
254
- stream. play ( ) . expect ( "Stream refused to play" ) ;
255
+ // Required because some hosts don't play the stream automatically
256
+ stream
257
+ . play ( )
258
+ . expect ( "InvalidStateError - Output stream refused to play" ) ;
255
259
256
260
CpalBackend {
257
261
stream : ThreadSafeClosableStream :: new ( stream) ,
@@ -272,23 +276,23 @@ impl AudioBackendManager for CpalBackend {
272
276
273
277
let device = if options. sink_id . is_empty ( ) {
274
278
host. default_input_device ( )
275
- . expect ( "no input device available" )
279
+ . expect ( "InvalidStateError - no input device available" )
276
280
} else {
277
281
Self :: enumerate_devices_sync ( )
278
282
. into_iter ( )
279
283
. find ( |e| e. device_id ( ) == options. sink_id )
280
284
. map ( |e| * e. device ( ) . downcast :: < cpal:: Device > ( ) . unwrap ( ) )
281
285
. unwrap_or_else ( || {
282
286
host. default_input_device ( )
283
- . expect ( "no input device available" )
287
+ . expect ( "InvalidStateError - no input device available" )
284
288
} )
285
289
} ;
286
290
287
291
log:: info!( "Input device: {:?}" , device. name( ) ) ;
288
292
289
293
let supported = device
290
294
. default_input_config ( )
291
- . expect ( "error while querying configs " ) ;
295
+ . expect ( "InvalidStateError - error while querying device input config " ) ;
292
296
293
297
// clone the config, we may need to fall back on it later
294
298
let mut preferred: StreamConfig = supported. clone ( ) . into ( ) ;
@@ -349,12 +353,15 @@ impl AudioBackendManager for CpalBackend {
349
353
& supported_config,
350
354
renderer,
351
355
) ;
352
- spawned. expect ( "Unable to spawn input stream with default config" )
356
+ spawned
357
+ . expect ( "InvalidStateError - Unable to spawn input stream with default config" )
353
358
}
354
359
} ;
355
360
356
361
// Required because some hosts don't play the stream automatically
357
- stream. play ( ) . expect ( "Input stream refused to play" ) ;
362
+ stream
363
+ . play ( )
364
+ . expect ( "InvalidStateError - Input stream refused to play" ) ;
358
365
359
366
let backend = CpalBackend {
360
367
stream : ThreadSafeClosableStream :: new ( stream) ,
0 commit comments