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 {
22952295 }
22962296
22972297 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) {
22982303 if let VoiceState::In { muted, .. } = &mut self.chat.voice_state {
22992304 *muted = value;
23002305 self.network.set_muted(value);
23012306 }
2302- cx.notify();
23032307 }
23042308
23052309 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 {
4343 pub(super) enum MicTest {
4444 Off,
4545 On,
46+ MutingCall,
4647 }
4748
4849 #[derive(Clone, Copy, PartialEq, Eq)]
@@ -269,9 +270,7 @@ impl Yumush {
269270 ),
270271 ];
271272
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)));
275274 match voice.activation {
276275 Activation::VoiceActivity => {
277276 rows.push(row("Sensitivity", self.sensitivity_control(palette)))
@@ -286,7 +285,7 @@ impl Yumush {
286285 }
287286
288287 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;
290289 let mic = entity.clone();
291290 let speaker = entity.clone();
292291
@@ -473,10 +472,15 @@ impl Yumush {
473472
474473 pub(super) fn toggle_mic_test(&mut self, cx: &mut Context<Self>) {
475474 match self.voice.mic_test {
476- MicTest::On => self.stop_mic_test(),
475+ MicTest::On | MicTest::MutingCall => self.stop_mic_test(),
477476 MicTest::Off => {
478477 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+ };
480484 self.start_level_poll(cx);
481485 }
482486 }
@@ -485,6 +489,9 @@ impl Yumush {
485489
486490 pub(super) fn stop_mic_test(&mut self) {
487491 self.network.stop_mic_test();
492+ if self.voice.mic_test == MicTest::MutingCall {
493+ self.set_call_muted(false);
494+ }
488495 self.voice.mic_test = MicTest::Off;
489496 self.voice.level_poll = None;
490497 }