Kotlin, Compose for TV and Media3 port of the desktop Musyx, with device-code sign-in, Home, My Wave, search, collection, detail pages, Now Playing with queue and lyrics, and settings for streaming quality, appearance, font size (small, medium, large) and language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
1.2 KiB
Rust
24 lines
1.2 KiB
Rust
//! Lists output devices and tries to open each one: `cargo run -p musyx --example audio_probe`.
|
|
use rodio::DeviceSinkBuilder;
|
|
use rodio::cpal::traits::{DeviceTrait, HostTrait};
|
|
|
|
fn main() {
|
|
let host = rodio::cpal::default_host();
|
|
let default = host.default_output_device();
|
|
println!("default: {:?}", default.as_ref().and_then(|d| d.description().ok()).map(|d| d.name().to_string()));
|
|
for device in host.output_devices().expect("devices") {
|
|
let name = device.description().map(|d| d.name().to_string()).unwrap_or_default();
|
|
let config = device.default_output_config();
|
|
println!("\n{name}\n default config: {config:?}");
|
|
match DeviceSinkBuilder::from_device(device.clone()).map(|b| b.open_stream()) {
|
|
Ok(Ok(_)) => println!(" open (rodio defaults): ok"),
|
|
Ok(Err(e)) => println!(" open (rodio defaults): {e:?}"),
|
|
Err(e) => println!(" builder: {e:?}"),
|
|
}
|
|
if let Ok(config) = config {
|
|
let r = DeviceSinkBuilder::default().with_device(device.clone()).with_supported_config(&config).open_stream();
|
|
println!(" open (device default buffer): {:?}", r.map(|_| "ok"));
|
|
}
|
|
}
|
|
}
|