Skip to content

Commit d124b69

Browse files
Copilotdanvincent
andauthored
feat: add Bytebeat Speed and Glide options to Bytebeat submenu (#36)
* feat: add Bytebeat Speed and Glide menu options with auto-wander engine - Engine: add drone_countdown per BytebeatOscillator, drone_glide_enabled and drone_speed (1-8) to BytebeatState; add set_bytebeat_drone_speed / set_bytebeat_drone_glide methods; auto-wander logic in render loop picks scale-aware target Hz and glides over the full period using existing hz_ramp_rate machinery. Disabling snaps all oscillators back to base_frequency_hz immediately. 4 new engine tests. - AudioCommand: add SetBytebeatDroneSpeed(u8) and SetBytebeatDroneGlide(bool) variants with dispatch in run_audio_loop. - Menu: add bb_speed (u8, 1-8) and bb_glide (bool) fields to MenuState; expand Bytebeat submenu from 5 to 7 items (Speed: Nx, Glide: On/Off); update increment/decrement/lines; fix item-count test; add 5 new menu tests. - App: track old_bb_speed / old_bb_glide and dispatch both AudioCommands on change. Agent-Logs-Url: https://github.com/danvincent/pirate-synth/sessions/e19adde1-0bde-431d-b4dd-235a5f277bb6 Co-authored-by: danvincent <2820964+danvincent@users.noreply.github.com> * feat: add Glacial Bytebeat S&H FM mode Agent-Logs-Url: https://github.com/danvincent/pirate-synth/sessions/b40701ba-eb12-42ec-b42c-c0966708e4f7 Co-authored-by: danvincent <2820964+danvincent@users.noreply.github.com> * refactor: extract BB_GLACIAL_T_PERIOD_SECS constant and clarify bb_speed comment Agent-Logs-Url: https://github.com/danvincent/pirate-synth/sessions/b40701ba-eb12-42ec-b42c-c0966708e4f7 Co-authored-by: danvincent <2820964+danvincent@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: danvincent <2820964+danvincent@users.noreply.github.com>
1 parent 84567a7 commit d124b69

4 files changed

Lines changed: 453 additions & 23 deletions

File tree

crates/app/src/main.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,9 @@ fn main() -> Result<()> {
12751275
let old_bb_active = menu.bb_active;
12761276
let old_bb_volume = menu.bb_volume;
12771277
let old_bb_osc_count = menu.bb_osc_count;
1278+
let old_bb_speed = menu.bb_speed;
1279+
let old_bb_glide = menu.bb_glide;
1280+
let old_bb_glacial_fm = menu.bb_glacial_fm;
12781281

12791282
menu.apply_button(button);
12801283
display.draw_menu(&menu)?;
@@ -1390,6 +1393,27 @@ fn main() -> Result<()> {
13901393
warn!("failed to send bytebeat oscillator count: {err}");
13911394
}
13921395
}
1396+
if menu.bb_speed != old_bb_speed {
1397+
if let Err(err) =
1398+
audio_tx.try_send(AudioCommand::SetBytebeatDroneSpeed(menu.bb_speed))
1399+
{
1400+
warn!("failed to send bytebeat drone speed: {err}");
1401+
}
1402+
}
1403+
if menu.bb_glide != old_bb_glide {
1404+
if let Err(err) =
1405+
audio_tx.try_send(AudioCommand::SetBytebeatDroneGlide(menu.bb_glide))
1406+
{
1407+
warn!("failed to send bytebeat drone glide: {err}");
1408+
}
1409+
}
1410+
if menu.bb_glacial_fm != old_bb_glacial_fm {
1411+
if let Err(err) =
1412+
audio_tx.try_send(AudioCommand::SetBytebeatGlacialFm(menu.bb_glacial_fm))
1413+
{
1414+
warn!("failed to send bytebeat glacial FM: {err}");
1415+
}
1416+
}
13931417
}
13941418

13951419
synth.poll();

crates/audio_alsa/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ pub enum AudioCommand {
6565
SetBytebeatActive(bool),
6666
SetBytebeatOscillatorCount(usize),
6767
SetBytebeatRandomAlgo { enabled: bool, period_samples: u64 },
68+
SetBytebeatDroneSpeed(u8),
69+
SetBytebeatDroneGlide(bool),
70+
SetBytebeatGlacialFm(bool),
6871
Stop,
6972
}
7073

@@ -141,6 +144,9 @@ fn run_audio_loop(
141144
AudioCommand::SetBytebeatRandomAlgo { enabled, period_samples } => {
142145
engine.set_bytebeat_random_algo(enabled, period_samples)
143146
}
147+
AudioCommand::SetBytebeatDroneSpeed(speed) => engine.set_bytebeat_drone_speed(speed),
148+
AudioCommand::SetBytebeatDroneGlide(enabled) => engine.set_bytebeat_drone_glide(enabled),
149+
AudioCommand::SetBytebeatGlacialFm(enabled) => engine.set_bytebeat_glacial_fm(enabled),
144150
AudioCommand::Stop => {
145151
drop(stdin);
146152
let _ = child.wait();

0 commit comments

Comments
 (0)