Skip to content

Commit

Permalink
wip-DEBUG10
Browse files Browse the repository at this point in the history
  • Loading branch information
Pehrsons committed Nov 6, 2023
1 parent af93d3b commit b0150ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/backend/device_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,28 +266,6 @@ pub fn get_device_stream_configuration(
let len = list.mNumberBuffers as usize;
let mut buffers = unsafe { slice::from_raw_parts(ptr, len) };

cubeb_log!(
"get_device_stream_configuration id={}; type={}; tap {}; running={}; num_buffers={}, buffers={:?}",
id,
match devtype {
DeviceType::INPUT => "INPUT",
DeviceType::OUTPUT => "OUTPUT",
_ => "UNKNOWN",
},
match get_device_tap_enabled(id) {
Ok(true) => "enabled",
Ok(false) => "not enabled",
_ => "ERRORED",
},
match get_device_is_running(id) {
Ok(true) => "true",
Ok(false) => "false",
_ => "ERRORED",
},
len,
buffers
);

const ISPK: u32 = 0x6973_706B; // "ispk" (internal speaker)
if devtype == DeviceType::INPUT
&& get_device_tap_enabled(id).unwrap_or(false)
Expand Down Expand Up @@ -316,20 +294,6 @@ pub fn get_device_tap_enabled(id: AudioDeviceID) -> std::result::Result<bool, OS
Ok(enabled != 0)
}

pub fn get_device_is_running(id: AudioDeviceID) -> std::result::Result<bool, OSStatus> {
let address = get_property_address(
Property::DeviceIsRunning,
DeviceType::INPUT | DeviceType::OUTPUT,
);
let mut running: u32 = 0;
let mut size = mem::size_of::<u32>();
let err = audio_object_get_property_data(id, &address, &mut size, &mut running);
if err != NO_ERR {
return Err(err);
}
Ok(running != 0)
}

pub fn get_stream_latency(
id: AudioStreamID,
devtype: DeviceType,
Expand Down
19 changes: 19 additions & 0 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,25 @@ fn get_channel_count(

let buffers = get_device_stream_configuration(devid, devtype)?;
let mut count = 0;
println!(
"dev {} {} {} TAP {:?} SOURCE stream_configuration={:?}",
devid,
match devtype {
DeviceType::INPUT => "input",
DeviceType::OUTPUT => "output",
_ => "type-unknown",
},
match get_device_tap_enabled(devid) {
Ok(true) => "YEA",
Ok(false) => "NAY",
_ => "UNKNOWN",
},
match get_device_source(devid, DeviceType::OUTPUT) {
Ok(tt) => convert_uint32_into_string(tt),
_ => CString::default(),
},
buffers
);
for buffer in buffers {
count += buffer.mNumberChannels;
}
Expand Down

0 comments on commit b0150ef

Please sign in to comment.