Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Nov 19, 2024
1 parent 20c96cc commit 2af2aff
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,24 +445,16 @@ impl Default for Del2 {
fn default() -> Self {
let should_update_filter = Arc::new(AtomicBool::new(false));
let learned_notes = Arc::new(AtomicByteArray::new(NO_LEARNED_NOTE));
let last_learned_notes = Arc::new(AtomicByteArray::new(NO_LEARNED_NOTE));
let enabled_actions = Arc::new(AtomicBoolArray::new());

let filter_params = Arc::new(FilterParams::new());
let delay_taps = array_init(|_| DelayTap::new(filter_params.clone()));
let tap_meters = AtomicF32Array(array_init(|_| {
Arc::new(AtomicF32::new(util::MINUS_INFINITY_DB))
}))
.into();

Self {
params: Arc::new(Del2Params::new(
should_update_filter.clone(),
enabled_actions.clone(),
learned_notes.clone(),
)),

delay_taps,
delay_taps: array_init(|_| DelayTap::new(Arc::new(FilterParams::new()))),
next_internal_id: 0,

delay_buffer: [
Expand All @@ -481,12 +473,15 @@ impl Default for Del2 {
peak_meter_decay_weight: 1.0,
input_meter: Arc::new(AtomicF32::new(util::MINUS_INFINITY_DB)),
output_meter: Arc::new(AtomicF32::new(util::MINUS_INFINITY_DB)),
tap_meters,
tap_meters: AtomicF32Array(array_init(|_| {
Arc::new(AtomicF32::new(util::MINUS_INFINITY_DB))
}))
.into(),
delay_write_index: 0,
is_learning: Arc::new(AtomicBool::new(false)),
learning_index: Arc::new(AtomicUsize::new(0)),
learned_notes,
last_learned_notes,
last_learned_notes: Arc::new(AtomicByteArray::new(NO_LEARNED_NOTE)),
last_played_notes: Arc::new(LastPlayedNotes::new()),
samples_since_last_event: 0,
timing_last_event: 0,
Expand Down

0 comments on commit 2af2aff

Please sign in to comment.