forge
Explore
Log in

Don't you dare go Hollow

Stream audio meter (sharer: beside your voice line

Browse files at this commit

bcb6bbd304325a70388e9353046c5253e5c2367bAhmet Kaan GümüşParent: 5da5470
  • feat
    • stream audio meter (sharer: beside your voice line
    • viewers: on the stream's label) in the sharer's hue
Show full message
✨ feat: stream audio meter (sharer: beside your voice line; viewers: on the stream's label) in the sharer's hue
crates/client/src/gui/call_bar.rsmodified+20 -0
@@ -23,6 +23,7 @@ pub struct CallBar {
23 pub deafened: bool,23 pub deafened: bool,
24 pub camera: bool,24 pub camera: bool,
25 pub screen: bool,25 pub screen: bool,
26+ pub share: Option<(Option<VecDeque<f32>>, gpui_kit::Hsla)>,
26 pub stats: bool,27 pub stats: bool,
27 }28 }
28 29
@@ -132,6 +133,10 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
132 .h(px(size::ICON))133 .h(px(size::ICON))
133 .child(voice_line(bar.bands.as_ref(), bar.voice, t)),134 .child(voice_line(bar.bands.as_ref(), bar.voice, t)),
134 )135 )
136+ .children(
137+ bar.share
138+ .map(|(bands, color)| share_meter(bands.as_ref(), color, t)),
139+ )
135 .child(140 .child(
136 div()141 div()
137 .id("bar_ping")142 .id("bar_ping")
@@ -148,3 +153,18 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
148 .child(controls),153 .child(controls),
149 )154 )
150 }155 }
156+
157+pub fn share_meter(bands: Option<&VecDeque<f32>>, color: gpui_kit::Hsla, t: Tokens) -> Div {
158+ band(space::XS)
159+ .flex_none()
160+ .child(
161+ gpui_kit::component::Icon::new(IconName::ScreenShare)
162+ .size(px(size::ICON_SM))
163+ .text_color(t.faint()),
164+ )
165+ .child(div().w(px(size::THUMB)).h(px(size::ICON)).child(voice_line(
166+ bands,
167+ Voice::Live(color),
168+ t,
169+ )))
170+}
crates/client/src/gui/camera_view.rsmodified+8 -1
@@ -584,7 +584,7 @@ fn grid_cell(
584 .into_any_element()584 .into_any_element()
585 }585 }
586 586
587-pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, _): (Id, Kind)) -> Div {587+pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, kind): (Id, Kind)) -> Div {
588 let t = palette.tokens;588 let t = palette.tokens;
589 let name = yumush589 let name = yumush
590 .chat590 .chat
@@ -605,6 +605,13 @@ pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, _): (Id, K
605 .size(px(size::ICON_SM))605 .size(px(size::ICON_SM))
606 .text_color(t.bad())606 .text_color(t.bad())
607 }))607 }))
608+ .children((kind == Kind::Screen).then(|| {
609+ super::call_bar::share_meter(
610+ yumush.chat.waves.share_line(user_id),
611+ t.person(user_id),
612+ t,
613+ )
614+ }))
608 }615 }
609 616
610 fn tile_name(name: impl Into<gpui_kit::SharedString>, ink: Ink, t: super::style::Tokens) -> Div {617 fn tile_name(name: impl Into<gpui_kit::SharedString>, ink: Ink, t: super::style::Tokens) -> Div {
crates/client/src/gui/dock.rsmodified+5 -0
@@ -45,6 +45,11 @@ impl Yumush {
45 deafened,45 deafened,
46 camera: self.network.share_source(Kind::Camera).is_some(),46 camera: self.network.share_source(Kind::Camera).is_some(),
47 screen: self.network.share_source(Kind::Screen).is_some(),47 screen: self.network.share_source(Kind::Screen).is_some(),
48+ share: self
49+ .network
50+ .share_source(Kind::Screen)
51+ .is_some()
52+ .then(|| (self.chat.waves.share_line(me).cloned(), t.person(me))),
48 stats: self.chat.stats_at == Some(super::chat::StatsAt::Dock),53 stats: self.chat.stats_at == Some(super::chat::StatsAt::Dock),
49 };54 };
50 let go_id = community.id;55 let go_id = community.id;
crates/client/src/gui/gallery.rsmodified+1 -0
@@ -335,6 +335,7 @@ fn call_page(state: State, t: Tokens) -> impl IntoElement {
335 deafened: false,335 deafened: false,
336 camera: state == State::Many,336 camera: state == State::Many,
337 screen: state == State::Many,337 screen: state == State::Many,
338+ share: (state == State::Many).then(|| (Some(bands(2.)), t.hue(Hue::Amber))),
338 stats: false,339 stats: false,
339 };340 };
340 let none = || -> call_bar::Action { Rc::new(|_, _| {}) };341 let none = || -> call_bar::Action { Rc::new(|_, _| {}) };
crates/client/src/gui/wave.rsmodified+4 -0
@@ -128,6 +128,10 @@ impl Waves {
128 self.voice.get(&id).map(|wave| &wave.bars)128 self.voice.get(&id).map(|wave| &wave.bars)
129 }129 }
130 130
131+ pub fn share_line(&self, id: Id) -> Option<&VecDeque<f32>> {
132+ self.share.get(&id).map(|wave| &wave.bars)
133+ }
134+
131 pub fn share(&self, id: Id) -> Option<&VecDeque<f32>> {135 pub fn share(&self, id: Id) -> Option<&VecDeque<f32>> {
132 self.share136 self.share
133 .get(&id)137 .get(&id)