Fix: UI/UX
Some checks failed
CI / check (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Failing after 1m28s
Deploy Website / deploy (push) Has been skipped
CI / check (macos-14, aarch64-apple-darwin) (push) Has been cancelled
CI / check (windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Some checks failed
CI / check (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Failing after 1m28s
Deploy Website / deploy (push) Has been skipped
CI / check (macos-14, aarch64-apple-darwin) (push) Has been cancelled
CI / check (windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
This commit is contained in:
@@ -49,6 +49,9 @@ pub(super) fn handle_engine_page(ctx: &mut InputContext, key: KeyEvent) -> Input
|
||||
EngineSection::Settings => {
|
||||
ctx.dispatch(AppCommand::AudioSettingPrev);
|
||||
}
|
||||
EngineSection::Samples => {
|
||||
ctx.app.audio.sample_list.move_up();
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
KeyCode::Down => match ctx.app.audio.section {
|
||||
@@ -65,6 +68,10 @@ pub(super) fn handle_engine_page(ctx: &mut InputContext, key: KeyEvent) -> Input
|
||||
EngineSection::Settings => {
|
||||
ctx.dispatch(AppCommand::AudioSettingNext);
|
||||
}
|
||||
EngineSection::Samples => {
|
||||
let count = ctx.app.audio.config.sample_paths.len();
|
||||
ctx.app.audio.sample_list.move_down(count);
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
KeyCode::PageUp => {
|
||||
@@ -128,14 +135,16 @@ pub(super) fn handle_engine_page(ctx: &mut InputContext, key: KeyEvent) -> Input
|
||||
KeyCode::Char('R') if !ctx.app.plugin_mode => {
|
||||
ctx.dispatch(AppCommand::AudioTriggerRestart);
|
||||
}
|
||||
KeyCode::Char('A') => {
|
||||
KeyCode::Char('A') if ctx.app.audio.section == EngineSection::Samples => {
|
||||
use crate::state::file_browser::FileBrowserState;
|
||||
let state = FileBrowserState::new_load(String::new());
|
||||
ctx.dispatch(AppCommand::OpenModal(Modal::AddSamplePath(Box::new(state))));
|
||||
}
|
||||
KeyCode::Char('D') => {
|
||||
if ctx.app.audio.section == EngineSection::Samples {
|
||||
ctx.dispatch(AppCommand::RemoveLastSamplePath);
|
||||
let cursor = ctx.app.audio.sample_list.cursor;
|
||||
ctx.dispatch(AppCommand::RemoveSamplePath(cursor));
|
||||
ctx.app.save_settings(ctx.link);
|
||||
} else if !ctx.app.plugin_mode {
|
||||
ctx.dispatch(AppCommand::AudioRefreshDevices);
|
||||
let out_count = ctx.app.audio.output_devices.len();
|
||||
|
||||
@@ -132,7 +132,7 @@ fn handle_normal_input(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
|
||||
}
|
||||
|
||||
if ctrl {
|
||||
let minimap_timed = MinimapMode::Timed(Instant::now() + Duration::from_millis(250));
|
||||
let minimap_timed = MinimapMode::Timed(Instant::now() + Duration::from_millis(1000));
|
||||
match key.code {
|
||||
KeyCode::Left => {
|
||||
ctx.app.ui.minimap = minimap_timed;
|
||||
@@ -168,7 +168,7 @@ fn handle_normal_input(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
|
||||
KeyCode::F(7) => Some(Page::Script),
|
||||
_ => None,
|
||||
} {
|
||||
ctx.app.ui.minimap = MinimapMode::Timed(Instant::now() + Duration::from_millis(250));
|
||||
ctx.app.ui.minimap = MinimapMode::Timed(Instant::now() + Duration::from_millis(1000));
|
||||
ctx.dispatch(AppCommand::GoToPage(page));
|
||||
return InputResult::Continue;
|
||||
}
|
||||
@@ -224,21 +224,25 @@ fn load_project_samples(ctx: &mut InputContext) {
|
||||
}
|
||||
|
||||
let mut total_count = 0;
|
||||
let mut counts = Vec::new();
|
||||
let mut all_preload_entries = Vec::new();
|
||||
for path in &paths {
|
||||
if path.is_dir() {
|
||||
let index = doux::sampling::scan_samples_dir(path);
|
||||
let count = index.len();
|
||||
total_count += count;
|
||||
counts.push(count);
|
||||
for e in &index {
|
||||
all_preload_entries.push((e.name.clone(), e.path.clone()));
|
||||
}
|
||||
let _ = ctx.audio_tx.load().send(AudioCommand::LoadSamples(index));
|
||||
} else {
|
||||
counts.push(0);
|
||||
}
|
||||
}
|
||||
|
||||
ctx.app.audio.config.sample_paths = paths;
|
||||
ctx.app.audio.config.sample_count = total_count;
|
||||
ctx.app.audio.config.sample_counts = counts;
|
||||
|
||||
for path in &ctx.app.audio.config.sample_paths {
|
||||
if let Some(sf2_path) = doux::soundfont::find_sf2_file(path) {
|
||||
|
||||
@@ -245,8 +245,7 @@ pub(super) fn handle_modal_input(ctx: &mut InputContext, key: KeyEvent) -> Input
|
||||
if let Some(sf2_path) = doux::soundfont::find_sf2_file(&path) {
|
||||
let _ = ctx.audio_tx.load().send(crate::engine::AudioCommand::LoadSoundfont(sf2_path));
|
||||
}
|
||||
ctx.app.audio.config.sample_count += count;
|
||||
ctx.app.audio.add_sample_path(path);
|
||||
ctx.app.audio.add_sample_path(path, count);
|
||||
if let Some(registry) = ctx.app.audio.sample_registry.clone() {
|
||||
let sr = ctx.app.audio.config.sample_rate;
|
||||
std::thread::Builder::new()
|
||||
@@ -256,6 +255,7 @@ pub(super) fn handle_modal_input(ctx: &mut InputContext, key: KeyEvent) -> Input
|
||||
})
|
||||
.expect("failed to spawn preload thread");
|
||||
}
|
||||
ctx.app.save_settings(ctx.link);
|
||||
ctx.dispatch(AppCommand::SetStatus(format!("Added {count} samples")));
|
||||
ctx.dispatch(AppCommand::CloseModal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user