Skip to content

Commit

Permalink
Add reset button to GxTremolo, issue #25
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Nov 18, 2020
1 parent bca3813 commit 5796a51
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
5 changes: 5 additions & 0 deletions trunk/src/LV2/gx_tremolo.lv2/gx_tremolo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Gx_tremolo
// pointer to buffer
float* output;
float* input;
float* reset;
// pointer to dsp class
PluginLV2* tremolo_st;
// private functions
Expand Down Expand Up @@ -97,6 +98,9 @@ void Gx_tremolo::connect_mono(uint32_t port,void* data)
case EFFECTS_INPUT:
input = static_cast<float*>(data);
break;
case RESET:
reset = static_cast<float*>(data);
break;
default:
break;
}
Expand Down Expand Up @@ -131,6 +135,7 @@ void Gx_tremolo::run_dsp_mono(uint32_t n_samples)
if (n_samples< 1) return;
tremolo_st->mono_audio(static_cast<int>(n_samples), input,
output, tremolo_st);
if ((*reset)>0) tremolo_st->clear_state(tremolo_st);
}

void Gx_tremolo::connect_all_mono_ports(uint32_t port, void* data)
Expand Down
1 change: 1 addition & 0 deletions trunk/src/LV2/gx_tremolo.lv2/gx_tremolo.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef enum
FREQ,
EFFECTS_OUTPUT,
EFFECTS_INPUT,
RESET,
} PortIndex;

#endif //SRC_HEADERS_GXEFFECTS_H_
11 changes: 11 additions & 0 deletions trunk/src/LV2/gx_tremolo.lv2/gx_tremolo.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
@prefix time: <http://lv2plug.in/ns/ext/time#>.
@prefix units: <http://lv2plug.in/ns/extensions/units#> .
@prefix pprop: <http://lv2plug.in/ns/ext/port-props#> .

<http://guitarix.sourceforge.net#me>
a foaf:Person ;
Expand Down Expand Up @@ -115,6 +116,16 @@ Model of a vactrol tremolo unit by "transmogrify"
lv2:index 5 ;
lv2:symbol "in" ;
lv2:name "In" ;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 6 ;
lv2:portProperty lv2:integer, pprop:trigger;
lv2:symbol "reset" ;
lv2:name "Reset" ;
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
] .

<http://guitarix.sourceforge.net/plugins/gx_tremolo#gui>
Expand Down
9 changes: 7 additions & 2 deletions trunk/src/LV2/gx_tremolo.lv2/gx_tremolo_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
-----------------------------------------------------------------------
----------------------------------------------------------------------*/

#define CONTROLS 4
#define CONTROLS 5

/*---------------------------------------------------------------------
-----------------------------------------------------------------------
Expand Down Expand Up @@ -72,10 +72,15 @@ void plugin_create_controller_widgets(X11_UI *ui, const char * plugin_uri) {
set_adjustment(ui->widget[2]->adj,50.0, 50.0, 0.0, 100.0, 0.1, CL_CONTINUOS);
adj_set_scale(ui->widget[2]->adj, 5.0);

ui->widget[4] = add_button(ui->win, "Reset",40, 215,40,30);
ui->widget[4]->parent_struct = ui;
ui->widget[4]->data = RESET;
ui->widget[4]->func.value_changed_callback = value_changed;

// create combobox widgets
const char* model[] = {"triangle","sine"};
size_t len = sizeof(model) / sizeof(model[0]);
ui->widget[3] = add_my_combobox(ui->widget[3], SINE, "Mode", model, len, 0, ui, 40, 215, 180, 30);
ui->widget[3] = add_my_combobox(ui->widget[3], SINE, "Mode", model, len, 0, ui, 80, 215, 140, 30);
}

void plugin_cleanup(X11_UI *ui) {
Expand Down

0 comments on commit 5796a51

Please sign in to comment.