Skip to content

Commit

Permalink
reset taps -> clear taps
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Nov 1, 2024
1 parent 652ae22 commit 25ee22b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use nih_plug_vizia::{

use crate::{
util, AtomicBoolArray, AtomicByteArray, Del2Params, LastPlayedNotes, SharedDelayData,
SharedDelayDataOutput, LEARNING, LOCK_TAPS, MUTE_IN, MUTE_OUT, NO_LEARNED_NOTE, RESET_TAPS,
SharedDelayDataOutput, CLEAR_TAPS, LEARNING, LOCK_TAPS, MUTE_IN, MUTE_OUT, NO_LEARNED_NOTE,
};

#[derive(Lens, Clone)]
Expand Down Expand Up @@ -168,7 +168,7 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
.class("column");
HStack::new(cx, |cx| {
HStack::new(cx, |cx| {
Label::new(cx, "reset taps").class("action-name");
Label::new(cx, "clear taps").class("action-name");
ActionTrigger::new(
cx,
Data::params,
Expand All @@ -177,7 +177,7 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
Data::learned_notes,
Data::last_played_notes,
Data::enabled_actions,
RESET_TAPS,
CLEAR_TAPS,
);
})
.class("row");
Expand Down Expand Up @@ -770,7 +770,7 @@ impl ActionTrigger {
self.params.global.mute_is_toggle.value(),
self.is_enabled(),
self.is_playing(),
self.own_index == RESET_TAPS,
self.own_index == CLEAR_TAPS,
) {
(true, _, _, _, _) => vg::Paint::color(border_color),
(_, _, _, true, true) => vg::Paint::color(outline_color),
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const LEARNING: u8 = 129;
// should be 0..7 because of AtomicByteArray size
const MUTE_IN: usize = 0;
const MUTE_OUT: usize = 1;
const RESET_TAPS: usize = 2;
const CLEAR_TAPS: usize = 2;
const LOCK_TAPS: usize = 3;
const MAX_HAAS_MS: f32 = 5.0;

Expand Down Expand Up @@ -1038,7 +1038,7 @@ impl Del2 {
CountingState::TimeOut => {
if is_delay_note && !is_learning && taps_unlocked {
// If in TimeOut state, reset and start new counting phase
self.reset_taps(timing, true);
self.clear_taps(timing, true);
}
}
CountingState::CountingInBuffer => {
Expand Down Expand Up @@ -1124,9 +1124,9 @@ impl Del2 {
}
// self.last_played_notes.note_off(note);
}
if self.is_playing_action(RESET_TAPS) {
self.reset_taps(timing, false);
// self.last_played_notes.note_off(self.learned_notes.load(RESET_TAPS))
if self.is_playing_action(CLEAR_TAPS) {
self.clear_taps(timing, false);
// self.last_played_notes.note_off(self.learned_notes.load(CLEAR_TAPS))
}
}
}
Expand All @@ -1144,7 +1144,7 @@ impl Del2 {
self.last_played_notes.note_off(note);
}

fn reset_taps(&mut self, timing: u32, restart: bool) {
fn clear_taps(&mut self, timing: u32, restart: bool) {
self.enabled_actions.store(LOCK_TAPS, false);
self.delay_data.current_tap = 0;
self.start_release_for_all_delay_taps(self.sample_rate);
Expand Down

0 comments on commit 25ee22b

Please sign in to comment.