fix: remove resonance ui

This commit is contained in:
2023-09-10 01:48:52 +04:00
parent 7ee245d4d1
commit 63a6479be5
2 changed files with 12 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ class Renderer {
void draw_adsr_panel(ADSR* adsr, ADSRGuiState& gui_adsr, void draw_adsr_panel(ADSR* adsr, ADSRGuiState& gui_adsr,
const Rectangle& panel_bounds, float panel_y_offset); const Rectangle& panel_bounds, float panel_y_offset);
void draw_second_panel(Rectangle& bounds); void draw_second_panel(Rectangle& bounds);
float draw_filter_panel(Synth& synth, FilterGuiState& gui_filter, float DrawFilterPanel(Synth& synth, FilterGuiState& gui_filter,
const Rectangle& panel_bounds); const Rectangle& panel_bounds);
public: public:

View File

@@ -190,7 +190,7 @@ void Renderer::draw_second_panel(Rectangle& bounds) {
GuiPanel(bounds, ""); GuiPanel(bounds, "");
} }
float Renderer::draw_filter_panel(Synth& synth, FilterGuiState& gui_filter, float Renderer::DrawFilterPanel(Synth& synth, FilterGuiState& gui_filter,
const Rectangle& panel_bounds) { const Rectangle& panel_bounds) {
#define FILTER_TYPE_OPTIONS "LP;BP;HP" #define FILTER_TYPE_OPTIONS "LP;BP;HP"
Filter* filter = synth.GetFilter(); Filter* filter = synth.GetFilter();
@@ -198,7 +198,7 @@ float Renderer::draw_filter_panel(Synth& synth, FilterGuiState& gui_filter,
// Draw Filter Panel // Draw Filter Panel
const int osc_panel_width = panel_bounds.width - 20; const int osc_panel_width = panel_bounds.width - 20;
const int osc_panel_height = 120; const int osc_panel_height = 100;
const int osc_panel_x = panel_bounds.x + 10; const int osc_panel_x = panel_bounds.x + 10;
const int osc_panel_y = panel_bounds.y + 50; const int osc_panel_y = panel_bounds.y + 50;
panel_y_offset += osc_panel_height + 5; panel_y_offset += osc_panel_height + 5;
@@ -221,15 +221,15 @@ float Renderer::draw_filter_panel(Synth& synth, FilterGuiState& gui_filter,
gui_filter.freq = powf(10.f, freq); gui_filter.freq = powf(10.f, freq);
el_rect.y += el_rect.height + el_spacing; el_rect.y += el_rect.height + el_spacing;
//todo: implement that when Res will be fixed
// Resonance slider // Resonance slider
float res = gui_filter.res; // float res = gui_filter.res;
char res_slider_label[32]; // char res_slider_label[32];
snprintf(res_slider_label, 7, "%.1f u", res); // snprintf(res_slider_label, 7, "%.1f u", res);
res = GuiSlider(el_rect, res_slider_label, "", res, 0.0f, 1.0f); // res = GuiSlider(el_rect, res_slider_label, "", res, 0.0f, 1.0f);
gui_filter.res = res; // gui_filter.res = res;
el_rect.y += el_rect.height + el_spacing; // el_rect.y += el_rect.height + el_spacing;
// todo: filter type
// Shape select // Shape select
int shape_index = (int)(gui_filter.type); int shape_index = (int)(gui_filter.type);
bool is_dropdown_click = bool is_dropdown_click =
@@ -247,7 +247,7 @@ float Renderer::draw_filter_panel(Synth& synth, FilterGuiState& gui_filter,
// apply values to real one // apply values to real one
// todo: thrid (order) parameter // todo: thrid (order) parameter
// todo: why resonance changing does not work? // todo: why resonance changing does not work?
filter->SetParameters(gui_filter.freq, 0.707, 0); filter->SetParameters(gui_filter.freq, filter->GetRes(), filter->GetPeakGain());
return panel_y_offset; return panel_y_offset;
} }
@@ -269,5 +269,5 @@ void Renderer::draw_ui(Synth& synth, SynthGuiState& synth_gui) {
draw_oscillators_shape_inputs(oscillators, gui_oscillators); draw_oscillators_shape_inputs(oscillators, gui_oscillators);
draw_second_panel(panel_bounds); draw_second_panel(panel_bounds);
draw_filter_panel(synth, synth_gui.filter, panel_bounds); DrawFilterPanel(synth, synth_gui.filter, panel_bounds);
} }