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
+2
-3
@@ -57,7 +57,8 @@ reading (`history::tests`), highlight clipping (`highlight::tests`) and formatti
|
|||||||
2. Pipe client: done. Requests are typed (`Command`), the worker thread keeps the UI off tokio.
|
2. Pipe client: done. Requests are typed (`Command`), the worker thread keeps the UI off tokio.
|
||||||
The same types are tested against the daemon's serde names.
|
The same types are tested against the daemon's serde names.
|
||||||
3. Settings: done. General, recording, audio and daemon tabs; device and encoder lists come from
|
3. Settings: done. General, recording, audio and daemon tabs; device and encoder lists come from
|
||||||
`getAudioDevices` and `getEncoders`; changes go out through `updateSettings`.
|
`getAudioDevices` and `getEncoders`; changes go out through `updateSettings`, and each
|
||||||
|
application volume slider sends `updateAudioSource` as it moves.
|
||||||
4. Match history: done. Cards read `GameHistory.vue`'s fields (result, champion, queue, KDA,
|
4. Match history: done. Cards read `GameHistory.vue`'s fields (result, champion, queue, KDA,
|
||||||
CS/m, gold/m, LP change) from the raw API responses in each timeline, with the queue filters.
|
CS/m, gold/m, LP change) from the raw API responses in each timeline, with the queue filters.
|
||||||
5. Video: not libmpv. Rune ships a `Player` with a native surface and frame seeking
|
5. Video: not libmpv. Rune ships a `Player` with a native surface and frame seeking
|
||||||
@@ -81,8 +82,6 @@ reading (`history::tests`), highlight clipping (`highlight::tests`) and formatti
|
|||||||
JSON matches the daemon's `IpcCommand` and response types in tests.
|
JSON matches the daemon's `IpcCommand` and response types in tests.
|
||||||
- Champion and item images are not drawn: the app has no Data Dragon image cache yet, so cards
|
- Champion and item images are not drawn: the app has no Data Dragon image cache yet, so cards
|
||||||
show names and numbers.
|
show names and numbers.
|
||||||
- Settings currently apply on Save. Per-source volume editing exists in the model but has no
|
|
||||||
control yet.
|
|
||||||
|
|
||||||
## The vendored crates
|
## The vendored crates
|
||||||
|
|
||||||
|
|||||||
+48
-2
@@ -10,7 +10,7 @@ use crate::history::{self, QueueCategory, Timeline};
|
|||||||
use crate::ipc::{self, Daemon};
|
use crate::ipc::{self, Daemon};
|
||||||
use crate::os;
|
use crate::os;
|
||||||
use crate::screens;
|
use crate::screens;
|
||||||
use crate::settings::Settings;
|
use crate::settings::{AudioSource, AudioSourceType, Settings};
|
||||||
use crate::ui::{self, Paint, body, heading};
|
use crate::ui::{self, Paint, body, heading};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
@@ -170,7 +170,53 @@ impl App {
|
|||||||
};
|
};
|
||||||
self.games = history::sample();
|
self.games = history::sample();
|
||||||
self.games_loaded = true;
|
self.games_loaded = true;
|
||||||
let settings = Settings::default();
|
self.devices = AudioDevices {
|
||||||
|
input_devices: vec![AudioDevice {
|
||||||
|
id: "mic-1".into(),
|
||||||
|
name: "Microphone (USB Audio)".into(),
|
||||||
|
is_default: true,
|
||||||
|
}],
|
||||||
|
output_devices: vec![
|
||||||
|
AudioDevice {
|
||||||
|
id: "out-1".into(),
|
||||||
|
name: "Speakers (Realtek)".into(),
|
||||||
|
is_default: true,
|
||||||
|
},
|
||||||
|
AudioDevice {
|
||||||
|
id: "out-2".into(),
|
||||||
|
name: "Headphones (USB Audio)".into(),
|
||||||
|
is_default: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
self.encoders = Encoders {
|
||||||
|
available: vec![EncoderInfo {
|
||||||
|
id: "jim_nvenc".into(),
|
||||||
|
name: "NVIDIA NVENC".into(),
|
||||||
|
available: true,
|
||||||
|
is_hardware: true,
|
||||||
|
}],
|
||||||
|
current: "jim_nvenc".into(),
|
||||||
|
};
|
||||||
|
let mut settings = Settings::default();
|
||||||
|
settings.audio.capture_apps = vec![
|
||||||
|
AudioSource {
|
||||||
|
id: "discord".into(),
|
||||||
|
name: "Discord".into(),
|
||||||
|
source_type: AudioSourceType::Application,
|
||||||
|
device: "Discord.exe".into(),
|
||||||
|
volume: Some(80),
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
AudioSource {
|
||||||
|
id: "spotify".into(),
|
||||||
|
name: "Spotify".into(),
|
||||||
|
source_type: AudioSourceType::Application,
|
||||||
|
device: "Spotify.exe".into(),
|
||||||
|
volume: Some(35),
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
self.form.apply(&settings);
|
self.form.apply(&settings);
|
||||||
self.settings = Some(settings);
|
self.settings = Some(settings);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-5
@@ -39,10 +39,7 @@ pub enum Command {
|
|||||||
GetEncoders,
|
GetEncoders,
|
||||||
GetAudioDevices,
|
GetAudioDevices,
|
||||||
AddAudioSource,
|
AddAudioSource,
|
||||||
RemoveAudioSource {
|
RemoveAudioSource { id: String },
|
||||||
id: String,
|
|
||||||
},
|
|
||||||
#[allow(dead_code)]
|
|
||||||
UpdateAudioSource,
|
UpdateAudioSource,
|
||||||
StartRecording,
|
StartRecording,
|
||||||
StopRecording,
|
StopRecording,
|
||||||
@@ -376,7 +373,6 @@ impl Daemon {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn update_audio_source(&self, source: Value) {
|
pub fn update_audio_source(&self, source: Value) {
|
||||||
self.send(
|
self.send(
|
||||||
Request::UpdateAudioSource,
|
Request::UpdateAudioSource,
|
||||||
|
|||||||
@@ -667,19 +667,22 @@ fn audio(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content:
|
|||||||
.h(36.0),
|
.h(36.0),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for source in &a.capture_apps {
|
for (index, source) in a.capture_apps.iter().enumerate() {
|
||||||
let id = source.id.clone();
|
let id = source.id.clone();
|
||||||
|
let volume = source.volume.unwrap_or(100);
|
||||||
sources = sources.child(
|
sources = sources.child(
|
||||||
row()
|
row()
|
||||||
.key(format!("source-{}", source.id))
|
.key(format!("source-{}", source.id))
|
||||||
.h(40.0)
|
.h(48.0)
|
||||||
.px(space::S3)
|
.px(space::S3)
|
||||||
.center_y()
|
.center_y()
|
||||||
|
.gap(space::S3)
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.radius(radius::MD)
|
.radius(radius::MD)
|
||||||
.child(
|
.child(
|
||||||
col()
|
col()
|
||||||
.key("source-labels")
|
.key("source-labels")
|
||||||
|
.grow(1.0)
|
||||||
.gap(1.0)
|
.gap(1.0)
|
||||||
.child(
|
.child(
|
||||||
text(source.name.clone())
|
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()),
|
.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(
|
.child(ui::button(
|
||||||
p,
|
p,
|
||||||
&format!("remove-{}", source.id),
|
&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;
|
let source_type = app.form.source_type;
|
||||||
content
|
content
|
||||||
.child(ui::card(
|
.child(ui::card(
|
||||||
|
|||||||
+2
-1
@@ -180,11 +180,12 @@ pub fn toggle_row(
|
|||||||
/// A 0-100 slider with its value spelled out on the right.
|
/// A 0-100 slider with its value spelled out on the right.
|
||||||
pub fn slider(
|
pub fn slider(
|
||||||
p: Paint,
|
p: Paint,
|
||||||
key: &'static str,
|
key: impl Into<String>,
|
||||||
label: &'static str,
|
label: &'static str,
|
||||||
value: u32,
|
value: u32,
|
||||||
on_change: impl Fn(&mut App, u32) + Send + Sync + 'static,
|
on_change: impl Fn(&mut App, u32) + Send + Sync + 'static,
|
||||||
) -> El {
|
) -> El {
|
||||||
|
let key = key.into();
|
||||||
let (w, h, k, bar) = (180.0, 22.0, 18.0, 4.0);
|
let (w, h, k, bar) = (180.0, 22.0, 18.0, 4.0);
|
||||||
let travel = w - k;
|
let travel = w - k;
|
||||||
let v = (value.min(100) as f32 / 100.0).clamp(0.0, 1.0);
|
let v = (value.min(100) as f32 / 100.0).clamp(0.0, 1.0);
|
||||||
|
|||||||
Reference in new issue
Block a user