Skip to content

Commit

Permalink
adapt gui to extra params
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Oct 24, 2024
1 parent 245ec13 commit 41051b6
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 32 deletions.
50 changes: 31 additions & 19 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Model for Data {}

// Makes sense to also define this here, makes it a bit easier to keep track of
pub fn default_state() -> Arc<ViziaState> {
ViziaState::new(|| (1200, 800))
ViziaState::new(|| (1168, 584))
}

pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dyn Editor>> {
Expand All @@ -51,7 +51,8 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
VStack::new(cx, |cx| {
Label::new(cx, "global").class("global-title");
HStack::new(cx, |cx| {
make_column(cx, "gain", |cx| {
HStack::new(cx, |cx| {
// make_column(cx, "gain", |cx| {
let gain_params = Data::params.map(|p| p.global.gain_params.clone());
GenericUi::new_custom(cx, gain_params, |cx, param_ptr| {
HStack::new(cx, |cx| {
Expand All @@ -60,9 +61,11 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
})
.class("row");
});
});
})
.class("column");

make_column(cx, "timing", |cx| {
// make_column(cx, "timing", |cx| {
HStack::new(cx, |cx| {
let timing_params = Data::params.map(|p| p.global.timing_params.clone());
GenericUi::new_custom(cx, timing_params, |cx, param_ptr| {
let param_name = unsafe { param_ptr.name() };
Expand All @@ -87,8 +90,11 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
.class("row");
}
});
});
});
})
.class("column");
// });
})
.class("param-group");

HStack::new(cx, |cx| {
HStack::new(cx, |cx| {
Expand Down Expand Up @@ -148,7 +154,7 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
.class("column");
})
// TODO: rename
.class("attack-release");
.class("action-trigger-group");

HStack::new(cx, |cx| {
HStack::new(cx, |cx| {
Expand Down Expand Up @@ -185,32 +191,38 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
.class("column");
})
// TODO: rename
.class("attack-release");
.class("action-trigger-group");

Label::new(cx, "filters").class("dsp-title");

HStack::new(cx, |cx| {
make_column(cx, "velocity tracking", |cx| {
// make_column(cx, "velocity tracking", |cx| {
HStack::new(cx, |cx| {
HStack::new(cx, |cx| {
Label::new(cx, "cutoff").class("slider-label");
Label::new(cx, "vel->cut").class("slider-label");
ParamSlider::new(cx, Data::params, |params| {
&params.taps.velocity_to_cutoff_amount
})
.class("offset-widget");
.class("widget");
})
.class("row");
});
make_column(cx, "note tracking", |cx| {
})
.class("column");
// make_column(cx, "note tracking", |cx| {
HStack::new(cx, |cx| {
HStack::new(cx, |cx| {
Label::new(cx, "cutoff").class("slider-label");
Label::new(cx, "note->cut").class("slider-label");
ParamSlider::new(cx, Data::params, |params| {
&params.taps.note_to_cutoff_amount
})
.class("offset-widget");
.class("widget");
})
.class("row");
});
});
})
.class("column");
})
.class("param-group");

// })
// .class("attack-release");
// .class("cutoff-tracking");
Expand Down Expand Up @@ -264,24 +276,24 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
VStack::new(cx, |cx| {
//meters
HStack::new(cx, |cx| {
Label::new(cx, "in").class("meter-label");
PeakMeter::new(
cx,
Data::input_meter.map(|input_meter| {
util::gain_to_db(input_meter.load(Ordering::Relaxed))
}),
Some(Duration::from_millis(600)),
);
Label::new(cx, "input").class("meter-label");
});
HStack::new(cx, |cx| {
Label::new(cx, "out").class("meter-label");
PeakMeter::new(
cx,
Data::output_meter.map(|output_meter| {
util::gain_to_db(output_meter.load(Ordering::Relaxed))
}),
Some(Duration::from_millis(600)),
);
Label::new(cx, "output").class("meter-label");
});
})
.class("meters_and_name");
Expand Down
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ impl Del2 {
fn process_audio_blocks(&mut self, buffer: &mut Buffer) {
for (_, block) in buffer.iter_blocks(buffer.samples()) {
let block_len = block.samples();
let mut mute_buffer = [false; MAX_BLOCK_LEN];
assert!(block_len <= MAX_BLOCK_LEN);
// Either we resize here, or in the initialization fn
// If we don't, we are slower.
// self.resize_temp_buffers(block_len);
Expand All @@ -872,10 +874,12 @@ impl Del2 {
let write_index = self.delay_write_index as isize;
self.delay_buffer[0].write_latest(out_l, write_index);
self.delay_buffer[1].write_latest(out_r, write_index);
self.mute_in_delay_buffer.write_latest(
&vec![self.enabled_actions.load(MUTE_IN); block_len],
write_index,
);

let mute_value = self.enabled_actions.load(MUTE_IN);
mute_buffer[..block_len].fill(mute_value);

self.mute_in_delay_buffer
.write_latest(&mute_buffer[..block_len], write_index);
// TODO: no dry signal yet
out_l.fill(0.0);
out_r.fill(0.0);
Expand Down
24 changes: 15 additions & 9 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ param-slider .value-entry {
/* // This should align nicely with the right edge of the slider */
left: 269px;
right: 1s;
top: 9px;
bottom: 0px;
top: 18px;
bottom: 9px;
/* background-color: #4e4e4e; */
}

.column-title {
Expand All @@ -93,8 +94,11 @@ param-slider .value-entry {
}

.attack-release {
top: 1s;
bottom: 0px;
height: 30px;
}
.action-trigger-group {
bottom: 6px;
height: 30px;
}
.slider-label {
left: 1s;
Expand Down Expand Up @@ -142,9 +146,9 @@ generic-ui {
/* layout-type: row; */
/* } */
.row {
col-between: 6px;
height: 30px;
layout-type: row;
bottom: 6px;
}

/* generic-ui .column { */
Expand All @@ -156,9 +160,11 @@ generic-ui {
.column {
width: 269px;
height: auto;
row-between: 6px;
layout-type: column;
}
.param-group {
height: auto;
}
label {
left: 1s;
right: 1s;
Expand All @@ -174,7 +180,7 @@ generic-ui .label {

peak-meter {
height: 30px;
width: 589px;
width: 584px;
color: #e0ce91;
left: 0px;
bottom: 6px;
Expand All @@ -193,15 +199,15 @@ peak-meter .ticks__tick {
top: 0px;
width: 1px;
height: 30%;
color: #4e4e4e;
}
peak-meter .ticks__label {
top: 4px; /* In pixels in an attempt to get this to better align to the grid */
font-size: 11; /* 14.667px */
}
.meter-label {
child-left: 1s;
right: 0px;
/* top: 0px; */
right: 3px;
bottom: 24px;
font-size: 15;
width: 40px;
Expand Down

0 comments on commit 41051b6

Please sign in to comment.