diff --git a/architecture/faust/dsp/llvm-c-dsp.h b/architecture/faust/dsp/llvm-c-dsp.h
index ee86ca5858..2732f32344 100644
--- a/architecture/faust/dsp/llvm-c-dsp.h
+++ b/architecture/faust/dsp/llvm-c-dsp.h
@@ -426,7 +426,7 @@ extern "C"
void computeCDSPInstance(llvm_dsp* dsp, int count, FAUSTFLOAT** input, FAUSTFLOAT** output);
/* Set custom memory manager to be used when creating instances */
- void setCMemoryManager(llvm_dsp_factory* factory, ManagerGlue* manager);
+ void setCMemoryManager(llvm_dsp_factory* factory, MemoryManagerGlue* manager);
/**
* Create a Faust DSP instance.
diff --git a/architecture/faust/gui/PrintCUI.h b/architecture/faust/gui/PrintCUI.h
new file mode 100644
index 0000000000..40d5f411ee
--- /dev/null
+++ b/architecture/faust/gui/PrintCUI.h
@@ -0,0 +1,151 @@
+/************************** BEGIN PrintCUI.h **************************/
+/************************************************************************
+ FAUST Architecture File
+ Copyright (C) 2020 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This Architecture section is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 3 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; If not, see .
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ************************************************************************/
+
+#ifndef FAUST_PRINTCUI_H
+#define FAUST_PRINTCUI_H
+
+#include
+#include "faust/gui/CInterface.h"
+
+/*******************************************************************************
+ * PrintCUI : Faust User Interface
+ * This class print arguments given to calls to UI methods and shows how
+ * a struct can be used inside functions.
+ ******************************************************************************/
+
+// Example of UI with a state
+typedef struct PRINTCUI {
+ int fVar1;
+ float fVar2;
+ // Some structure to keep [zone, init, min, max, step] parameters...
+} PRINTCUI;
+
+static void ui_open_tab_box(void* iface, const char* label)
+{
+ printf("ui_open_tab_box %s \n", label);
+}
+
+static void ui_open_horizontal_box(void* iface, const char* label)
+{
+ printf("ui_open_horizontal_box %s \n", label);
+}
+
+static void ui_open_vertical_box(void* iface, const char* label)
+{
+ // Using the 'iface' state
+ PRINTCUI* cui = (PRINTCUI*)iface;
+ printf("ui_open_horizontal_box %s %d %f\n", label, cui->fVar1, cui->fVar2);
+}
+
+static void ui_close_box(void* iface)
+{
+ printf("ui_close_box\n");
+}
+
+static void ui_add_button(void* iface, const char* label, FAUSTFLOAT* zone)
+{
+ printf("ui_add_button %s \n", label);
+}
+
+static void ui_add_check_button(void* iface, const char* label, FAUSTFLOAT* zone)
+{
+ printf("ui_add_check_button %s \n", label);
+}
+
+static void ui_add_vertical_slider(void* iface, const char* label,
+ FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
+ FAUSTFLOAT max, FAUSTFLOAT step)
+{
+ printf("ui_add_vertical_slider %s %f %f %f %f\n", label, init, min, max, step);
+}
+
+static void ui_add_horizontal_slider(void *iface, const char *label,
+ FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min,
+ FAUSTFLOAT max, FAUSTFLOAT step)
+{
+ printf("ui_add_vertical_slider %s %f %f %f %f\n", label, init, min, max, step);
+}
+
+static void ui_add_num_entry(void* iface, const char* label,
+ FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
+ FAUSTFLOAT max, FAUSTFLOAT step)
+{
+ printf("ui_add_num_entry %s %f %f %f %f\n", label, init, min, max, step);
+}
+
+static void ui_add_horizontal_bargraph(void* iface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
+{
+ printf("ui_add_horizontal_bargraph %s %f %f\n", label, min, max);
+}
+
+static void ui_add_vertical_bargraph(void* iface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
+{
+ printf("ui_add_horizontal_bargraph %s %f %f\n", label, min, max);
+}
+
+static void ui_add_sound_file(void* iface, const char* label, const char* filename, struct Soundfile** sf_zone)
+{
+ printf("ui_add_sound_file %s %s\n", label, filename);
+}
+
+static void ui_declare(void* iface, FAUSTFLOAT *zone, const char *key, const char *val)
+{
+ printf("ui_declare %s, %s\n", key, val);
+}
+
+// Example of a structure to be given as 'iface' in functions
+PRINTCUI cui = {
+ .fVar1 = 1,
+ .fVar2 = 0.5
+};
+
+UIGlue uglue = {
+ .uiInterface = &cui,
+ .openTabBox = ui_open_tab_box,
+ .openHorizontalBox = ui_open_horizontal_box,
+ .openVerticalBox = ui_open_vertical_box,
+ .closeBox = ui_close_box,
+ .addButton = ui_add_button,
+ .addCheckButton = ui_add_check_button,
+ .addVerticalSlider = ui_add_vertical_slider,
+ .addHorizontalSlider = ui_add_horizontal_slider,
+ .addNumEntry = ui_add_num_entry,
+ .addHorizontalBargraph = ui_add_horizontal_bargraph,
+ .addVerticalBargraph = ui_add_vertical_bargraph,
+ .addSoundfile = ui_add_sound_file,
+ .declare = ui_declare
+};
+
+static void meta_declare(void* iface, const char *key, const char *val)
+{
+ printf("meta_declare %s, %s\n", key, val);
+}
+
+MetaGlue mglue = {
+ .metaInterface = NULL,
+ .declare = meta_declare
+};
+
+#endif // FAUST_PRINTCUI_H
+/************************** END PrintCUI.h **************************/
diff --git a/embedded/faustjava/Faust_wrap.cxx b/embedded/faustjava/Faust_wrap.cxx
index 2020dd1499..58b7b7fe68 100644
--- a/embedded/faustjava/Faust_wrap.cxx
+++ b/embedded/faustjava/Faust_wrap.cxx
@@ -1435,13 +1435,13 @@ SWIGEXPORT void JNICALL Java_com_grame_faust_FaustJNI_computeCDSPInstance(JNIEnv
SWIGEXPORT void JNICALL Java_com_grame_faust_FaustJNI_setCMemoryManager(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
llvm_dsp_factory *arg1 = (llvm_dsp_factory *) 0 ;
- ManagerGlue *arg2 = (ManagerGlue *) 0 ;
+ MemoryManagerGlue *arg2 = (MemoryManagerGlue *) 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(llvm_dsp_factory **)&jarg1;
- arg2 = *(ManagerGlue **)&jarg2;
+ arg2 = *(MemoryManagerGlue **)&jarg2;
setCMemoryManager(arg1,arg2);
}
diff --git a/tests/llvm-tests/Makefile b/tests/llvm-tests/Makefile
index a14d98343c..4c1c3cbae3 100644
--- a/tests/llvm-tests/Makefile
+++ b/tests/llvm-tests/Makefile
@@ -15,7 +15,7 @@ llvm-test: llvm-test.cpp $(LIB)/libfaust.a
$(CXX) -std=c++11 -O3 llvm-test.cpp -I $(INC) $(LIB)/libfaust.a -lpthread `llvm-config --ldflags --libs all --system-libs` -o llvm-test
llvm-test-c: llvm-test.c $(LIB)/libfaust.a
- $(CXX) -std=c++11 -g llvm-test.c -I $(INC) $(LIB)/libfaust.a -lpthread `llvm-config --ldflags --libs all --system-libs` -o llvm-test-c
+ $(CXX) llvm-test.c -I $(INC) $(LIB)/libfaust.a -lpthread `llvm-config --ldflags --libs all --system-libs` -o llvm-test-c
llvm-algebra-test: llvm-algebra-test.cpp $(LIB)/libfaust.a
$(CXX) -std=c++11 -O3 llvm-algebra-test.cpp -I $(INC) $(LIB)/libfaust.a -lpthread `llvm-config --ldflags --libs all --system-libs` -o llvm-algebra-test
diff --git a/tests/llvm-tests/llvm-test.c b/tests/llvm-tests/llvm-test.c
index f8f4dfdc5b..1c17464bc0 100644
--- a/tests/llvm-tests/llvm-test.c
+++ b/tests/llvm-tests/llvm-test.c
@@ -26,6 +26,7 @@
#include
#include "faust/dsp/llvm-c-dsp.h"
+#include "faust/gui/PrintCUI.h"
static bool isopt(char* argv[], const char* name)
{
@@ -33,85 +34,6 @@ static bool isopt(char* argv[], const char* name)
return false;
}
-static void meta_declare(void *iface __unused, const char *key, const char *val)
-{
- printf("meta_declare %s, %s\n", key, val);
-}
-
-static void ui_open_tab_box(void* iface __unused, const char* label)
-{
- printf("ui_open_tab_box %s \n", label);
-}
-
-static void ui_open_horizontal_box(void* iface __unused, const char* label)
-{
- printf("ui_open_horizontal_box %s \n", label);
-}
-
-static void ui_open_vertical_box(void* iface __unused, const char* label)
-{
- printf("ui_open_vertical_box %s \n", label);
-}
-
-static void ui_close_box(void* iface __unused)
-{
- printf("ui_close_box\n");
-}
-
-static void ui_add_button(void* iface __unused, const char* label, FAUSTFLOAT* zone)
-{
- printf("ui_add_button %s \n", label);
-}
-
-static void ui_add_check_button(void* iface __unused, const char* label, FAUSTFLOAT* zone)
-{
- printf("ui_add_check_button %s \n", label);
-}
-
-static void ui_add_vertical_slider(void* iface __unused, const char* label,
- FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
- FAUSTFLOAT max, FAUSTFLOAT step)
-{
- printf("ui_add_vertical_slider %s %f %f %f %f\n", label, init, min, max, step);
-}
-
-static void ui_add_horizontal_slider(void *iface __unused, const char *label,
- FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min,
- FAUSTFLOAT max, FAUSTFLOAT step)
-{
- printf("ui_add_vertical_slider %s %f %f %f %f\n", label, init, min, max, step);
-}
-
-static void ui_add_num_entry(void* iface __unused, const char* label,
- FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
- FAUSTFLOAT max, FAUSTFLOAT step)
-{
- printf("ui_add_num_entry %s %f %f %f %f\n", label, init, min, max, step);
-}
-
-static void ui_add_horizontal_bargraph(void* iface __unused, const char* label,
- FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
-{
- printf("ui_add_horizontal_bargraph %s %f %f\n", label, min, max);
-}
-
-static void ui_add_vertical_bargraph(void* iface __unused, const char* label,
- FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
-{
- printf("ui_add_horizontal_bargraph %s %f %f\n", label, min, max);
-}
-
-static void ui_add_sound_file(void* iface __unused, const char* label __unused,
- const char* filename __unused, struct Soundfile** sf_zone __unused)
-{
-}
-
-static void ui_declare(void *iface, FAUSTFLOAT *zone __unused,
- const char *key, const char *val)
-{
- printf("ui_declare %s, %s\n", key, val);
-}
-
int main(int argc, const char** argv)
{
if (isopt((char**)argv, "-h") || isopt((char**)argv, "-help")) {
@@ -149,30 +71,9 @@ int main(int argc, const char** argv)
printf("getNumInputs : %d\n", getNumInputsCDSPInstance(dsp));
printf("getNumOutputs : %d\n", getNumOutputsCDSPInstance(dsp));
- MetaGlue mglue = {
- .metaInterface = NULL,
- .declare = meta_declare
- };
-
+ // Defined in PrintCUI.h
metadataCDSPInstance(dsp, &mglue);
- UIGlue uglue = {
- .uiInterface = NULL,
- .openTabBox = ui_open_tab_box,
- .openHorizontalBox = ui_open_horizontal_box,
- .openVerticalBox = ui_open_vertical_box,
- .closeBox = ui_close_box,
- .addButton = ui_add_button,
- .addCheckButton = ui_add_check_button,
- .addVerticalSlider = ui_add_vertical_slider,
- .addHorizontalSlider = ui_add_horizontal_slider,
- .addNumEntry = ui_add_num_entry,
- .addHorizontalBargraph = ui_add_horizontal_bargraph,
- .addVerticalBargraph = ui_add_vertical_bargraph,
- .addSoundfile = ui_add_sound_file,
- .declare = ui_declare
- };
-
buildUserInterfaceCDSPInstance(dsp, &uglue);
// Cleanup