-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hey @yara-blue ,
as requested, here is some "early feedback". I'd like to select a non-default Output by the device.id from cpal. Unfortunately, the Output struct encapsulates cpal::Device and with it the ability to select a device by id:
Something like this is not possible for Output:
let device = if let Some(device) = opt.device.clone() {
let id = &device.parse().expect("failed to parse device id");
host.device_by_id(id)
} else {
host.default_output_device()
}.expect("failed to find output device");
// fields are private
let output = Output {
default: false,
inner: device
};When enumerating devices the id is not accessible either:
use rodio::speakers::{SpeakersBuilder, available_outputs};
// List all available output devices
let outputs = available_outputs()?;
for (i, output) in outputs.iter().enumerate() {
// no access to output.device_id either.
println!("output {}: {}", i, output);
}
// Use a specific device (e.g., the second one)
let speakers = SpeakersBuilder::new()
.device(outputs[1].clone())?
.default_config()?
.open_mixer()?;So saving and restoring a selected device by a unique device identifier is not possible despite I overlooked something important.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels