|
59 | 59 |
|
60 | 60 | #include "pdlua_gfx.h" |
61 | 61 |
|
62 | | -typedef void (*t_signal_setmultiout)(t_signal **, int); |
63 | | -static t_signal_setmultiout g_signal_setmultiout; |
| 62 | +// function pointer type for signal_setmultiout (added with Pd 0.54) |
| 63 | +typedef void (*t_signal_setmultiout_fn)(t_signal **, int); |
| 64 | +static t_signal_setmultiout_fn g_signal_setmultiout; |
| 65 | + |
| 66 | +// function pointer type for glist_getrtext/glist_findrtext (changes with Pd 0.55-3) |
| 67 | +typedef t_rtext *(*t_glist_rtext_fn)(t_glist *, t_text *); |
| 68 | +static t_glist_rtext_fn g_glist_getrtext = NULL; |
64 | 69 |
|
65 | 70 | // This used to be in s_stuff.h, but not anymore since 0.55.1test1. |
66 | 71 | int sys_trytoopenone(const char *dir, const char *name, const char* ext, |
@@ -1314,7 +1319,7 @@ static int pdlua_set_arguments(lua_State *L) |
1314 | 1319 | if (redraw) { |
1315 | 1320 | // update the text in the object box; this makes sure that |
1316 | 1321 | // the arguments in the display are what we just set |
1317 | | - t_rtext *y = glist_findrtext(o->canvas, x); |
| 1322 | + t_rtext *y = g_glist_getrtext(o->canvas, x); |
1318 | 1323 | rtext_retext(y); |
1319 | 1324 | // redraw the object and its iolets (including incident |
1320 | 1325 | // cord lines), in case the object box size has changed |
@@ -3041,21 +3046,29 @@ void pdlua_setup(void) |
3041 | 3046 | #endif |
3042 | 3047 | post(luaversionStr); |
3043 | 3048 |
|
3044 | | -// multichannel handling copied from https://github.com/Spacechild1/vstplugin/blob/3f0ed8a800ea238bf204a2ead940b2d1324ac909/pd/src/vstplugin~.cpp#L4122-L4136 |
| 3049 | +// compatibility handling copied from https://github.com/Spacechild1/vstplugin/blob/3f0ed8a800ea238bf204a2ead940b2d1324ac909/pd/src/vstplugin~.cpp#L4122-L4136 |
3045 | 3050 | #ifdef _WIN32 |
3046 | 3051 | // get a handle to the module containing the Pd API functions. |
3047 | 3052 | // NB: GetModuleHandle("pd.dll") does not cover all cases. |
3048 | 3053 | HMODULE module; |
3049 | 3054 | if (GetModuleHandleEx( |
3050 | 3055 | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, |
3051 | 3056 | (LPCSTR)&pd_typedmess, &module)) { |
3052 | | - g_signal_setmultiout = (t_signal_setmultiout)(void *)GetProcAddress( |
| 3057 | + g_signal_setmultiout = (t_signal_setmultiout_fn)(void *)GetProcAddress( |
3053 | 3058 | module, "signal_setmultiout"); |
| 3059 | + g_glist_getrtext = (t_glist_rtext_fn)GetProcAddress(module, "glist_getrtext"); |
| 3060 | + if (!g_glist_getrtext) |
| 3061 | + g_glist_getrtext = (t_glist_rtext_fn)GetProcAddress(module, "glist_findrtext"); |
3054 | 3062 | } |
3055 | 3063 | #else |
3056 | 3064 | // search recursively, starting from the main program |
3057 | | - g_signal_setmultiout = (t_signal_setmultiout)dlsym( |
| 3065 | + g_signal_setmultiout = (t_signal_setmultiout_fn)dlsym( |
3058 | 3066 | dlopen(NULL, RTLD_NOW), "signal_setmultiout"); |
| 3067 | + g_glist_getrtext = (t_glist_rtext_fn)dlsym( |
| 3068 | + dlopen(NULL, RTLD_NOW), "glist_getrtext"); |
| 3069 | + if (!g_glist_getrtext) |
| 3070 | + g_glist_getrtext = (t_glist_rtext_fn)dlsym( |
| 3071 | + dlopen(NULL, RTLD_NOW), "glist_findrtext"); |
3059 | 3072 | #endif |
3060 | 3073 |
|
3061 | 3074 | pdlua_proxyinlet_setup(); |
|
0 commit comments