@@ -199,7 +199,7 @@ fn create_device_info(devid: AudioDeviceID, devtype: DeviceType) -> Option<devic
199199 } ;
200200
201201 if devid == kAudioObjectUnknown {
202- cubeb_log ! ( "Use the system default device" ) ;
202+ cubeb_log ! ( "Using the system default device" ) ;
203203 flags |= device_flags:: DEV_SELECTED_DEFAULT ;
204204 get_default_device ( devtype) . map ( |id| device_info { id, flags } )
205205 } else {
@@ -390,7 +390,7 @@ extern "C" fn audiounit_input_callback(
390390 // output device is no longer valid and must be reset.
391391 // For now state that no error occurred and feed silence, stream will be
392392 // resumed once reinit has completed.
393- cubeb_logv ! (
393+ cubeb_alog ! (
394394 "({:p}) input: reinit pending, output will pull silence instead" ,
395395 stm. core_stream_data. stm_ptr
396396 ) ;
@@ -402,7 +402,7 @@ extern "C" fn audiounit_input_callback(
402402 ErrorHandle :: Return ( status)
403403 } ;
404404
405- cubeb_logv ! (
405+ cubeb_alogv ! (
406406 "({:p}) input: buffers {}, size {}, channels {}, rendered frames {}, total frames {}." ,
407407 stm. core_stream_data. stm_ptr,
408408 input_buffer_list. mNumberBuffers,
@@ -530,7 +530,7 @@ extern "C" fn audiounit_output_callback(
530530 } ;
531531
532532 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 ) ;
534534 audiounit_make_silent ( & mut buffers[ 0 ] ) ;
535535 return NO_ERR ;
536536 }
@@ -554,7 +554,7 @@ extern "C" fn audiounit_output_callback(
554554 . store ( output_latency_frames, Ordering :: SeqCst ) ;
555555 }
556556
557- cubeb_logv ! (
557+ cubeb_alogv ! (
558558 "({:p}) output: buffers {}, size {}, channels {}, frames {}." ,
559559 stm as * const AudioUnitStream ,
560560 buffers. len( ) ,
@@ -599,7 +599,7 @@ extern "C" fn audiounit_output_callback(
599599 if prev_frames_written == 0 && buffered_input_frames > input_frames_needed as usize {
600600 input_buffer_manager. trim ( input_frames_needed) ;
601601 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) ;
603603 }
604604
605605 let input_frames = if input_frames_needed > buffered_input_frames
@@ -609,7 +609,7 @@ extern "C" fn audiounit_output_callback(
609609 {
610610 // The silent frames will be inserted in `get_linear_data` below.
611611 let silent_frames_to_push = input_frames_needed - buffered_input_frames;
612- cubeb_log ! (
612+ cubeb_alog ! (
613613 "({:p}) Missing Frames: {} will append {} frames of input silence." ,
614614 stm. core_stream_data. stm_ptr,
615615 if stm. frames_read. load( Ordering :: SeqCst ) == 0 {
@@ -716,7 +716,7 @@ extern "C" fn audiounit_property_listener_callback(
716716 let addrs = unsafe { slice:: from_raw_parts ( addresses, address_count as usize ) } ;
717717 if stm. switching_device . load ( Ordering :: SeqCst ) {
718718 cubeb_log ! (
719- "Switching is already taking place. Skip Events for device {}" ,
719+ "Switching is already taking place. Skipping event for device {}" ,
720720 id
721721 ) ;
722722 return NO_ERR ;
@@ -725,9 +725,8 @@ extern "C" fn audiounit_property_listener_callback(
725725
726726 let mut input_device_dead = false ;
727727
728- // Log the events
729728 cubeb_log ! (
730- "({:p}) Handle {} device changed events for device {}" ,
729+ "({:p}) Handling {} device changed events for device {}" ,
731730 stm as * const AudioUnitStream ,
732731 address_count,
733732 id
@@ -743,7 +742,7 @@ extern "C" fn audiounit_property_listener_callback(
743742
744743 // Handle the events
745744 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" ) ;
747746 stm. stopped . store ( true , Ordering :: SeqCst ) ;
748747 stm. core_stream_data . stop_audiounits ( ) ;
749748 stm. close_on_error ( ) ;
@@ -803,7 +802,7 @@ fn audiounit_convert_channel_layout(layout: &AudioChannelLayout) -> Vec<mixer::C
803802 // kAudioChannelLayoutTag_Mono
804803 // kAudioChannelLayoutTag_Stereo
805804 // ....
806- cubeb_log ! ( "Only handle UseChannelDescriptions for now.\n " ) ;
805+ cubeb_log ! ( "Only handling UseChannelDescriptions for now.\n " ) ;
807806 return Vec :: new ( ) ;
808807 }
809808
@@ -962,7 +961,7 @@ fn create_audiounit(device: &device_info) -> Result<AudioUnit> {
962961
963962 set_device_to_audiounit ( unit, device. id ) . map_err ( |e| {
964963 cubeb_log ! (
965- "Fail to set device {} to the created audiounit. Error: {}" ,
964+ "Failed to set device {} to the created audiounit. Error: {}" ,
966965 device. id,
967966 e
968967 ) ;
@@ -1158,7 +1157,7 @@ fn set_buffer_size_sync(unit: AudioUnit, devtype: DeviceType, frames: u32) -> Re
11581157
11591158 set_buffer_size ( unit, devtype, frames) . map_err ( |e| {
11601159 cubeb_log ! (
1161- "Fail to set buffer size for AudioUnit {:?} for {:?}. Error: {}" ,
1160+ "Failed to set buffer size for AudioUnit {:?} for {:?}. Error: {}" ,
11621161 unit,
11631162 devtype,
11641163 e
@@ -1172,7 +1171,7 @@ fn set_buffer_size_sync(unit: AudioUnit, devtype: DeviceType, frames: u32) -> Re
11721171 let ( chg, timeout_res) = cvar. wait_timeout ( changed, waiting_time) . unwrap ( ) ;
11731172 if timeout_res. timed_out ( ) {
11741173 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 {:?}" ,
11761175 unit,
11771176 devtype
11781177 ) ;
@@ -1303,7 +1302,7 @@ fn get_fixed_latency(devid: AudioObjectID, devtype: DeviceType) -> u32 {
13031302 let stream_latency = get_device_streams ( devid, devtype) . and_then ( |streams| {
13041303 if streams. is_empty ( ) {
13051304 cubeb_log ! (
1306- "No any stream on device {} in {:?} scope!" ,
1305+ "No stream on device {} in {:?} scope!" ,
13071306 devid,
13081307 devtype
13091308 ) ;
@@ -1338,13 +1337,13 @@ fn get_device_group_id(
13381337 match get_custom_group_id ( id, devtype) {
13391338 Some ( id) => return Ok ( id) ,
13401339 None => {
1341- cubeb_log ! ( "Get model uid instead." ) ;
1340+ cubeb_log ! ( "Getting model UID instead." ) ;
13421341 }
13431342 } ;
13441343 }
13451344 Ok ( trans_type) => {
13461345 cubeb_log ! (
1347- "The transport type is {:?}. Get model uid instead." ,
1346+ "The transport type is {:?}. Getting model UID instead." ,
13481347 convert_uint32_into_string( trans_type)
13491348 ) ;
13501349 }
@@ -1373,7 +1372,7 @@ fn get_custom_group_id(id: AudioDeviceID, devtype: DeviceType) -> Option<CString
13731372 s @ Ok ( IMIC ) | s @ Ok ( ISPK ) => {
13741373 const GROUP_ID : & str = "builtin-internal-mic|spk" ;
13751374 cubeb_log ! (
1376- "Use hardcode group id: {} when source is: {:?}." ,
1375+ "Using hardcode group id: {} when source is: {:?}." ,
13771376 GROUP_ID ,
13781377 convert_uint32_into_string( s. unwrap( ) )
13791378 ) ;
@@ -1382,7 +1381,7 @@ fn get_custom_group_id(id: AudioDeviceID, devtype: DeviceType) -> Option<CString
13821381 s @ Ok ( EMIC ) | s @ Ok ( HDPN ) => {
13831382 const GROUP_ID : & str = "builtin-external-mic|hdpn" ;
13841383 cubeb_log ! (
1385- "Use hardcode group id: {} when source is: {:?}." ,
1384+ "Using hardcode group id: {} when source is: {:?}." ,
13861385 GROUP_ID ,
13871386 convert_uint32_into_string( s. unwrap( ) )
13881387 ) ;
@@ -1444,7 +1443,7 @@ fn create_cubeb_device_info(
14441443 }
14451444 Err ( e) => {
14461445 cubeb_log ! (
1447- "Cannot get the uid for device {} in {:?} scope. Error: {}" ,
1446+ "Cannot get the UID for device {} in {:?} scope. Error: {}" ,
14481447 devid,
14491448 devtype,
14501449 e
@@ -1458,7 +1457,7 @@ fn create_cubeb_device_info(
14581457 }
14591458 Err ( e) => {
14601459 cubeb_log ! (
1461- "Cannot get the model uid for device {} in {:?} scope. Error: {}" ,
1460+ "Cannot get the model UID for device {} in {:?} scope. Error: {}" ,
14621461 devid,
14631462 devtype,
14641463 e
@@ -1547,7 +1546,7 @@ fn create_cubeb_device_info(
15471546 latency + range. mMaximum as u32 ,
15481547 ) ,
15491548 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) ;
15511550 (
15521551 10 * dev_info. default_rate / 1000 ,
15531552 100 * dev_info. default_rate / 1000 ,
@@ -1659,7 +1658,7 @@ fn audiounit_get_devices_of_type(devtype: DeviceType) -> Vec<AudioObjectID> {
16591658 let info = format ! ( "{} ({})" , device, label) ;
16601659
16611660 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) ;
16631662 if channels > 0 {
16641663 devices_in_scope. push ( device) ;
16651664 }
@@ -1755,7 +1754,9 @@ impl DevicesData {
17551754 }
17561755
17571756 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 ( )
1758+ && self . callback_user_ptr . is_null ( )
1759+ && self . devices . is_empty ( )
17591760 }
17601761}
17611762
@@ -2350,17 +2351,32 @@ impl<'ctx> CoreStreamData<'ctx> {
23502351 // It's impossible to create an aggregate device from an aggregate device, and it's
23512352 // unnecessary to create an aggregate device when opening the same device input/output. In
23522353 // all other cases, use an aggregate device.
2353-
23542354 let mut either_already_aggregate = false ;
23552355 if self . has_input ( ) {
2356- either_already_aggregate | =
2356+ let input_is_aggregate =
23572357 get_device_transport_type ( self . input_device . id , DeviceType :: INPUT ) . unwrap_or ( 0 )
23582358 == kAudioDeviceTransportTypeAggregate;
2359+ if input_is_aggregate {
2360+ either_already_aggregate = true ;
2361+ }
2362+ cubeb_log ! (
2363+ "Input device ID: {} (aggregate: {:?})" ,
2364+ self . input_device. id,
2365+ input_is_aggregate
2366+ ) ;
23592367 }
23602368 if self . has_output ( ) {
2361- either_already_aggregate | =
2369+ let output_is_aggregate =
23622370 get_device_transport_type ( self . output_device . id , DeviceType :: OUTPUT ) . unwrap_or ( 0 )
23632371 == kAudioDeviceTransportTypeAggregate;
2372+ if output_is_aggregate {
2373+ either_already_aggregate = true ;
2374+ }
2375+ cubeb_log ! (
2376+ "Output device ID: {} (aggregate: {:?})" ,
2377+ self . input_device. id,
2378+ output_is_aggregate
2379+ ) ;
23642380 }
23652381 // Only use an aggregate device when the device are different.
23662382 self . has_input ( )
@@ -2437,15 +2453,15 @@ impl<'ctx> CoreStreamData<'ctx> {
24372453 out_dev_info. flags = device_flags:: DEV_OUTPUT ;
24382454 self . aggregate_device = Some ( device) ;
24392455 cubeb_log ! (
2440- "({:p}) Use aggregate device {} for input and output." ,
2456+ "({:p}) Using an aggregate device {} for input and output." ,
24412457 self . stm_ptr,
24422458 self . aggregate_device. as_ref( ) . unwrap( ) . get_device_id( )
24432459 ) ;
24442460 }
24452461 Err ( e) => {
24462462 cubeb_log ! (
2447- "({:p}) Create aggregate devices failed. Error: {}.\
2448- Use assigned devices directly instead.",
2463+ "({:p}) Creation of aggregate devices failed. Error: {}.\
2464+ Using assigned devices directly instead.",
24492465 self . stm_ptr,
24502466 e
24512467 ) ;
@@ -2461,7 +2477,7 @@ impl<'ctx> CoreStreamData<'ctx> {
24612477 // Configure I/O stream
24622478 if self . has_input ( ) {
24632479 cubeb_log ! (
2464- "({:p}) Initialize input by device info: {:?}" ,
2480+ "({:p}) Initializing input by device info: {:?}" ,
24652481 self . stm_ptr,
24662482 in_dev_info
24672483 ) ;
0 commit comments