forge
Explore
Log in

Don't you dare go Hollow

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 commit

fb0a19149362eaf526ec61e91e33f357c2cdff8bAhmet Kaan GümüşParent: 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)
Show full message
✨ 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)
crates/client/src/gui/chat.rsmodified+5 -1
@@ -2295,11 +2295,15 @@ impl Yumush {
2295 }2295 }
2296 2296
2297 pub(super) fn set_muted(&mut self, value: bool, cx: &mut Context<Self>) {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 if let VoiceState::In { muted, .. } = &mut self.chat.voice_state {2303 if let VoiceState::In { muted, .. } = &mut self.chat.voice_state {
2299 *muted = value;2304 *muted = value;
2300 self.network.set_muted(value);2305 self.network.set_muted(value);
2301 }2306 }
2302- cx.notify();
2303 }2307 }
2304 2308
2305 fn confirm_ghost_speak(&mut self, window: &mut Window, cx: &mut Context<Self>) {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 pub(super) enum MicTest {43 pub(super) enum MicTest {
44 Off,44 Off,
45 On,45 On,
46+ MutingCall,
46 }47 }
47 48
48 #[derive(Clone, Copy, PartialEq, Eq)]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)));
273- rows.push(row("Test", self.test_control(entity, palette)));
274- }
275 match voice.activation {274 match voice.activation {
276 Activation::VoiceActivity => {275 Activation::VoiceActivity => {
277 rows.push(row("Sensitivity", self.sensitivity_control(palette)))276 rows.push(row("Sensitivity", self.sensitivity_control(palette)))
@@ -286,7 +285,7 @@ impl Yumush {
286 }285 }
287 286
288 fn test_control(&self, entity: &Entity<Self>, palette: Palette) -> Div {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 let mic = entity.clone();289 let mic = entity.clone();
291 let speaker = entity.clone();290 let speaker = entity.clone();
292 291
@@ -473,10 +472,15 @@ impl Yumush {
473 472
474 pub(super) fn toggle_mic_test(&mut self, cx: &mut Context<Self>) {473 pub(super) fn toggle_mic_test(&mut self, cx: &mut Context<Self>) {
475 match self.voice.mic_test {474 match self.voice.mic_test {
476- MicTest::On => self.stop_mic_test(),475+ MicTest::On | MicTest::MutingCall => self.stop_mic_test(),
477 MicTest::Off => {476 MicTest::Off => {
478 self.network.start_mic_test(&self.settings.voice);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 self.start_level_poll(cx);484 self.start_level_poll(cx);
481 }485 }
482 }486 }
@@ -485,6 +489,9 @@ impl Yumush {
485 489
486 pub(super) fn stop_mic_test(&mut self) {490 pub(super) fn stop_mic_test(&mut self) {
487 self.network.stop_mic_test();491 self.network.stop_mic_test();
492+ if self.voice.mic_test == MicTest::MutingCall {
493+ self.set_call_muted(false);
494+ }
488 self.voice.mic_test = MicTest::Off;495 self.voice.mic_test = MicTest::Off;
489 self.voice.level_poll = None;496 self.voice.level_poll = None;
490 }497 }