diff --git a/src/components/root_note_form.rs b/src/components/root_note_form.rs index 0ec26dc..6931b7a 100644 --- a/src/components/root_note_form.rs +++ b/src/components/root_note_form.rs @@ -20,6 +20,8 @@ pub struct RootNoteFormProps { pub enum RootNoteFormMessages { RootNoteChanged(usize, MidiNote), + IncreaseOctave, + DecreaseOctave, Done, Reset, Cancel, @@ -57,6 +59,18 @@ impl Component for RootNotesForm { self.sample_files[index].root = note.into_byte(); true } + RootNoteFormMessages::IncreaseOctave => { + self.sample_files.iter_mut().for_each(|s| { + s.root = (s.root + 12).clamp(0, 127); + }); + true + } + RootNoteFormMessages::DecreaseOctave => { + self.sample_files.iter_mut().for_each(|s| { + s.root = (s.root - 12).clamp(0, 127); + }); + true + } RootNoteFormMessages::Done => { ctx.props().on_done.emit(self.sample_files.clone()); false @@ -115,15 +129,29 @@ impl Component for RootNotesForm { {samples} -