mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
Fix virtual mic audio linking (#62)
* Fix virtual mic audio linking by managing it in AudioPlayer lifecycle - Moved `link_player_to_virtual_mic` to `src/utils/pipewire.rs` and updated it to return a termination sender. - Added `player_link_sender` to `AudioPlayer` to manage the PipeWire link between the daemon and the virtual mic. - Integrated linking logic into `AudioPlayer::play` and `AudioPlayer::update` to ensure the link is established when audio starts playing. - Ensured the link is terminated in `AudioPlayer::drop_stream` when the audio sink is closed. - Removed redundant and potentially failing startup linking loop from the daemon. - Fixed log spam by ensuring `link_player` is only attempted when necessary and errors are handled gracefully. - Maintained compatibility with stable Rust by avoiding unstable features. Co-authored-by: arabianq <55220741+arabianq@users.noreply.github.com> * small refactor * refactor --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5c4b8f4b45
commit
2a8fcca06b
+10
-4
@@ -8,8 +8,11 @@ use std::path::PathBuf;
|
||||
/// Convert an egui Key + Modifiers to a normalized chord string like "Ctrl+Shift+A".
|
||||
fn chord_from_event(modifiers: &Modifiers, key: &Key) -> Option<String> {
|
||||
let key_name = key.name();
|
||||
let is_valid = (key_name.len() == 1 && key_name.chars().next().unwrap().is_ascii_alphanumeric())
|
||||
|| (key_name.starts_with('F') && key_name.len() > 1 && key_name[1..].chars().all(|c| c.is_ascii_digit()));
|
||||
let is_valid = (key_name.len() == 1
|
||||
&& key_name.chars().next().unwrap().is_ascii_alphanumeric())
|
||||
|| (key_name.starts_with('F')
|
||||
&& key_name.len() > 1
|
||||
&& key_name[1..].chars().all(|c| c.is_ascii_digit()));
|
||||
if !is_valid {
|
||||
return None;
|
||||
}
|
||||
@@ -56,8 +59,11 @@ pub fn parse_chord(chord: &str) -> Option<(Modifiers, Key)> {
|
||||
}
|
||||
|
||||
let key_name = parts[parts.len() - 1];
|
||||
let is_valid = (key_name.len() == 1 && key_name.chars().next().unwrap().is_ascii_alphanumeric())
|
||||
|| (key_name.starts_with('F') && key_name.len() > 1 && key_name[1..].chars().all(|c| c.is_ascii_digit()));
|
||||
let is_valid = (key_name.len() == 1
|
||||
&& key_name.chars().next().unwrap().is_ascii_alphanumeric())
|
||||
|| (key_name.starts_with('F')
|
||||
&& key_name.len() > 1
|
||||
&& key_name[1..].chars().all(|c| c.is_ascii_digit()));
|
||||
|
||||
if !is_valid {
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user