@@ -199,7 +199,7 @@ fn create_device_info(devid: AudioDeviceID, devtype: DeviceType) -> Option<devic
199
199
} ;
200
200
201
201
if devid == kAudioObjectUnknown {
202
- cubeb_log ! ( "Use the system default device" ) ;
202
+ cubeb_log ! ( "Using the system default device" ) ;
203
203
flags |= device_flags:: DEV_SELECTED_DEFAULT ;
204
204
get_default_device ( devtype) . map ( |id| device_info { id, flags } )
205
205
} else {
@@ -390,7 +390,7 @@ extern "C" fn audiounit_input_callback(
390
390
// output device is no longer valid and must be reset.
391
391
// For now state that no error occurred and feed silence, stream will be
392
392
// resumed once reinit has completed.
393
- cubeb_logv ! (
393
+ cubeb_alog ! (
394
394
"({:p}) input: reinit pending, output will pull silence instead" ,
395
395
stm. core_stream_data. stm_ptr
396
396
) ;
@@ -402,7 +402,7 @@ extern "C" fn audiounit_input_callback(
402
402
ErrorHandle :: Return ( status)
403
403
} ;
404
404
405
- cubeb_logv ! (
405
+ cubeb_alogv ! (
406
406
"({:p}) input: buffers {}, size {}, channels {}, rendered frames {}, total frames {}." ,
407
407
stm. core_stream_data. stm_ptr,
408
408
input_buffer_list. mNumberBuffers,
@@ -530,7 +530,7 @@ extern "C" fn audiounit_output_callback(
530
530
} ;
531
531
532
532
if stm. stopped . load ( Ordering :: SeqCst ) {
533
- cubeb_log ! ( "({:p}) output stopped." , stm as * const AudioUnitStream ) ;
533
+ cubeb_alog ! ( "({:p}) output stopped." , stm as * const AudioUnitStream ) ;
534
534
audiounit_make_silent ( & mut buffers[ 0 ] ) ;
535
535
return NO_ERR ;
536
536
}
@@ -554,7 +554,7 @@ extern "C" fn audiounit_output_callback(
554
554
. store ( output_latency_frames, Ordering :: SeqCst ) ;
555
555
}
556
556
557
- cubeb_logv ! (
557
+ cubeb_alogv ! (
558
558
"({:p}) output: buffers {}, size {}, channels {}, frames {}." ,
559
559
stm as * const AudioUnitStream ,
560
560
buffers. len( ) ,
@@ -599,7 +599,7 @@ extern "C" fn audiounit_output_callback(
599
599
if prev_frames_written == 0 && buffered_input_frames > input_frames_needed as usize {
600
600
input_buffer_manager. trim ( input_frames_needed) ;
601
601
let popped_frames = buffered_input_frames - input_frames_needed as usize ;
602
- cubeb_log ! ( "Dropping {} frames in input buffer." , popped_frames) ;
602
+ cubeb_alog ! ( "Dropping {} frames in input buffer." , popped_frames) ;
603
603
}
604
604
605
605
let input_frames = if input_frames_needed > buffered_input_frames
@@ -609,7 +609,7 @@ extern "C" fn audiounit_output_callback(
609
609
{
610
610
// The silent frames will be inserted in `get_linear_data` below.
611
611
let silent_frames_to_push = input_frames_needed - buffered_input_frames;
612
- cubeb_log ! (
612
+ cubeb_alog ! (
613
613
"({:p}) Missing Frames: {} will append {} frames of input silence." ,
614
614
stm. core_stream_data. stm_ptr,
615
615
if stm. frames_read. load( Ordering :: SeqCst ) == 0 {
@@ -716,7 +716,7 @@ extern "C" fn audiounit_property_listener_callback(
716
716
let addrs = unsafe { slice:: from_raw_parts ( addresses, address_count as usize ) } ;
717
717
if stm. switching_device . load ( Ordering :: SeqCst ) {
718
718
cubeb_log ! (
719
- "Switching is already taking place. Skip Events for device {}" ,
719
+ "Switching is already taking place. Skipping event for device {}" ,
720
720
id
721
721
) ;
722
722
return NO_ERR ;
@@ -725,9 +725,8 @@ extern "C" fn audiounit_property_listener_callback(
725
725
726
726
let mut input_device_dead = false ;
727
727
728
- // Log the events
729
728
cubeb_log ! (
730
- "({:p}) Handle {} device changed events for device {}" ,
729
+ "({:p}) Handling {} device changed events for device {}" ,
731
730
stm as * const AudioUnitStream ,
732
731
address_count,
733
732
id
@@ -743,7 +742,7 @@ extern "C" fn audiounit_property_listener_callback(
743
742
744
743
// Handle the events
745
744
if input_device_dead {
746
- cubeb_log ! ( "The user-selected input device is dead, enter error state" ) ;
745
+ cubeb_log ! ( "The user-selected input device is dead, entering error state" ) ;
747
746
stm. stopped . store ( true , Ordering :: SeqCst ) ;
748
747
stm. core_stream_data . stop_audiounits ( ) ;
749
748
stm. close_on_error ( ) ;
@@ -803,7 +802,7 @@ fn audiounit_convert_channel_layout(layout: &AudioChannelLayout) -> Vec<mixer::C
803
802
// kAudioChannelLayoutTag_Mono
804
803
// kAudioChannelLayoutTag_Stereo
805
804
// ....
806
- cubeb_log ! ( "Only handle UseChannelDescriptions for now.\n " ) ;
805
+ cubeb_log ! ( "Only handling UseChannelDescriptions for now.\n " ) ;
807
806
return Vec :: new ( ) ;
808
807
}
809
808
@@ -962,7 +961,7 @@ fn create_audiounit(device: &device_info) -> Result<AudioUnit> {
962
961
963
962
set_device_to_audiounit ( unit, device. id ) . map_err ( |e| {
964
963
cubeb_log ! (
965
- "Fail to set device {} to the created audiounit. Error: {}" ,
964
+ "Failed to set device {} to the created audiounit. Error: {}" ,
966
965
device. id,
967
966
e
968
967
) ;
@@ -1158,7 +1157,7 @@ fn set_buffer_size_sync(unit: AudioUnit, devtype: DeviceType, frames: u32) -> Re
1158
1157
1159
1158
set_buffer_size ( unit, devtype, frames) . map_err ( |e| {
1160
1159
cubeb_log ! (
1161
- "Fail to set buffer size for AudioUnit {:?} for {:?}. Error: {}" ,
1160
+ "Failed to set buffer size for AudioUnit {:?} for {:?}. Error: {}" ,
1162
1161
unit,
1163
1162
devtype,
1164
1163
e
@@ -1172,7 +1171,7 @@ fn set_buffer_size_sync(unit: AudioUnit, devtype: DeviceType, frames: u32) -> Re
1172
1171
let ( chg, timeout_res) = cvar. wait_timeout ( changed, waiting_time) . unwrap ( ) ;
1173
1172
if timeout_res. timed_out ( ) {
1174
1173
cubeb_log ! (
1175
- "Time out for waiting the buffer frame size setting of AudioUnit {:?} for {:?}" ,
1174
+ "Timed out for waiting the buffer frame size setting of AudioUnit {:?} for {:?}" ,
1176
1175
unit,
1177
1176
devtype
1178
1177
) ;
@@ -1303,7 +1302,7 @@ fn get_fixed_latency(devid: AudioObjectID, devtype: DeviceType) -> u32 {
1303
1302
let stream_latency = get_device_streams ( devid, devtype) . and_then ( |streams| {
1304
1303
if streams. is_empty ( ) {
1305
1304
cubeb_log ! (
1306
- "No any stream on device {} in {:?} scope!" ,
1305
+ "No stream on device {} in {:?} scope!" ,
1307
1306
devid,
1308
1307
devtype
1309
1308
) ;
@@ -1338,13 +1337,13 @@ fn get_device_group_id(
1338
1337
match get_custom_group_id ( id, devtype) {
1339
1338
Some ( id) => return Ok ( id) ,
1340
1339
None => {
1341
- cubeb_log ! ( "Get model uid instead." ) ;
1340
+ cubeb_log ! ( "Getting model UID instead." ) ;
1342
1341
}
1343
1342
} ;
1344
1343
}
1345
1344
Ok ( trans_type) => {
1346
1345
cubeb_log ! (
1347
- "The transport type is {:?}. Get model uid instead." ,
1346
+ "The transport type is {:?}. Getting model UID instead." ,
1348
1347
convert_uint32_into_string( trans_type)
1349
1348
) ;
1350
1349
}
@@ -1373,7 +1372,7 @@ fn get_custom_group_id(id: AudioDeviceID, devtype: DeviceType) -> Option<CString
1373
1372
s @ Ok ( IMIC ) | s @ Ok ( ISPK ) => {
1374
1373
const GROUP_ID : & str = "builtin-internal-mic|spk" ;
1375
1374
cubeb_log ! (
1376
- "Use hardcode group id: {} when source is: {:?}." ,
1375
+ "Using hardcode group id: {} when source is: {:?}." ,
1377
1376
GROUP_ID ,
1378
1377
convert_uint32_into_string( s. unwrap( ) )
1379
1378
) ;
@@ -1382,7 +1381,7 @@ fn get_custom_group_id(id: AudioDeviceID, devtype: DeviceType) -> Option<CString
1382
1381
s @ Ok ( EMIC ) | s @ Ok ( HDPN ) => {
1383
1382
const GROUP_ID : & str = "builtin-external-mic|hdpn" ;
1384
1383
cubeb_log ! (
1385
- "Use hardcode group id: {} when source is: {:?}." ,
1384
+ "Using hardcode group id: {} when source is: {:?}." ,
1386
1385
GROUP_ID ,
1387
1386
convert_uint32_into_string( s. unwrap( ) )
1388
1387
) ;
@@ -1444,7 +1443,7 @@ fn create_cubeb_device_info(
1444
1443
}
1445
1444
Err ( e) => {
1446
1445
cubeb_log ! (
1447
- "Cannot get the uid for device {} in {:?} scope. Error: {}" ,
1446
+ "Cannot get the UID for device {} in {:?} scope. Error: {}" ,
1448
1447
devid,
1449
1448
devtype,
1450
1449
e
@@ -1458,7 +1457,7 @@ fn create_cubeb_device_info(
1458
1457
}
1459
1458
Err ( e) => {
1460
1459
cubeb_log ! (
1461
- "Cannot get the model uid for device {} in {:?} scope. Error: {}" ,
1460
+ "Cannot get the model UID for device {} in {:?} scope. Error: {}" ,
1462
1461
devid,
1463
1462
devtype,
1464
1463
e
@@ -1547,7 +1546,7 @@ fn create_cubeb_device_info(
1547
1546
latency + range. mMaximum as u32 ,
1548
1547
) ,
1549
1548
Err ( e) => {
1550
- cubeb_log ! ( "Cannot get the buffer frame size for device {} in {:?} scope. Use default value instead. Error: {}" , devid, devtype, e) ;
1549
+ cubeb_log ! ( "Cannot get the buffer frame size for device {} in {:?} scope. Using default value instead. Error: {}" , devid, devtype, e) ;
1551
1550
(
1552
1551
10 * dev_info. default_rate / 1000 ,
1553
1552
100 * dev_info. default_rate / 1000 ,
@@ -1659,7 +1658,7 @@ fn audiounit_get_devices_of_type(devtype: DeviceType) -> Vec<AudioObjectID> {
1659
1658
let info = format ! ( "{} ({})" , device, label) ;
1660
1659
1661
1660
if let Ok ( channels) = get_channel_count ( device, devtype) {
1662
- cubeb_log ! ( "device {} has {} {:?}-channels" , info, channels, devtype) ;
1661
+ cubeb_log ! ( "Device {} has {} {:?}-channels" , info, channels, devtype) ;
1663
1662
if channels > 0 {
1664
1663
devices_in_scope. push ( device) ;
1665
1664
}
@@ -1755,7 +1754,7 @@ impl DevicesData {
1755
1754
}
1756
1755
1757
1756
fn is_empty ( & self ) -> bool {
1758
- self . changed_callback == None && self . callback_user_ptr . is_null ( ) && self . devices . is_empty ( )
1757
+ self . changed_callback . is_none ( ) && self . callback_user_ptr . is_null ( ) && self . devices . is_empty ( )
1759
1758
}
1760
1759
}
1761
1760
@@ -2350,17 +2349,32 @@ impl<'ctx> CoreStreamData<'ctx> {
2350
2349
// It's impossible to create an aggregate device from an aggregate device, and it's
2351
2350
// unnecessary to create an aggregate device when opening the same device input/output. In
2352
2351
// all other cases, use an aggregate device.
2353
-
2354
2352
let mut either_already_aggregate = false ;
2355
2353
if self . has_input ( ) {
2356
- either_already_aggregate | =
2354
+ let input_is_aggregate =
2357
2355
get_device_transport_type ( self . input_device . id , DeviceType :: INPUT ) . unwrap_or ( 0 )
2358
2356
== kAudioDeviceTransportTypeAggregate;
2357
+ if input_is_aggregate {
2358
+ either_already_aggregate = true ;
2359
+ }
2360
+ cubeb_log ! (
2361
+ "Input device ID: {} (aggregate: {:?})" ,
2362
+ self . input_device. id,
2363
+ input_is_aggregate
2364
+ ) ;
2359
2365
}
2360
2366
if self . has_output ( ) {
2361
- either_already_aggregate | =
2367
+ let output_is_aggregate =
2362
2368
get_device_transport_type ( self . output_device . id , DeviceType :: OUTPUT ) . unwrap_or ( 0 )
2363
2369
== kAudioDeviceTransportTypeAggregate;
2370
+ if output_is_aggregate {
2371
+ either_already_aggregate = true ;
2372
+ }
2373
+ cubeb_log ! (
2374
+ "Output device ID: {} (aggregate: {:?})" ,
2375
+ self . input_device. id,
2376
+ output_is_aggregate
2377
+ ) ;
2364
2378
}
2365
2379
// Only use an aggregate device when the device are different.
2366
2380
self . has_input ( )
@@ -2437,15 +2451,15 @@ impl<'ctx> CoreStreamData<'ctx> {
2437
2451
out_dev_info. flags = device_flags:: DEV_OUTPUT ;
2438
2452
self . aggregate_device = Some ( device) ;
2439
2453
cubeb_log ! (
2440
- "({:p}) Use aggregate device {} for input and output." ,
2454
+ "({:p}) Using an aggregate device {} for input and output." ,
2441
2455
self . stm_ptr,
2442
2456
self . aggregate_device. as_ref( ) . unwrap( ) . get_device_id( )
2443
2457
) ;
2444
2458
}
2445
2459
Err ( e) => {
2446
2460
cubeb_log ! (
2447
- "({:p}) Create aggregate devices failed. Error: {}.\
2448
- Use assigned devices directly instead.",
2461
+ "({:p}) Creation of aggregate devices failed. Error: {}.\
2462
+ Using assigned devices directly instead.",
2449
2463
self . stm_ptr,
2450
2464
e
2451
2465
) ;
@@ -2461,7 +2475,7 @@ impl<'ctx> CoreStreamData<'ctx> {
2461
2475
// Configure I/O stream
2462
2476
if self . has_input ( ) {
2463
2477
cubeb_log ! (
2464
- "({:p}) Initialize input by device info: {:?}" ,
2478
+ "({:p}) Initializing input by device info: {:?}" ,
2465
2479
self . stm_ptr,
2466
2480
in_dev_info
2467
2481
) ;
0 commit comments