Skip to content

Commit

Permalink
do not crash on failure to load plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Oct 23, 2024
1 parent 4a5f568 commit b3ccbf8
Show file tree
Hide file tree
Showing 31 changed files with 25 additions and 11 deletions.
Binary file modified FileWriter.o
Binary file not shown.
Binary file modified LockFreeQueue.o
Binary file not shown.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#~ GTKMM=`pkg-config --cflags --libs gtkmm-4.0`

TARGET=linux
#~ TARGET=win32
TARGET=win32

VERSION=`git rev-list --count HEAD`

ifeq ($(TARGET),linux)
GTK=`pkg-config --cflags --libs gtk4`
Expand Down Expand Up @@ -98,3 +100,6 @@ FileWriter.o: FileWriter.cpp FileWriter.h LockFreeQueue.cpp LockFreeQueue.h vrin

vringbuffer.o: upwaker.c vringbuffer.cc
$(CPP) -fpermissive -c upwaker.c vringbuffer.cc $(GTK)

win32-release:
export VER=$(VERSION) ; cd .. ; zip -r releases/amprack-$$VER.zip win/
Binary file modified Plugin.o
Binary file not shown.
Binary file modified PluginControl.o
Binary file not shown.
Binary file modified SharedLibrary.o
Binary file not shown.
Binary file removed amprack
Binary file not shown.
Binary file modified amprack.exe
Binary file not shown.
Binary file modified cairo.o
Binary file not shown.
Binary file modified dictionary.o
Binary file not shown.
Binary file modified engine.o
Binary file not shown.
Binary file modified jack.o
Binary file not shown.
Binary file modified knob.o
Binary file not shown.
Binary file modified log.o
Binary file not shown.
Binary file modified lv2_ext.o
Binary file not shown.
23 changes: 14 additions & 9 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ void activate (GApplication * app, void * v) {
GtkCssProvider *cssProvider2 = gtk_css_provider_new();
gtk_css_provider_load_from_path(cssProvider, "style.css");

MyWindow window = MyWindow ((GtkApplication *) app);
gtk_widget_add_css_class ((GtkWidget *) window.window, "xwindow");
MyWindow * window = new MyWindow ((GtkApplication *) app);
gtk_widget_add_css_class ((GtkWidget *) window -> window, "xwindow");

if ( std::filesystem::exists ("assets/themes/TubeAmp/style.css"))
gtk_css_provider_load_from_path(cssProvider, std::string ("assets/themes/").append (window.rack -> theme).append ("/style.css").c_str ());
gtk_css_provider_load_from_path(cssProvider, std::string ("assets/themes/").append (window ->rack -> theme).append ("/style.css").c_str ());
else
gtk_css_provider_load_from_path(cssProvider, std::string ("/usr/share/amprack/assets/themes/").append (window.rack -> theme).append ("/style.css").c_str ());
gtk_css_provider_load_from_path(cssProvider, std::string ("/usr/share/amprack/assets/themes/").append (window ->rack -> theme).append ("/style.css").c_str ());
gtk_style_context_add_provider_for_display (gdk_display_get_default (), (GtkStyleProvider *)cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

# ifdef __linux__
Expand All @@ -35,9 +35,9 @@ void activate (GApplication * app, void * v) {

gtk_style_context_add_provider_for_display (gdk_display_get_default (), (GtkStyleProvider *)cssProvider2, GTK_STYLE_PROVIDER_PRIORITY_USER);

window.rack -> engine -> processor -> bypass = false ;
window ->rack -> engine -> processor -> bypass = false ;

gtk_window_present ((GtkWindow *)window.window);
gtk_window_present ((GtkWindow *)window ->window);
LOGD ("we are live and rocking\n");
OUT
}
Expand Down Expand Up @@ -65,16 +65,21 @@ int main(int argc, char* argv[])
g_setenv ("GSK_RENDERER", renderers [renderer], 1);
LOGD ("[config] set renderer to %s\n", renderers [renderer]);
}
} else {
// seems to be most stable *ahem* on win32
# ifndef __linux__
g_setenv ("GSK_RENDERER", "gl", 1);
# endif
}

auto app = gtk_application_new ("org.acoustixaudio.amprack", G_APPLICATION_DEFAULT_FLAGS);

//~ window.set_title("Gtk4 Demo");
//~ window.set_default_size(300 , 400);
//~ window ->set_title("Gtk4 Demo");
//~ window ->set_default_size(300 , 400);
//~ g_signal_connect (app, "activate")
//~ app->signal_activate().connect([&](){
//~ app->add_window(window);
//~ window.show ();
//~ window ->show ();
//~ });

g_signal_connect (app, "activate", (GCallback) activate, NULL);
Expand Down
Binary file modified main.o
Binary file not shown.
Binary file modified mem.o
Binary file not shown.
Binary file modified objects.o
Binary file not shown.
Binary file modified pango.o
Binary file not shown.
Binary file modified pluginui.o
Binary file not shown.
Binary file modified presets.o
Binary file not shown.
Binary file modified process.o
Binary file not shown.
4 changes: 4 additions & 0 deletions rack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@ bool Rack::load_preset (json j) {
auto plugin = p ["name"].dump () ;
plugin = plugin.substr (1, plugin.size () - 2) ;
PluginUI * ui = addPluginByName ((char *) plugin.c_str ());
if (ui == NULL) {
HERE LOGD ("-----| error loading plugin %s |-------\n", plugin.c_str ());
continue ;
}
auto controls = p ["controls"].dump () ;
controls = controls.substr (1, controls.size () - 2);
ui -> load_preset (controls) ;
Expand Down
Binary file modified rack.o
Binary file not shown.
Binary file modified settings.o
Binary file not shown.
Binary file modified snd.o
Binary file not shown.
Binary file modified upwaker.o
Binary file not shown.
Binary file modified util.o
Binary file not shown.
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION 146
#define VERSION 147
Binary file modified vringbuffer.o
Binary file not shown.

0 comments on commit b3ccbf8

Please sign in to comment.