fix sequence frequency stuff to allow for rest notes

This commit is contained in:
sigil-03 2025-11-06 11:54:17 -07:00
parent a1767420f2
commit 88d07fa69d
2 changed files with 8 additions and 9 deletions

View file

@ -152,7 +152,7 @@ pub mod sequencer {
} }
pub fn need_service(&self) -> bool { pub fn need_service(&self) -> bool {
self.ticks_remaining == 0 self.enabled && self.ticks_remaining == 0
} }
pub fn service(&mut self) -> Option<u16> { pub fn service(&mut self) -> Option<u16> {
@ -348,6 +348,8 @@ impl App {
self.services.synth0.set_freq(1); self.services.synth0.set_freq(1);
self.services.synth0.disable(); self.services.synth0.disable();
self.services.sequencer.disable();
} }
pub fn set_state(&mut self, state: State) { pub fn set_state(&mut self, state: State) {
@ -446,6 +448,7 @@ impl App {
if out == 0 { if out == 0 {
self.services.synth0.disable(); self.services.synth0.disable();
} else { } else {
self.services.synth0.enable();
self.services.synth0.set_freq(out.into()); self.services.synth0.set_freq(out.into());
} }
} else { } else {

View file

@ -179,7 +179,7 @@ pub static SOUND_8_BIT_GAME: [SequenceEntry; 3] = [
// PLAY TWICE // PLAY TWICE
// TODO: this isn't working quite right with the 0hz "non note" for a rest... // TODO: this isn't working quite right with the 0hz "non note" for a rest...
pub static SOUND_8_BIT_GAME_1: [SequenceEntry; 4] = [ pub static SOUND_8_BIT_GAME_1: [SequenceEntry; 3] = [
SequenceEntry { SequenceEntry {
frequency_hz: 440, frequency_hz: 440,
duration_ms: 50, duration_ms: 50,
@ -190,11 +190,7 @@ pub static SOUND_8_BIT_GAME_1: [SequenceEntry; 4] = [
}, },
SequenceEntry { SequenceEntry {
frequency_hz: 0, frequency_hz: 0,
duration_ms: 1000, duration_ms: 100,
},
SequenceEntry {
frequency_hz: 880,
duration_ms: 50,
}, },
]; ];
@ -335,10 +331,10 @@ pub static ASCENDING_TONES: [SequenceEntry; 29] = [
]; ];
pub static SEQUENCE_LIST: [(&'static [SequenceEntry], usize); 7] = [ pub static SEQUENCE_LIST: [(&'static [SequenceEntry], usize); 7] = [
(&ASCENDING_TONES, 0),
(&SOUND_8_BIT_GAME_3, 2),
// TODO: this one is broken: // TODO: this one is broken:
(&SOUND_8_BIT_GAME_1, 1), (&SOUND_8_BIT_GAME_1, 1),
(&ASCENDING_TONES, 0),
(&SOUND_8_BIT_GAME_3, 2),
(&SOUND_8_BIT_GAME, 1), (&SOUND_8_BIT_GAME, 1),
(&COIN_CHIRP, 0), (&COIN_CHIRP, 0),
(&WAHWAH, 5), (&WAHWAH, 5),