Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
path: build

windows-build:
runs-on: windows-2019
runs-on: windows-latest
strategy:
matrix:
floatsize: [32, 64]
Expand Down
24 changes: 22 additions & 2 deletions pdlua.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@

#include "pdlua_gfx.h"

// function pointer type for signal_setmultiout (added with Pd 0.54)
typedef void (*t_signal_setmultiout)(t_signal **, int);
static t_signal_setmultiout g_signal_setmultiout;

// function pointer type for glist_getrtext/glist_findrtext (changes with Pd 0.56)
typedef t_rtext *(*t_glist_rtext)(t_glist *, t_text *);
static t_glist_rtext g_glist_getrtext;

// This used to be in s_stuff.h, but not anymore since 0.55.1test1.
int sys_trytoopenone(const char *dir, const char *name, const char* ext,
char *dirresult, char **nameresult, unsigned int size, int bin);
Expand Down Expand Up @@ -1315,7 +1320,7 @@ static int pdlua_set_arguments(lua_State *L)
if (redraw) {
// update the text in the object box; this makes sure that
// the arguments in the display are what we just set
t_rtext *y = glist_findrtext(o->canvas, x);
t_rtext *y = g_glist_getrtext(o->canvas, x);
rtext_retext(y);
// redraw the object and its iolets (including incident
// cord lines), in case the object box size has changed
Expand Down Expand Up @@ -3042,7 +3047,7 @@ void pdlua_setup(void)
#endif
post(luaversionStr);

// multichannel handling copied from https://github.com/Spacechild1/vstplugin/blob/3f0ed8a800ea238bf204a2ead940b2d1324ac909/pd/src/vstplugin~.cpp#L4122-L4136
// compatibility handling copied from https://github.com/Spacechild1/vstplugin/blob/3f0ed8a800ea238bf204a2ead940b2d1324ac909/pd/src/vstplugin~.cpp#L4122-L4136
#ifdef _WIN32
// get a handle to the module containing the Pd API functions.
// NB: GetModuleHandle("pd.dll") does not cover all cases.
Expand All @@ -3052,13 +3057,28 @@ void pdlua_setup(void)
(LPCSTR)&pd_typedmess, &module)) {
g_signal_setmultiout = (t_signal_setmultiout)(void *)GetProcAddress(
module, "signal_setmultiout");
g_glist_getrtext = (t_glist_rtext)(void *)GetProcAddress(module, "glist_getrtext");
if (!g_glist_getrtext)
g_glist_getrtext = (t_glist_rtext)(void *)GetProcAddress(module, "glist_findrtext");
}
#else
// search recursively, starting from the main program
g_signal_setmultiout = (t_signal_setmultiout)dlsym(
dlopen(NULL, RTLD_NOW), "signal_setmultiout");
g_glist_getrtext = (t_glist_rtext)dlsym(
dlopen(NULL, RTLD_NOW), "glist_getrtext");
if (!g_glist_getrtext)
g_glist_getrtext = (t_glist_rtext)dlsym(
dlopen(NULL, RTLD_NOW), "glist_findrtext");
#endif

// check if g_glist_getrtext was loaded successfully
if (!g_glist_getrtext) {
pd_error(NULL, "pdlua: failed to load pd's glist_getrtext/glist_findrtext functions");
pd_error(NULL, "pdlua: loader will not be registered!");
return;
}

pdlua_proxyinlet_setup();
PDLUA_DEBUG("pdlua pdlua_proxyinlet_setup done", 0);
pdlua_proxyreceive_setup();
Expand Down
Loading