use super::module::LayerModules;
pub(crate) const MASTER_BPM_MIN: f32 = 30.0;
pub(crate) const MASTER_BPM_MAX: f32 = 200.0;
pub(crate) const LEVEL_RAMP_MS: f32 = 30.0;
#[derive(Clone)]
pub(crate) struct MasterControls {
pub(crate) bpm: f32,
pub(crate) level: f32,
pub(crate) tone: f32, pub(crate) tune: f32, }
impl Default for MasterControls {
fn default() -> Self {
Self {
bpm: 82.0,
level: 0.8,
tone: 0.0,
tune: 0.0,
}
}
}
#[derive(Clone)]
pub(crate) struct PercControls {
pub(crate) level: f32,
pub(crate) decay_ms: f32,
pub(crate) interval_beats: f32,
pub(crate) offset_beats: f32,
pub(crate) swing: f32, }
impl Default for PercControls {
fn default() -> Self {
Self {
level: 0.0,
decay_ms: 200.0,
interval_beats: 0.25,
offset_beats: 0.0,
swing: 0.0,
}
}
}
#[derive(Clone, Default)]
pub(crate) struct ChordSlotControls {
pub(crate) degree: f32,
pub(crate) accidental: f32,
pub(crate) quality: f32,
pub(crate) extension: f32,
pub(crate) inversion: f32,
}
pub(crate) const DEFAULT_CHORD_SLOT_DEGREES: [f32; 8] = [0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 2.0, 4.0];
pub(crate) const CHORD_SLOT_COUNT: usize = 8;
#[derive(Clone)]
pub(crate) struct PadControls {
pub(crate) level: f32,
pub(crate) voice_type: f32, pub(crate) chord_bars: f32, pub(crate) chord_count: f32,
pub(crate) progression: f32,
pub(crate) chord_slots: [ChordSlotControls; CHORD_SLOT_COUNT],
pub(crate) stereo_width: f32,
pub(crate) detune: f32,
pub(crate) octave_mix: f32,
pub(crate) attack_time: f32,
pub(crate) release_time: f32,
}
impl Default for PadControls {
fn default() -> Self {
Self {
level: 0.7,
voice_type: 0.0,
chord_bars: 4.0,
chord_count: 8.0,
progression: 0.0,
chord_slots: std::array::from_fn(|slot| ChordSlotControls {
degree: DEFAULT_CHORD_SLOT_DEGREES[slot],
..ChordSlotControls::default()
}),
stereo_width: 0.8,
detune: 0.5,
octave_mix: 0.5,
attack_time: 6.0,
release_time: 8.0,
}
}
}
#[derive(Clone)]
pub(crate) struct KickControls {
pub(crate) level: f32,
pub(crate) voice_type: f32, pub(crate) start_freq: f32,
pub(crate) pitch_decay_ms: f32,
pub(crate) amp_decay_ms: f32,
pub(crate) click: f32, pub(crate) interval_beats: f32,
pub(crate) offset_beats: f32,
pub(crate) swing: f32, }
impl Default for KickControls {
fn default() -> Self {
Self {
level: 0.0,
voice_type: 0.0,
start_freq: 160.0,
pitch_decay_ms: 55.0,
amp_decay_ms: 150.0,
click: 0.02,
interval_beats: 1.0,
offset_beats: 0.0,
swing: 0.0,
}
}
}
#[derive(Clone)]
pub(crate) struct TonalControls {
pub(crate) level: f32,
pub(crate) synth_type: f32,
pub(crate) octave: f32,
pub(crate) phrase: f32,
pub(crate) randomness: f32,
pub(crate) evolve_rate: f32,
pub(crate) rate_beats: f32,
pub(crate) step_interval_beats: f32,
pub(crate) offset_beats: f32,
pub(crate) attack: f32,
pub(crate) decay: f32,
pub(crate) swing: f32, }
impl Default for TonalControls {
fn default() -> Self {
Self {
level: 0.0,
synth_type: 0.0,
octave: 0.0,
phrase: 0.0,
randomness: 0.5,
evolve_rate: 0.0,
rate_beats: 0.5,
step_interval_beats: 16.0,
offset_beats: 0.0,
attack: 0.03,
decay: 1.2,
swing: 0.0,
}
}
}
#[derive(Clone)]
pub(crate) struct ClapControls {
pub(crate) level: f32,
pub(crate) interval_beats: f32,
pub(crate) offset_beats: f32,
pub(crate) swing: f32, pub(crate) slap_count: f32, pub(crate) slap_spread_ms: f32, pub(crate) decay_ms: f32, pub(crate) filter: f32, pub(crate) body: f32, }
impl Default for ClapControls {
fn default() -> Self {
Self {
level: 0.0,
interval_beats: 2.0,
offset_beats: 1.0,
swing: 0.0,
slap_count: 3.0,
slap_spread_ms: 8.0,
decay_ms: 40.0,
filter: 0.7,
body: 0.2,
}
}
}
#[derive(Clone)]
pub(crate) struct BassControls {
pub(crate) level: f32,
pub(crate) voice_type: f32, pub(crate) interval_beats: f32, pub(crate) offset_beats: f32,
pub(crate) rhythm: f32, pub(crate) octave: f32, pub(crate) attack_time: f32,
pub(crate) decay_time: f32, pub(crate) swing: f32, }
impl Default for BassControls {
fn default() -> Self {
Self {
level: 0.0,
voice_type: 0.0,
interval_beats: 4.0,
offset_beats: 0.0,
rhythm: 0.0,
octave: -1.0,
decay_time: 0.3,
attack_time: 0.01,
swing: 0.0,
}
}
}
#[derive(Clone)]
pub(crate) struct ArpControls {
pub(crate) gain: f32,
pub(crate) voice_type: f32, pub(crate) rate_beats: f32,
pub(crate) offset_beats: f32,
pub(crate) pattern: f32, pub(crate) octaves: f32, pub(crate) attack: f32,
pub(crate) decay: f32,
pub(crate) swing: f32, }
impl Default for ArpControls {
fn default() -> Self {
Self {
gain: 0.0,
voice_type: 6.0,
rate_beats: 0.5,
offset_beats: 0.0,
pattern: 0.0,
octaves: 1.0,
attack: 0.005,
decay: 0.4,
swing: 0.0,
}
}
}
pub(crate) const LEAD_STEP_COUNT: usize = 16;
pub(crate) const DEFAULT_LEAD_STEPS: [f32; LEAD_STEP_COUNT] = [
1.0, 2.0, 3.0, 5.0, 4.0, 3.0, 2.0, 0.0, 1.0, 3.0, 5.0, 6.0, 5.0, 3.0, 2.0, 0.0,
];
#[derive(Clone)]
pub(crate) struct LeadControls {
pub(crate) level: f32,
pub(crate) attack: f32,
pub(crate) decay: f32,
pub(crate) glide: f32, pub(crate) voice_type: f32, pub(crate) octave: f32, pub(crate) rate_beats: f32,
pub(crate) offset_beats: f32,
pub(crate) step_count: f32, pub(crate) steps: [f32; LEAD_STEP_COUNT],
pub(crate) swing: f32, }
impl Default for LeadControls {
fn default() -> Self {
Self {
level: 0.0,
attack: 0.02,
decay: 0.5,
glide: 0.08,
voice_type: 0.0,
octave: 0.0,
rate_beats: 0.5,
offset_beats: 0.0,
step_count: 8.0,
steps: DEFAULT_LEAD_STEPS,
swing: 0.0,
}
}
}
#[derive(Clone, Default)]
pub(crate) struct FluidControls {
pub(crate) master: MasterControls,
pub(crate) perc: PercControls,
pub(crate) pad: PadControls,
pub(crate) kick: KickControls,
pub(crate) tonal: TonalControls,
pub(crate) clap: ClapControls,
pub(crate) bass: BassControls,
pub(crate) arp: ArpControls,
pub(crate) lead: LeadControls,
pub(crate) modules: LayerModules,
}