Skip to content

Commit

Permalink
Implement bypass switch
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Dec 25, 2024
1 parent d9a89f1 commit 0c9d435
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Ratatouille/Ratatouille.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/


#define CONTROLS 10
#define CONTROLS 11

#define GUI_ELEMENTS 0

Expand Down Expand Up @@ -325,6 +325,8 @@ void plugin_create_controller_widgets(X11_UI *ui, const char * plugin_uri) {
asprintf(&ps->ir1.filepicker->filter ,"%s", ".wav");
ps->ir1.filepicker->use_filter = 1;

ui->widget[10] = add_lv2_switch (ui->widget[10], ui->win, 14, "", ui, 505, 22, 50, 50);

ps->ma.filebutton = add_lv2_file_button (ps->ma.filebutton, ui->win, -1, "Neural Model", ui, 40, 248, 25, 25);
ps->ma.filebutton->parent_struct = (void*)&ps->ma;
ps->ma.filebutton->func.user_callback = file_load_response;
Expand Down
10 changes: 9 additions & 1 deletion Ratatouille/Ratatouille.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class Xratatouille
uint32_t normB;
float* _normSlotA;
float* _normSlotB;
float* _bypass;
double fRec0[2];
double fRec3[2];
double fRec2[2];
Expand Down Expand Up @@ -256,7 +257,8 @@ Xratatouille::Xratatouille() :
_delay(0),
_bufb(0),
_normA(0),
_normB(0) {
_normB(0),
_bypass(0) {
xrworker.start();
xrworker.set<Xratatouille, &Xratatouille::do_work_mono>(this);
//xrworker.process = [=] () {do_work_mono();};
Expand Down Expand Up @@ -381,6 +383,9 @@ void Xratatouille::connect_(uint32_t port,void* data)
case 13:
_normSlotB = static_cast<float*>(data);
break;
case 14:
_bypass = static_cast<float*>(data);
break;
default:
break;
}
Expand Down Expand Up @@ -697,6 +702,9 @@ void Xratatouille::run_dsp_(uint32_t n_samples)
if(output0 != input0)
memcpy(output0, input0, n_samples*sizeof(float));

// basic bypass
if (!static_cast<uint32_t>(*_bypass)) return;

// get controller values from host
double fSlow0 = 0.0010000000000000009 * std::pow(1e+01, 0.05 * double(*(_inputGain)));
double fSlow4 = 0.0010000000000000009 * std::pow(1e+01, 0.05 * double(*(_inputGain1)));
Expand Down
15 changes: 13 additions & 2 deletions Ratatouille/Ratatouille.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@prefix spdx: <http://spdx.org/rdf/terms#> .


<urn:name#me>
<rata:me>
a foaf:Person ;
foaf:name "brummer" .

Expand Down Expand Up @@ -52,7 +52,7 @@ rata:irfile1
<urn:brummer:ratatouille>
a lv2:Plugin ,
lv2:SimulatorPlugin ;
doap:maintainer <urn:name#me> ;
doap:maintainer <rata:me> ;
doap:name "Ratatouille" ;
doap:license <https://spdx.org/licenses/BSD-3-Clause> ;
lv2:project <urn:brummer:ratatouille> ;
Expand Down Expand Up @@ -207,6 +207,17 @@ A Neural Model loader and mixer
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
], [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 14 ;
lv2:designation lv2:enabled;
lv2:portProperty lv2:toggled ;
lv2:symbol "ENABLE" ;
lv2:name "enable" ;
lv2:default 1 ;
lv2:minimum 0 ;
lv2:maximum 1 ;
] .

<urn:brummer:ratatouille_ui>
Expand Down
6 changes: 4 additions & 2 deletions Ratatouille/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ ifeq ($(TARGET), Linux)
CFLAGS := -O2 -D_FORTIFY_SOURCE=2 -Wall -Wno-unused-result -fstack-protector -fvisibility=hidden \
-fdata-sections -Wl,--gc-sections -Wl,-z,relro,-z,now -Wl,--exclude-libs,ALL -DUSE_ATOM

TTLUPDATEMODGUI = sed -i -e '211,226d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
TTLUPDATEMODGUI = sed -i -e '222,237d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
-e '7d' ../bin/$(BUNDLE)/$(NAME).ttl
else ifeq ($(TARGET), Windows)
CXXFLAGS += -D_FORTIFY_SOURCE=2 -I. -fPIC -DPIC -O2 -Wall -funroll-loops \
Expand All @@ -229,7 +229,7 @@ else ifeq ($(TARGET), Windows)

TTLUPDATE = sed -i '/lv2:binary/ s/\.so/\.dll/ ' ../bin/$(BUNDLE)/manifest.ttl
TTLUPDATEGUI = sed -i '/a guiext:X11UI/ s/X11UI/WindowsUI/ ; /guiext:binary/ s/\.so/\.dll/ ' ../bin/$(BUNDLE)/$(NAME).ttl
TTLUPDATEMODGUI = sed -i -e '211,226d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
TTLUPDATEMODGUI = sed -i -e '222,237d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
-e '7d' ../bin/$(BUNDLE)/$(NAME).ttl
endif

Expand Down Expand Up @@ -257,6 +257,7 @@ mod: $(EXEC_NAME).$(LIB_EXT)
@$(B_ECHO) "Create $(BUNDLE) $(reset)"
$(QUIET)mkdir -p ../bin/$(BUNDLE)
$(QUIET)cp ./*.ttl ../bin/$(BUNDLE)
@$(B_ECHO) "Copy MOD UI to $(BUNDLE) $(reset)"
$(QUIET)cp -r ./mod/* ../bin/$(BUNDLE)
$(QUIET)$(TTLUPDATE)
$(QUIET)$(TTLUPDATEMODGUI)
Expand All @@ -273,6 +274,7 @@ modapp: $(EXEC_NAME).$(LIB_EXT) $(EXEC_NAME)_ui.$(LIB_EXT)
@$(B_ECHO) "Create $(BUNDLE) $(reset)"
$(QUIET)mkdir -p ../bin/$(BUNDLE)
$(QUIET)cp ./*.ttl ../bin/$(BUNDLE)
@$(B_ECHO) "Copy MOD UI to $(BUNDLE) $(reset)"
$(QUIET)cp -r ./mod/* ../bin/$(BUNDLE)
$(QUIET)$(TTLUPDATE)
$(QUIET)$(TTLUPDATEGUI)
Expand Down

0 comments on commit 0c9d435

Please sign in to comment.