diff --git a/canvas/src/blocks/clock.tsx b/canvas/src/blocks/clock.tsx index 0431ab3c..37ea0b3c 100644 --- a/canvas/src/blocks/clock.tsx +++ b/canvas/src/blocks/clock.tsx @@ -37,9 +37,7 @@ export const ClockBlock = memo((props: ClockProps) => { setCycleError(!valid) if (valid) { - updateNodeData(id, { freq }) - engine.send(id, { type: "SetClockFreq", freq }) - engine.ctx?.force_tick_block(id) + engine.updateBlockData(id, "Clock", { freq }) } }} {...(cycleError && { color: "tomato" })} @@ -55,9 +53,7 @@ export const ClockBlock = memo((props: ClockProps) => { onCheckedChange={(ping) => { if (ping === "indeterminate") return - updateNodeData(id, { ping }) - engine.send(id, { type: "SetClockPing", ping }) - engine.ctx?.force_tick_block(id) + engine.updateBlockData(id, "Clock", { ping }) }} /> diff --git a/machine/src/blocks/clock.rs b/machine/src/blocks/clock.rs index 8f7aa9a8..979938ec 100644 --- a/machine/src/blocks/clock.rs +++ b/machine/src/blocks/clock.rs @@ -17,14 +17,6 @@ impl Canvas { for message in &messages { match &message.action { - Action::SetClockFreq { freq: f, } => { - *freq = *f; - } - - Action::SetClockPing { ping: p, } => { - *ping = *p; - } - Action::Reset => { *time = 0; } diff --git a/machine/src/blocks/memory.rs b/machine/src/blocks/memory.rs index 44127254..77279f88 100644 --- a/machine/src/blocks/memory.rs +++ b/machine/src/blocks/memory.rs @@ -51,12 +51,6 @@ impl Canvas { }; } - Action::SetAutoReset { auto_reset: value } => { - let Memory { auto_reset, .. } = &mut self.mut_block(id)?.data else { continue; }; - - *auto_reset = value; - } - _ => {} } } diff --git a/machine/src/blocks/midi_in.rs b/machine/src/blocks/midi_in.rs index c2e82edb..617589c0 100644 --- a/machine/src/blocks/midi_in.rs +++ b/machine/src/blocks/midi_in.rs @@ -18,24 +18,6 @@ impl Canvas { self.send_data_to_sinks(id, vec![note as u16, value as u16])?; } - Action::SetMidiPort { port: p } => { - if let MidiIn { port, .. } = &mut self.mut_block(id)?.data { - *port = p; - } - } - - Action::SetMidiInputEvent { event } => { - if let MidiIn { on, .. } = &mut self.mut_block(id)?.data { - *on = event; - } - } - - Action::SetMidiChannels { channels: chan } => { - if let MidiIn { channels, .. } = &mut self.mut_block(id)?.data { - *channels = chan; - } - } - _ => {} } } diff --git a/machine/src/blocks/midi_out.rs b/machine/src/blocks/midi_out.rs index b6c41934..b5978440 100644 --- a/machine/src/blocks/midi_out.rs +++ b/machine/src/blocks/midi_out.rs @@ -38,20 +38,6 @@ impl Canvas { }) } - Action::SetMidiOutputFormat { format: fmt } => { - *format = fmt; - } - - Action::SetMidiPort { port: p } => { - *port = p; - } - - Action::SetMidiChannels { channels } => { - if let Some(chan) = channels.first() { - *channel = *chan; - } - } - Action::Write { address, data } => { // MIDI channels and ports cannot be over 255. if *channel > 255 || *port > 255 { continue; } diff --git a/machine/src/blocks/osc.rs b/machine/src/blocks/osc.rs index 40364746..fa05b3d9 100644 --- a/machine/src/blocks/osc.rs +++ b/machine/src/blocks/osc.rs @@ -8,11 +8,6 @@ impl Canvas { pub fn tick_osc_block(&mut self, id: u16, messages: Vec) -> Errorable { for message in &messages { match &message.action { - Action::SetWaveform { waveform: wf } => { - if let Osc { waveform } = &mut self.mut_block(id)?.data { - *waveform = *wf; - }; - } Action::Data { body } => { let mut waveform = Waveform::Sine; diff --git a/machine/src/blocks/pixel.rs b/machine/src/blocks/pixel.rs index 5666bbc0..91598c9e 100644 --- a/machine/src/blocks/pixel.rs +++ b/machine/src/blocks/pixel.rs @@ -77,12 +77,6 @@ impl Canvas { }; } - Action::SetPixelMode { mode: m } => { - if let Pixel { mode, .. } = &mut self.mut_block(id)?.data { - *mode = m; - }; - } - Action::Reset => { if let Pixel { pixels, .. } = &mut self.mut_block(id)?.data { pixels.clear() diff --git a/machine/src/canvas/message.rs b/machine/src/canvas/message.rs index ca15006a..e0a1174f 100644 --- a/machine/src/canvas/message.rs +++ b/machine/src/canvas/message.rs @@ -1,8 +1,6 @@ use serde::{Deserialize, Serialize}; use tsify::Tsify; -use crate::audio::midi::{MidiInputEvent, MidiOutputFormat}; -use crate::audio::waveform::Waveform; -use crate::blocks::pixel::PixelMode; +use crate::audio::midi::{MidiInputEvent}; use crate::canvas::wire::Port; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Tsify)] @@ -44,31 +42,4 @@ pub enum Action { /// Notify the block that a MIDI message has been received. Midi { event: MidiInputEvent, note: u8, value: u8, channel: u8, port: u8 }, - - /// Set the MIDI port - SetMidiPort { port: u16 }, - - /// Set the MIDI channels. - SetMidiChannels { channels: Vec }, - - /// Select the MIDI input event for the block to subscribe to. - SetMidiInputEvent { event: MidiInputEvent }, - - /// Set the MIDI output format. - SetMidiOutputFormat { format: MidiOutputFormat }, - - /// Set the waveform of the oscillator. - SetWaveform { waveform: Waveform }, - - /// Set the pixel mode of the pixel block. - SetPixelMode { mode: PixelMode }, - - /// Should the block reset via the reset command? - SetAutoReset { auto_reset: bool }, - - /// Set the clock's frequency - SetClockFreq { freq: u16 }, - - /// Set whether we should send a ping instead of the time. - SetClockPing { ping: bool }, }