Hear yourself works during a call: it mutes you in the call while testing and unmutes when the test stops (only if it did the muting)
Browse files at this commitfb0a19149362eaf526ec61e91e33f357c2cdff8bParent: d408566- feat
- Hear yourself works during a call: it mutes you in the call while testing and unmutes when the test stops (only if it did the muting)
2 changed files +18 -7
crates/client/src/gui/chat.rsmodified+5 -1
| @@ -2295,11 +2295,15 @@ impl Yumush { | ||
| 2295 | 2295 | } |
| 2296 | 2296 | |
| 2297 | 2297 | pub(super) fn set_muted(&mut self, value: bool, cx: &mut Context<Self>) { |
| 2298 | + self.set_call_muted(value); | |
| 2299 | + cx.notify(); | |
| 2300 | + } | |
| 2301 | + | |
| 2302 | + pub(super) fn set_call_muted(&mut self, value: bool) { | |
| 2298 | 2303 | if let VoiceState::In { muted, .. } = &mut self.chat.voice_state { |
| 2299 | 2304 | *muted = value; |
| 2300 | 2305 | self.network.set_muted(value); |
| 2301 | 2306 | } |
| 2302 | - cx.notify(); | |
| 2303 | 2307 | } |
| 2304 | 2308 | |
| 2305 | 2309 | fn confirm_ghost_speak(&mut self, window: &mut Window, cx: &mut Context<Self>) { |
crates/client/src/gui/voice_settings.rsmodified+13 -6
| @@ -43,6 +43,7 @@ pub(super) enum Side { | ||
| 43 | 43 | pub(super) enum MicTest { |
| 44 | 44 | Off, |
| 45 | 45 | On, |
| 46 | + MutingCall, | |
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | #[derive(Clone, Copy, PartialEq, Eq)] |
| @@ -269,9 +270,7 @@ impl Yumush { | ||
| 269 | 270 | ), |
| 270 | 271 | ]; |
| 271 | 272 | |
| 272 | - if self.chat.voice_community().is_none() { | |
| 273 | - rows.push(row("Test", self.test_control(entity, palette))); | |
| 274 | - } | |
| 273 | + rows.push(row("Test", self.test_control(entity, palette))); | |
| 275 | 274 | match voice.activation { |
| 276 | 275 | Activation::VoiceActivity => { |
| 277 | 276 | rows.push(row("Sensitivity", self.sensitivity_control(palette))) |
| @@ -286,7 +285,7 @@ impl Yumush { | ||
| 286 | 285 | } |
| 287 | 286 | |
| 288 | 287 | fn test_control(&self, entity: &Entity<Self>, palette: Palette) -> Div { |
| 289 | - let testing = self.voice.mic_test == MicTest::On; | |
| 288 | + let testing = self.voice.mic_test != MicTest::Off; | |
| 290 | 289 | let mic = entity.clone(); |
| 291 | 290 | let speaker = entity.clone(); |
| 292 | 291 | |
| @@ -473,10 +472,15 @@ impl Yumush { | ||
| 473 | 472 | |
| 474 | 473 | pub(super) fn toggle_mic_test(&mut self, cx: &mut Context<Self>) { |
| 475 | 474 | match self.voice.mic_test { |
| 476 | - MicTest::On => self.stop_mic_test(), | |
| 475 | + MicTest::On | MicTest::MutingCall => self.stop_mic_test(), | |
| 477 | 476 | MicTest::Off => { |
| 478 | 477 | self.network.start_mic_test(&self.settings.voice); |
| 479 | - self.voice.mic_test = MicTest::On; | |
| 478 | + self.voice.mic_test = if self.chat.voice_flags().is_some_and(|(muted, _)| !muted) { | |
| 479 | + self.set_call_muted(true); | |
| 480 | + MicTest::MutingCall | |
| 481 | + } else { | |
| 482 | + MicTest::On | |
| 483 | + }; | |
| 480 | 484 | self.start_level_poll(cx); |
| 481 | 485 | } |
| 482 | 486 | } |
| @@ -485,6 +489,9 @@ impl Yumush { | ||
| 485 | 489 | |
| 486 | 490 | pub(super) fn stop_mic_test(&mut self) { |
| 487 | 491 | self.network.stop_mic_test(); |
| 492 | + if self.voice.mic_test == MicTest::MutingCall { | |
| 493 | + self.set_call_muted(false); | |
| 494 | + } | |
| 488 | 495 | self.voice.mic_test = MicTest::Off; |
| 489 | 496 | self.voice.level_poll = None; |
| 490 | 497 | } |