mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
use device name instead of node id to get audio device
This commit is contained in:
+3
-3
@@ -287,7 +287,7 @@ impl SoundpadGui {
|
||||
ui.add_space(5.0);
|
||||
ui.horizontal_top(|ui| {
|
||||
// ---------- Microphone selection ----------
|
||||
let mut mics: Vec<(&u32, &String)> =
|
||||
let mut mics: Vec<(&String, &String)> =
|
||||
self.audio_player_state.all_inputs.iter().collect();
|
||||
mics.sort_by_key(|(k, _)| *k);
|
||||
|
||||
@@ -301,8 +301,8 @@ impl SoundpadGui {
|
||||
.unwrap_or(&String::new()),
|
||||
)
|
||||
.show_ui(ui, |ui| {
|
||||
for (index, device) in mics {
|
||||
ui.selectable_value(&mut selected_input, index.to_owned(), device);
|
||||
for (name, nick) in mics {
|
||||
ui.selectable_value(&mut selected_input, name.to_owned(), nick);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+3
-3
@@ -92,12 +92,12 @@ impl SoundpadGui {
|
||||
make_request_sync(Request::play(path.to_str().unwrap())).ok();
|
||||
}
|
||||
|
||||
pub fn set_input(&mut self, id: u32) {
|
||||
make_request_sync(Request::set_input(id)).ok();
|
||||
pub fn set_input(&mut self, name: String) {
|
||||
make_request_sync(Request::set_input(&name)).ok();
|
||||
|
||||
if self.config.save_input {
|
||||
let mut daemon_config = get_daemon_config();
|
||||
daemon_config.default_input_id = Some(id);
|
||||
daemon_config.default_input_name = Some(name);
|
||||
daemon_config.save_to_file().ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user