Feat: lots of things, preparing for live gig
Some checks failed
Deploy Website / deploy (push) Failing after 4m50s
Some checks failed
Deploy Website / deploy (push) Failing after 4m50s
This commit is contained in:
@@ -80,7 +80,9 @@ pub enum Op {
|
||||
Mtof,
|
||||
Ftom,
|
||||
SetTempo,
|
||||
Every,
|
||||
Every(Option<SourceSpan>),
|
||||
Bjork(Option<SourceSpan>),
|
||||
PBjork(Option<SourceSpan>),
|
||||
Quotation(Arc<[Op]>, Option<SourceSpan>),
|
||||
When,
|
||||
Unless,
|
||||
|
||||
@@ -838,13 +838,36 @@ impl Forth {
|
||||
stack.push(Value::Int(if result { 1 } else { 0 }, None));
|
||||
}
|
||||
|
||||
Op::Every => {
|
||||
Op::Every(word_span) => {
|
||||
let n = pop_int(stack)?;
|
||||
let quot = pop(stack)?;
|
||||
if n <= 0 {
|
||||
return Err("every count must be > 0".into());
|
||||
}
|
||||
let result = ctx.iter as i64 % n == 0;
|
||||
stack.push(Value::Int(if result { 1 } else { 0 }, None));
|
||||
record_resolved(&trace_cell, *word_span, ResolvedValue::Bool(result));
|
||||
if result {
|
||||
run_quotation(quot, stack, outputs, cmd)?;
|
||||
}
|
||||
}
|
||||
|
||||
Op::Bjork(word_span) | Op::PBjork(word_span) => {
|
||||
let n = pop_int(stack)?;
|
||||
let k = pop_int(stack)?;
|
||||
let quot = pop(stack)?;
|
||||
if n <= 0 || k < 0 {
|
||||
return Err("bjork: n must be > 0, k must be >= 0".into());
|
||||
}
|
||||
let counter = match &ops[pc] {
|
||||
Op::Bjork(_) => ctx.runs,
|
||||
_ => ctx.iter,
|
||||
};
|
||||
let pos = counter % n as usize;
|
||||
let hit = k >= n || euclidean_hit(k as usize, n as usize, pos);
|
||||
record_resolved(&trace_cell, *word_span, ResolvedValue::Bool(hit));
|
||||
if hit {
|
||||
run_quotation(quot, stack, outputs, cmd)?;
|
||||
}
|
||||
}
|
||||
|
||||
Op::Quotation(quote_ops, body_span) => {
|
||||
@@ -1424,6 +1447,13 @@ fn emit_output(
|
||||
outputs.push(out);
|
||||
}
|
||||
|
||||
fn euclidean_hit(k: usize, n: usize, pos: usize) -> bool {
|
||||
if k == 0 {
|
||||
return false;
|
||||
}
|
||||
((pos + 1) * k) / n != (pos * k) / n
|
||||
}
|
||||
|
||||
fn euclidean_rhythm(k: usize, n: usize, rotation: usize) -> Vec<i64> {
|
||||
if k == 0 || n == 0 {
|
||||
return Vec::new();
|
||||
|
||||
@@ -68,7 +68,9 @@ pub(super) fn simple_op(name: &str) -> Option<Op> {
|
||||
"choose" => Op::Choose(None),
|
||||
"bounce" => Op::Bounce(None),
|
||||
"wchoose" => Op::WChoose(None),
|
||||
"every" => Op::Every,
|
||||
"every" => Op::Every(None),
|
||||
"bjork" => Op::Bjork(None),
|
||||
"pbjork" => Op::PBjork(None),
|
||||
"chance" => Op::ChanceExec(None),
|
||||
"prob" => Op::ProbExec(None),
|
||||
"coin" => Op::Coin(None),
|
||||
@@ -192,7 +194,9 @@ fn attach_span(op: &mut Op, span: SourceSpan) {
|
||||
match op {
|
||||
Op::Rand(s) | Op::ExpRand(s) | Op::LogRand(s) | Op::Coin(s)
|
||||
| Op::Choose(s) | Op::WChoose(s) | Op::Cycle(s) | Op::PCycle(s)
|
||||
| Op::Bounce(s) | Op::ChanceExec(s) | Op::ProbExec(s) => *s = Some(span),
|
||||
| Op::Bounce(s) | Op::ChanceExec(s) | Op::ProbExec(s)
|
||||
| Op::Every(s)
|
||||
| Op::Bjork(s) | Op::PBjork(s) => *s = Some(span),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,6 +839,36 @@ pub(super) const WORDS: &[Word] = &[
|
||||
compile: Param,
|
||||
varargs: true,
|
||||
},
|
||||
Word {
|
||||
name: "smear",
|
||||
aliases: &[],
|
||||
category: "Mod FX",
|
||||
stack: "(v.. --)",
|
||||
desc: "Set smear allpass chain wet/dry mix (0=bypass, 1=full wet)",
|
||||
example: "0.5 smear",
|
||||
compile: Param,
|
||||
varargs: true,
|
||||
},
|
||||
Word {
|
||||
name: "smearfreq",
|
||||
aliases: &[],
|
||||
category: "Mod FX",
|
||||
stack: "(v.. --)",
|
||||
desc: "Set smear allpass break frequency in Hz",
|
||||
example: "800 smearfreq",
|
||||
compile: Param,
|
||||
varargs: true,
|
||||
},
|
||||
Word {
|
||||
name: "smearfb",
|
||||
aliases: &[],
|
||||
category: "Mod FX",
|
||||
stack: "(v.. --)",
|
||||
desc: "Set smear feedback for resonance (0-0.95)",
|
||||
example: "0.8 smearfb",
|
||||
compile: Param,
|
||||
varargs: true,
|
||||
},
|
||||
Word {
|
||||
name: "chorus",
|
||||
aliases: &[],
|
||||
|
||||
@@ -198,9 +198,29 @@ pub(super) const WORDS: &[Word] = &[
|
||||
name: "every",
|
||||
aliases: &[],
|
||||
category: "Time",
|
||||
stack: "(n -- bool)",
|
||||
desc: "True every nth iteration",
|
||||
example: "4 every",
|
||||
stack: "(quot n --)",
|
||||
desc: "Execute quotation every nth iteration",
|
||||
example: "{ 2 distort } 4 every",
|
||||
compile: Simple,
|
||||
varargs: false,
|
||||
},
|
||||
Word {
|
||||
name: "bjork",
|
||||
aliases: &[],
|
||||
category: "Time",
|
||||
stack: "(quot k n --)",
|
||||
desc: "Execute quotation using Euclidean distribution over step runs",
|
||||
example: "{ 2 distort } 3 8 bjork",
|
||||
compile: Simple,
|
||||
varargs: false,
|
||||
},
|
||||
Word {
|
||||
name: "pbjork",
|
||||
aliases: &[],
|
||||
category: "Time",
|
||||
stack: "(quot k n --)",
|
||||
desc: "Execute quotation using Euclidean distribution over pattern iterations",
|
||||
example: "{ 2 distort } 3 8 pbjork",
|
||||
compile: Simple,
|
||||
varargs: false,
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ mod project;
|
||||
|
||||
pub const MAX_BANKS: usize = 32;
|
||||
pub const MAX_PATTERNS: usize = 32;
|
||||
pub const MAX_STEPS: usize = 128;
|
||||
pub const MAX_STEPS: usize = 1024;
|
||||
pub const DEFAULT_LENGTH: usize = 16;
|
||||
|
||||
pub use file::{load, save, FileError};
|
||||
|
||||
@@ -220,6 +220,10 @@ impl Step {
|
||||
pub fn is_default(&self) -> bool {
|
||||
self.active && self.script.is_empty() && self.source.is_none() && self.name.is_none()
|
||||
}
|
||||
|
||||
pub fn has_content(&self) -> bool {
|
||||
!self.script.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Step {
|
||||
|
||||
@@ -9,7 +9,7 @@ thread_local! {
|
||||
static PATTERNS: RefCell<Vec<u8>> = const { RefCell::new(Vec::new()) };
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum Orientation {
|
||||
Horizontal,
|
||||
Vertical,
|
||||
|
||||
@@ -63,6 +63,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(200, 235, 235),
|
||||
active_fg: teal,
|
||||
content_bg: Color::Rgb(185, 225, 225),
|
||||
inactive_bg: surface0,
|
||||
inactive_fg: subtext0,
|
||||
active_selected_bg: Color::Rgb(215, 210, 240),
|
||||
|
||||
@@ -63,6 +63,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(40, 55, 55),
|
||||
active_fg: teal,
|
||||
content_bg: Color::Rgb(47, 62, 62),
|
||||
inactive_bg: surface0,
|
||||
inactive_fg: subtext0,
|
||||
active_selected_bg: Color::Rgb(70, 60, 80),
|
||||
|
||||
@@ -57,6 +57,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(50, 70, 70),
|
||||
active_fg: cyan,
|
||||
content_bg: Color::Rgb(57, 77, 77),
|
||||
inactive_bg: current_line,
|
||||
inactive_fg: comment,
|
||||
active_selected_bg: Color::Rgb(80, 70, 95),
|
||||
|
||||
@@ -60,6 +60,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(14, 28, 26),
|
||||
active_fg: cyan,
|
||||
content_bg: Color::Rgb(21, 35, 33),
|
||||
inactive_bg: surface,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(22, 36, 28),
|
||||
|
||||
@@ -58,6 +58,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(20, 30, 30),
|
||||
active_fg: cyan,
|
||||
content_bg: Color::Rgb(27, 37, 37),
|
||||
inactive_bg: surface,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(40, 30, 35),
|
||||
|
||||
@@ -58,6 +58,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(70, 100, 100),
|
||||
active_fg: mint,
|
||||
content_bg: Color::Rgb(77, 107, 107),
|
||||
inactive_bg: bg_light,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(120, 90, 130),
|
||||
|
||||
@@ -62,6 +62,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(0, 16, 32),
|
||||
active_fg: lightblue,
|
||||
content_bg: Color::Rgb(7, 23, 39),
|
||||
inactive_bg: surface,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(10, 20, 36),
|
||||
|
||||
@@ -59,6 +59,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(50, 65, 55),
|
||||
active_fg: aqua,
|
||||
content_bg: Color::Rgb(57, 72, 62),
|
||||
inactive_bg: bg1,
|
||||
inactive_fg: fg3,
|
||||
active_selected_bg: Color::Rgb(85, 70, 60),
|
||||
|
||||
@@ -54,6 +54,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: black,
|
||||
active_bg: Color::Rgb(200, 50, 50),
|
||||
active_fg: yellow,
|
||||
content_bg: Color::Rgb(210, 60, 60),
|
||||
inactive_bg: dark_red,
|
||||
inactive_fg: gold,
|
||||
active_selected_bg: Color::Rgb(200, 200, 0),
|
||||
|
||||
@@ -59,6 +59,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: fg_dim,
|
||||
active_bg: Color::Rgb(45, 55, 70),
|
||||
active_fg: crystal_blue,
|
||||
content_bg: Color::Rgb(52, 62, 77),
|
||||
inactive_bg: bg_light,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(65, 55, 70),
|
||||
|
||||
@@ -59,6 +59,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: Color::Rgb(180, 140, 20),
|
||||
active_bg: Color::Rgb(210, 235, 240),
|
||||
active_fg: function,
|
||||
content_bg: Color::Rgb(195, 225, 230),
|
||||
inactive_bg: surface,
|
||||
inactive_fg: text_dim,
|
||||
active_selected_bg: Color::Rgb(210, 215, 245),
|
||||
|
||||
@@ -139,6 +139,7 @@ pub struct TileColors {
|
||||
pub playing_inactive_fg: Color,
|
||||
pub active_bg: Color,
|
||||
pub active_fg: Color,
|
||||
pub content_bg: Color,
|
||||
pub inactive_bg: Color,
|
||||
pub inactive_fg: Color,
|
||||
pub active_selected_bg: Color,
|
||||
|
||||
@@ -56,6 +56,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: medium,
|
||||
active_bg: Color::Rgb(45, 45, 45),
|
||||
active_fg: bright,
|
||||
content_bg: Color::Rgb(55, 55, 55),
|
||||
inactive_bg: surface,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(80, 80, 80),
|
||||
|
||||
@@ -56,6 +56,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: medium,
|
||||
active_bg: Color::Rgb(210, 210, 210),
|
||||
active_fg: dark,
|
||||
content_bg: Color::Rgb(195, 195, 195),
|
||||
inactive_bg: surface,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(170, 170, 170),
|
||||
|
||||
@@ -57,6 +57,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(55, 75, 70),
|
||||
active_fg: blue,
|
||||
content_bg: Color::Rgb(62, 82, 77),
|
||||
inactive_bg: bg_light,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(85, 65, 80),
|
||||
|
||||
@@ -57,6 +57,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: aurora_yellow,
|
||||
active_bg: Color::Rgb(50, 65, 65),
|
||||
active_fg: frost0,
|
||||
content_bg: Color::Rgb(57, 72, 72),
|
||||
inactive_bg: polar_night1,
|
||||
inactive_fg: snow_storm0,
|
||||
active_selected_bg: Color::Rgb(75, 75, 95),
|
||||
|
||||
@@ -58,6 +58,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(15, 40, 40),
|
||||
active_fg: cyan,
|
||||
content_bg: Color::Rgb(22, 47, 47),
|
||||
inactive_bg: surface,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(45, 40, 55),
|
||||
|
||||
@@ -58,6 +58,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: subtle,
|
||||
active_bg: Color::Rgb(35, 50, 60),
|
||||
active_fg: foam,
|
||||
content_bg: Color::Rgb(42, 57, 67),
|
||||
inactive_bg: bg_light,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(60, 50, 70),
|
||||
|
||||
@@ -58,6 +58,7 @@ pub fn theme() -> ThemeColors {
|
||||
playing_inactive_fg: yellow,
|
||||
active_bg: Color::Rgb(45, 60, 75),
|
||||
active_fg: blue,
|
||||
content_bg: Color::Rgb(52, 67, 82),
|
||||
inactive_bg: bg_light,
|
||||
inactive_fg: fg_dim,
|
||||
active_selected_bg: Color::Rgb(70, 55, 85),
|
||||
|
||||
@@ -123,6 +123,7 @@ pub fn rotate_theme(theme: ThemeColors, degrees: f32) -> ThemeColors {
|
||||
playing_inactive_fg: rotate_color(theme.tile.playing_inactive_fg, degrees),
|
||||
active_bg: rotate_color(theme.tile.active_bg, degrees),
|
||||
active_fg: rotate_color(theme.tile.active_fg, degrees),
|
||||
content_bg: rotate_color(theme.tile.content_bg, degrees),
|
||||
inactive_bg: rotate_color(theme.tile.inactive_bg, degrees),
|
||||
inactive_fg: rotate_color(theme.tile.inactive_fg, degrees),
|
||||
active_selected_bg: rotate_color(theme.tile.active_selected_bg, degrees),
|
||||
|
||||
Reference in New Issue
Block a user