app: edit per-application volume in the audio tab
Each configured source gets a slider that sends updateAudioSource as it moves, so a change is heard while dragging. The demo data now includes two application sources and a microphone, which the screenshots use. Also look the game up by recording id in the review screen, so a refresh that adds a recording does not change what is open.
This commit is contained in:
1 parent
0377141e4f
commit
8883e93d2b
5 files changed
+85
-14
No files matched your search
@@ -667,19 +667,22 @@ fn audio(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content:
|
||||
.h(36.0),
|
||||
);
|
||||
}
|
||||
for source in &a.capture_apps {
|
||||
for (index, source) in a.capture_apps.iter().enumerate() {
|
||||
let id = source.id.clone();
|
||||
let volume = source.volume.unwrap_or(100);
|
||||
sources = sources.child(
|
||||
row()
|
||||
.key(format!("source-{}", source.id))
|
||||
.h(40.0)
|
||||
.h(48.0)
|
||||
.px(space::S3)
|
||||
.center_y()
|
||||
.gap(space::S3)
|
||||
.justify_between()
|
||||
.radius(radius::MD)
|
||||
.child(
|
||||
col()
|
||||
.key("source-labels")
|
||||
.grow(1.0)
|
||||
.gap(1.0)
|
||||
.child(
|
||||
text(source.name.clone())
|
||||
@@ -698,6 +701,33 @@ fn audio(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content:
|
||||
.color(p.muted()),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
row()
|
||||
.key("source-volume")
|
||||
.gap(space::S2)
|
||||
.center_y()
|
||||
.child(ui::slider(
|
||||
p,
|
||||
format!("volume-{}", source.id),
|
||||
"Application volume",
|
||||
volume,
|
||||
move |app: &mut App, value| {
|
||||
let payload = {
|
||||
let Some(source) =
|
||||
app.form.draft.audio.capture_apps.get_mut(index)
|
||||
else {
|
||||
return;
|
||||
};
|
||||
source.volume = Some(value);
|
||||
serde_json::to_value(&*source).ok()
|
||||
};
|
||||
app.form.dirty = true;
|
||||
if let Some(payload) = payload {
|
||||
app.daemon.update_audio_source(payload);
|
||||
}
|
||||
},
|
||||
)),
|
||||
)
|
||||
.child(ui::button(
|
||||
p,
|
||||
&format!("remove-{}", source.id),
|
||||
@@ -709,7 +739,6 @@ fn audio(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content:
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
let source_type = app.form.source_type;
|
||||
content
|
||||
.child(ui::card(
|
||||
|
||||
Reference in new issue
Block a user