Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
node-version: '20'
- name: Verify Studio browser session flow
run: node --test apps/amp-cast/web/studio-session.test.cjs apps/amp-cast/web/studio-playlists.test.cjs
- name: Verify Remote mix feedback
run: node --test tools/test_remote_mix_report.cjs
- name: Validate open third-party module contract
run: cargo run -p amp-plugin --bin amp-plugin-conformance -- plugins/amp-community-tuner/plugin.json
- run: cargo fmt --all --check
Expand Down
4 changes: 4 additions & 0 deletions apps/amp-player/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ pub enum Execution {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(tag = "action", rename_all = "snake_case", deny_unknown_fields)]
pub enum Action {
FlagLastTransition {
#[serde(default)]
reason: Option<amp_core::transition_report::Reason>,
},
SaveMusicScene {
name: String,
},
Expand Down
5 changes: 4 additions & 1 deletion apps/amp-player/src/dj_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ impl Player {
ui.ctx().data_mut(|d| d.remove::<Cached>(id));
}
});
if let Some(error) = self.run.trick_history_failure() {
if ui.button("Mix reports…").clicked() {
self.reports.open();
}
if let Some(error) = self.reports.failure() {
ui.weak(format!("Technique history: {error}"));
}
if !self.run.trick_decision.reason.is_empty() {
Expand Down
9 changes: 7 additions & 2 deletions apps/amp-player/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ mod theme;
mod track_columns;
mod track_sort;
mod transition_controls;
mod transition_reports;
mod transition_styles;
mod trick_history;
#[allow(dead_code)] // Shared implementation also used by the standalone installer binary.
mod update_package;
mod v1_profile;
Expand Down Expand Up @@ -223,6 +223,7 @@ struct Player {
player_mode: u8,
player_on_top: bool,
run: performance::Run,
reports: transition_reports::Reports,
show_editor: show_editor::Editor,
playlist_sync: playlist_sync::Client,
server_library: library_remote::Remote,
Expand Down Expand Up @@ -349,6 +350,7 @@ impl Default for Player {
player_mode: 0,
player_on_top: load_player_on_top(),
run: Default::default(),
reports: Default::default(),
show_editor: Default::default(),
playlist_sync: Default::default(),
server_library: Default::default(),
Expand Down Expand Up @@ -1652,6 +1654,7 @@ impl Player {
2 => {
self.dj_ui(ui);
self.dj_settings_window(ui.ctx());
self.reports.window(ui.ctx());
}
3 => {
let action = self.lab.show(ui, &self.root, self.library.as_ref());
Expand Down Expand Up @@ -2673,7 +2676,7 @@ impl Player {
ui.weak("|");
ui.label(kind);
ui.weak("|");
let width = (ui.available_width() - 190.).clamp(80., 360.);
let width = (ui.available_width() - 340.).clamp(80., 360.);
ui.scope(|ui| {
ui.set_max_width(width);
ui.add(egui::Label::new(egui::RichText::new(name).strong()).truncate())
Expand All @@ -2696,6 +2699,7 @@ impl Player {
if settings.clicked() {
self.open_dj_settings(ui.ctx());
}
self.reports.button(ui);
}
fn performance_mix_options(&mut self, ui: &mut egui::Ui) {
ui.weak("Auto Mix ON uses the engine. OFF leaves the decks under manual control.");
Expand Down Expand Up @@ -3809,6 +3813,7 @@ impl eframe::App for Player {
let _ = onnx_stem_worker::shutdown();
}
fn logic(&mut self, ctx: &egui::Context, _: &mut eframe::Frame) {
self.reports.attach(ctx);
if !cfg!(test) {
static NETWORK_STARTED: std::sync::OnceLock<()> = std::sync::OnceLock::new();
NETWORK_STARTED.get_or_init(|| {
Expand Down
22 changes: 21 additions & 1 deletion apps/amp-player/src/mixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub struct Controls {
pub intent_generation: [AtomicU64; 6],
pub level_fading: AtomicBool,
pub fade_progress: AtomicU32,
pub fade_started: AtomicBool,
pub play: [AtomicBool; 6],
pub loaded: [AtomicBool; 6],
pub ready: [AtomicBool; 6],
Expand Down Expand Up @@ -227,6 +228,7 @@ impl Default for Controls {
intent_generation: std::array::from_fn(|_| AtomicU64::new(0)),
level_fading: AtomicBool::new(false),
fade_progress: atom(0.),
fade_started: AtomicBool::new(false),
play: std::array::from_fn(|_| AtomicBool::new(false)),
loaded: std::array::from_fn(|_| AtomicBool::new(false)),
ready: std::array::from_fn(|_| AtomicBool::new(false)),
Expand Down Expand Up @@ -738,6 +740,7 @@ impl Mixer {
});
set(&self.controls.fade_progress, 0.);
self.controls.fading.store(true, Relaxed);
self.controls.fade_started.store(false, Relaxed);
}
Command::Mashup {
to,
Expand All @@ -764,13 +767,15 @@ impl Mixer {
set(&self.controls.fade_progress, 0.);
self.controls.fading.store(true, Relaxed);
self.controls.mashup_active.store(true, Relaxed);
self.controls.fade_started.store(false, Relaxed);
}
Command::ScheduledFade {
to,
seconds,
grid,
at,
} => {
self.controls.fade_started.store(false, Relaxed);
set(&self.controls.fade_progress, 0.);
self.fade = Some(Fade {
handoff_mode: std::mem::take(&mut self.pending_handoff),
Expand Down Expand Up @@ -869,6 +874,7 @@ impl Mixer {
self.controls.fading.store(false, Relaxed);
}
Command::Fade { to, seconds } => {
self.controls.fade_started.store(false, Relaxed);
set(&self.controls.fade_progress, 0.);
self.fade = Some(Fade {
handoff_mode: std::mem::take(&mut self.pending_handoff),
Expand Down Expand Up @@ -1218,6 +1224,7 @@ impl Mixer {
if !fade.started && due && c.ready[fade.incoming].load(Relaxed) {
c.play[fade.incoming].store(true, Relaxed);
fade.started = true;
c.fade_started.store(true, Relaxed);
let bpm = get(&c.bpm[outgoing]) as f64;
let rate = c.effective_rate(outgoing) as f64;
if bpm > 0. && rate > 0. {
Expand Down Expand Up @@ -2769,6 +2776,15 @@ impl Engine {
pub fn channel_level(&self, d: usize) -> f32 {
get(&self.controls.gain[d])
}
/// Applied normalization, trim and channel volume before crossfader/master.
pub fn deck_gain_db(&self, deck: usize) -> Option<f64> {
let gain = get(self.controls.gain.get(deck)?) as f64;
(gain > 0.).then(|| {
20. * gain.log10()
+ get(&self.controls.trim_db[deck]) as f64
+ get(&self.controls.auto_gain_db[deck]) as f64
})
}
pub fn level_fade(
&self,
slot: usize,
Expand Down Expand Up @@ -3436,7 +3452,11 @@ mod tests {
},
})
.unwrap();
mixer.render(8999, |_, _| {});
mixer.render(999, |_, _| {});
assert!(c.fading.load(Relaxed));
assert!(!c.fade_started.load(Relaxed));
mixer.render(8000, |_, _| {});
assert!(c.fade_started.load(Relaxed));
assert!(c.fading.load(Relaxed));
assert!(c.play[0].load(Relaxed));
mixer.render(3, |_, _| {});
Expand Down
Loading
Loading