Skip to content

Commit

Permalink
Fix crosscompile, add erase switch to MOD UI for models and IR files
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Dec 27, 2024
1 parent 0c9d435 commit 20849d7
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 22 deletions.
48 changes: 47 additions & 1 deletion Ratatouille/Ratatouille.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ class Xratatouille
float* _normSlotA;
float* _normSlotB;
float* _bypass;
float* _eraseSlotA;
float* _eraseSlotB;
float* _eraseIr;
float* _eraseIr1;
double fRec0[2];
double fRec3[2];
double fRec2[2];
Expand Down Expand Up @@ -258,7 +262,11 @@ Xratatouille::Xratatouille() :
_bufb(0),
_normA(0),
_normB(0),
_bypass(0) {
_bypass(0),
_eraseSlotA(0),
_eraseSlotB(0),
_eraseIr(0),
_eraseIr1(0) {
xrworker.start();
xrworker.set<Xratatouille, &Xratatouille::do_work_mono>(this);
//xrworker.process = [=] () {do_work_mono();};
Expand Down Expand Up @@ -386,6 +394,18 @@ void Xratatouille::connect_(uint32_t port,void* data)
case 14:
_bypass = static_cast<float*>(data);
break;
case 15:
_eraseSlotA = static_cast<float*>(data);
break;
case 16:
_eraseSlotB = static_cast<float*>(data);
break;
case 17:
_eraseIr = static_cast<float*>(data);
break;
case 18:
_eraseIr1 = static_cast<float*>(data);
break;
default:
break;
}
Expand Down Expand Up @@ -664,6 +684,32 @@ void Xratatouille::run_dsp_(uint32_t n_samples)
}
}

if ((*_eraseSlotA)) {
_ab.store(1, std::memory_order_release);
model_file = "None";
_execute.store(true, std::memory_order_release);
xrworker.runProcess();
(*_eraseSlotA) = 0.0;
} else if ((*_eraseSlotB)) {
_ab.store(2, std::memory_order_release);
model_file1 = "None";
_execute.store(true, std::memory_order_release);
xrworker.runProcess();
(*_eraseSlotB) = 0.0;
} else if ((*_eraseIr)) {
_ab.store(7, std::memory_order_release);
ir_file = "None";
_execute.store(true, std::memory_order_release);
xrworker.runProcess();
(*_eraseIr) = 0.0;
} else if ((*_eraseIr1)) {
_ab.store(8, std::memory_order_release);
ir_file1 = "None";
_execute.store(true, std::memory_order_release);
xrworker.runProcess();
(*_eraseIr1) = 0.0;
}

if (!_execute.load(std::memory_order_acquire) && _restore.load(std::memory_order_acquire)) {
_execute.store(true, std::memory_order_release);
bufsize = n_samples;
Expand Down
40 changes: 40 additions & 0 deletions Ratatouille/Ratatouille.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,46 @@ A Neural Model loader and mixer
lv2:default 1 ;
lv2:minimum 0 ;
lv2:maximum 1 ;
], [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 15 ;
lv2:portProperty lv2:trigger ;
lv2:symbol "eraseSlotA" ;
lv2:name "erase Slot A" ;
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
], [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 16 ;
lv2:portProperty lv2:trigger ;
lv2:symbol "eraseSlotB" ;
lv2:name "erase Slot B" ;
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
], [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 17 ;
lv2:portProperty lv2:trigger ;
lv2:symbol "eraseIr" ;
lv2:name "erase Ir" ;
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
], [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 18 ;
lv2:portProperty lv2:trigger ;
lv2:symbol "eraseIr1" ;
lv2:name "erase Ir1" ;
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
] .

<urn:brummer:ratatouille_ui>
Expand Down
36 changes: 20 additions & 16 deletions Ratatouille/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
endif


# check which architecture we build for
TARGET_ARCH = $(shell $(CXX) -dumpmachine | sed 's/-.*//')

ifneq ($(UNAME_M),$(TARGET_ARCH))
CROSS_COMPILING = 1
$(info $(yellow) INFO: $(reset)Cross Compile $(blue)$(UNAME_M)$(reset) to $(blue)$(TARGET_ARCH)$(reset))
endif

# avoid optimisation for x86_64 arch when we cross compile
ifneq ($(CROSS_COMPILING), 1)

# check if clang is available
ifeq ($(TARGET), Linux)
CXX_VERSION = $(shell clang++ --version 2>/dev/null)
Expand All @@ -22,9 +33,6 @@ ifeq ($(TARGET), Linux)
endif
endif

# check which architecture we build for
TARGET_ARCH = $(shell $(CXX) -dumpmachine | sed 's/-.*//')

# get flags supported by CPU
ifeq ($(UNAME_S), FreeBSD)
CPU_INFO = dmesg | grep Features | tr A-Z a-z
Expand All @@ -35,13 +43,6 @@ else
CPU_INFO = cat /proc/cpuinfo | grep flags
endif

ifneq ($(UNAME_M),$(TARGET_ARCH))
CROSS_COMPILING = 1
$(info $(yellow) INFO: $(reset)Cross Compile $(blue)$(UNAME_M)$(reset) to $(blue)$(TARGET_ARCH)$(reset))
endif

# avoid optimisation for x86_64 arch when we cross compile
#ifneq ($(CROSS_COMPILING), 1)
# check for sse optimisation level only on x86_64 architecture
ifeq ($(TARGET_ARCH), x86_64)
ifneq ($$(filter $(CPU_INFO) | grep sse3 ) , )
Expand Down Expand Up @@ -93,16 +94,19 @@ endif
ifeq ($(NO_x86_64), $(x86_64_LEVEL))
x86_64_LEVEL :=
endif
#endif

endif

CXX_v = $(shell $(CXX) -dumpversion)
CXX_VERSION := $(subst ., ,$(lastword $(CXX_v)))
CXX_MAJOR_VER := $(word 1,$(CXX_VERSION))
ifneq ($(MAKECMDGOALS),install)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(NO_x86_64), $(x86_64_LEVEL))
ifeq ($(TARGET_ARCH), aarch64)
CXXFLAGS += -march=armv8-a
$(info $(yellow) INFO: $(reset)optimised for $(blue)-march=armv8-a $(SSE_CFLAGS)$(reset))
else ifeq ($(shell awk -v a="$(CXX_v)" -v b="11" 'BEGIN{print(a<b)}'), 1)
else ifeq ($(shell awk -v a="$(CXX_MAJOR_VER)" -v b="11" 'BEGIN{print(a<b)}'), 1)
SSE_CFLAGS += -march=native
$(info $(yellow) INFO: $(reset)optimised for $(blue)$(SSE_CFLAGS)$(reset))
else ifeq ($(TARGET_ARCH), x86_64)
Expand All @@ -120,7 +124,7 @@ endif
ifeq (,$(filter clean,$(MAKECMDGOALS)))
ifeq (,$(filter install,$(MAKECMDGOALS)))
$(info $(yellow) INFO: $(reset)build with $(blue)$(CXX) $(CXX_v)$(reset))
ifeq ($(shell awk -v a="$(CXX_v)" -v b="11" 'BEGIN{print(a<b)}'), 1)
ifeq ($(shell awk -v a="$(CXX_MAJOR_VER)" -v b="11" 'BEGIN{print(a<b)}'), 1)
CXXFLAGS += -std=c++17
$(info $(yellow) INFO: $(reset)using $(blue)-std=c++17$(reset))
else
Expand Down Expand Up @@ -184,7 +188,7 @@ ifeq ($(TARGET), Linux)

CXXFLAGS += -MMD -flto=auto -fPIC -DPIC -O3 -Wall -funroll-loops $(SSE_CFLAGS) \
-Wno-sign-compare -Wno-reorder -Wno-infinite-recursion -DUSE_ATOM $(FFT_FLAG) \
-fomit-frame-pointer -fstack-protector -fvisibility=hidden \
-fomit-frame-pointer -fstack-protector -fvisibility=hidden -Wno-pessimizing-move \
-fdata-sections -I. -I./ -I./zita-resampler-1.1.0 -I$(CONV_DIR) \
-DRTNEURAL_DEFAULT_ALIGNMENT=32 -DRTNEURAL_USE_EIGEN=1 -DRTNEURAL_NAMESPACE=RTNeural \
-DDSP_SAMPLE_FLOAT -DNAM_SAMPLE_FLOAT -Dneural_amp_modeler_EXPORTS
Expand All @@ -207,7 +211,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 '222,237d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
TTLUPDATEMODGUI = sed -i -e '262,277d' -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 +233,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 '222,237d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
TTLUPDATEMODGUI = sed -i -e '262,277d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
-e '7d' ../bin/$(BUNDLE)/$(NAME).ttl
endif

Expand Down
17 changes: 17 additions & 0 deletions Ratatouille/mod/modgui.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
modgui:stylesheet <modgui/stylesheet-ratatouille.css> ;
modgui:screenshot <modgui/screenshot-ratatouille.png> ;
modgui:thumbnail <modgui/thumbnail-ratatouille.png> ;
modgui:javascript <modgui/script-ratatouille.js> ;
modgui:brand "brummer" ;
modgui:label "Ratatouille" ;
modgui:model "mod-pedal-ratatouille" ;
Expand Down Expand Up @@ -51,5 +52,21 @@
lv2:index 9 ;
lv2:symbol "NormalizeSlotB" ;
lv2:name "Normalize Slot B" ;
] , [
lv2:index 10 ;
lv2:symbol "eraseSlotA" ;
lv2:name "erase Slot A" ;
] , [
lv2:index 11 ;
lv2:symbol "eraseSlotB" ;
lv2:name "erase Slot B" ;
] , [
lv2:index 12 ;
lv2:symbol "eraseIr" ;
lv2:name "erase Ir" ;
] , [
lv2:index 13 ;
lv2:symbol "eraseIr1" ;
lv2:name "erase Ir1" ;
] ;
] .
28 changes: 24 additions & 4 deletions Ratatouille/mod/modgui/icon-ratatouille.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@
<div class="mod-switch-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.8}}
{{#controls.10}}
<div class="mod-switch2" title="{{name}}">
<div class="mod-button-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.10}}
{{#effect.parameters.0}}
{{#path}}
<div class="mod-enumerated" mod-role="input-parameter" mod-parameter-uri="{{uri}}" mod-widget="custom-select-path">
<div mod-role="input-parameter-value" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
<div mod-role="input-parameter-value" rata-role="SlotA" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
-- choose a NAM/AIDA-X model --
</div>
<div class="mod-enumerated-list">
Expand All @@ -67,10 +72,15 @@
<div class="mod-switch-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.9}}
{{#controls.11}}
<div class="mod-switch2" title="{{name}}">
<div class="mod-button-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.11}}
{{#effect.parameters.1}}
{{#path}}
<div class="mod-enumerated" mod-role="input-parameter" mod-parameter-uri="{{uri}}" mod-widget="custom-select-path">
<div mod-role="input-parameter-value" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
<div mod-role="input-parameter-value" rata-role="SlotB" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
-- choose a NAM/AIDA-X model --
</div>
<div class="mod-enumerated-list">
Expand All @@ -86,10 +96,15 @@
<div class="mod-switch-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.6}}
{{#controls.12}}
<div class="mod-switch2" title="{{name}}">
<div class="mod-button-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.12}}
{{#effect.parameters.2}}
{{#path}}
<div class="mod-enumerated" mod-role="input-parameter" mod-parameter-uri="{{uri}}" mod-widget="custom-select-path">
<div mod-role="input-parameter-value" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
<div mod-role="input-parameter-value" rata-role="IrA" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
-- choose an IR file --
</div>
<div class="mod-enumerated-list">
Expand All @@ -105,10 +120,15 @@
<div class="mod-switch-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.7}}
{{#controls.13}}
<div class="mod-switch2" title="{{name}}">
<div class="mod-button-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="switch"></div>
</div>
{{/controls.13}}
{{#effect.parameters.3}}
{{#path}}
<div class="mod-enumerated" mod-role="input-parameter" mod-parameter-uri="{{uri}}" mod-widget="custom-select-path">
<div mod-role="input-parameter-value" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
<div mod-role="input-parameter-value" rata-role="IrB" mod-parameter-uri="{{uri}}" class="mod-enumerated-selected">
-- choose an IR file --
</div>
<div class="mod-enumerated-list">
Expand Down
40 changes: 40 additions & 0 deletions Ratatouille/mod/modgui/script-ratatouille.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

function (event, funcs)
{
function check_neural_model(icon, value)
{
if (value == 'None')
icon.find ('[rata-role=SlotA]').text ('-- choose a NAM/AIDA-X model --');
}
function check_neural_model1(icon, value)
{
if (value == 'None')
icon.find ('[rata-role=SlotB]').text ('-- choose a NAM/AIDA-X model --');
}
function check_irfile(icon, value)
{
if (value == 'None')
icon.find ('[rata-role=IrA]').text ('-- choose an IR file --');
}
function check_irfile1(icon, value)
{
if (value == 'None')
icon.find ('[rata-role=IrB]').text ('-- choose an IR file --');
}

if (event.type == 'start')
{
}
else if (event.type == 'change')
{
if (event.uri === 'urn:brummer:ratatouille#Neural_Model')
check_neural_model(event.icon, event.value);
else if (event.uri === 'urn:brummer:ratatouille#Neural_Model1')
check_neural_model1(event.icon, event.value);
else if (event.uri === 'urn:brummer:ratatouille#irfile')
check_irfile(event.icon, event.value);
else if (event.uri === 'urn:brummer:ratatouille#irfile1')
check_irfile1(event.icon, event.value);

}
}
Loading

0 comments on commit 20849d7

Please sign in to comment.