Feat: tweak and fix from last night workshop
Some checks failed
Deploy Website / deploy (push) Failing after 4m46s
Some checks failed
Deploy Website / deploy (push) Failing after 4m46s
This commit is contained in:
@@ -41,7 +41,7 @@ pub use options::{OptionsFocus, OptionsState};
|
||||
pub use panel::{PanelFocus, PanelState, SidePanel};
|
||||
pub use patterns_nav::{PatternsColumn, PatternsNav};
|
||||
pub use mute::MuteState;
|
||||
pub use playback::{PlaybackState, StagedChange, StagedMuteChange};
|
||||
pub use playback::{PlaybackState, StagedChange, StagedMuteChange, StagedPropChange};
|
||||
pub use project::ProjectState;
|
||||
pub use sample_browser::SampleBrowserState;
|
||||
pub use ui::{DictFocus, FlashKind, HelpFocus, UiState};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::engine::PatternChange;
|
||||
use crate::model::{LaunchQuantization, SyncMode};
|
||||
use std::collections::HashSet;
|
||||
use crate::model::{LaunchQuantization, PatternSpeed, SyncMode};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StagedChange {
|
||||
@@ -15,11 +15,20 @@ pub enum StagedMuteChange {
|
||||
ToggleSolo { bank: usize, pattern: usize },
|
||||
}
|
||||
|
||||
pub struct StagedPropChange {
|
||||
pub name: Option<String>,
|
||||
pub length: Option<usize>,
|
||||
pub speed: PatternSpeed,
|
||||
pub quantization: LaunchQuantization,
|
||||
pub sync_mode: SyncMode,
|
||||
}
|
||||
|
||||
pub struct PlaybackState {
|
||||
pub playing: bool,
|
||||
pub staged_changes: Vec<StagedChange>,
|
||||
pub queued_changes: Vec<StagedChange>,
|
||||
pub staged_mute_changes: HashSet<StagedMuteChange>,
|
||||
pub staged_prop_changes: HashMap<(usize, usize), StagedPropChange>,
|
||||
}
|
||||
|
||||
impl Default for PlaybackState {
|
||||
@@ -29,6 +38,7 @@ impl Default for PlaybackState {
|
||||
staged_changes: Vec::new(),
|
||||
queued_changes: Vec::new(),
|
||||
staged_mute_changes: HashSet::new(),
|
||||
staged_prop_changes: HashMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +51,11 @@ impl PlaybackState {
|
||||
pub fn clear_queues(&mut self) {
|
||||
self.staged_changes.clear();
|
||||
self.queued_changes.clear();
|
||||
self.staged_prop_changes.clear();
|
||||
}
|
||||
|
||||
pub fn has_staged_props(&self, bank: usize, pattern: usize) -> bool {
|
||||
self.staged_prop_changes.contains_key(&(bank, pattern))
|
||||
}
|
||||
|
||||
pub fn stage_mute(&mut self, bank: usize, pattern: usize) {
|
||||
|
||||
Reference in New Issue
Block a user