Skip to content

Commit

Permalink
fix multichannel check for _WIN32?
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-wes committed May 24, 2024
1 parent 73596f2 commit e230c3d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions simplex~.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,21 @@ static void *simplex_tilde_new(t_symbol *s, int ac, t_atom *av) {
}

void simplex_tilde_setup(void) {
// multichannel handling copied from https://github.com/Spacechild1/vstplugin/blob/3f0ed8a800ea238bf204a2ead940b2d1324ac909/pd/src/vstplugin~.cpp#L4122-L4136
#ifdef _WIN32
g_signal_setmultiout = (t_signal_setmultiout)GetProcAddress(GetModuleHandle(NULL), "signal_setmultiout");
// get a handle to the module containing the Pd API functions.
// NB: GetModuleHandle("pd.dll") does not cover all cases.
HMODULE module;
if (GetModuleHandleEx(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR)&pd_typedmess, &module)) {
g_signal_setmultiout = (t_signal_setmultiout)(void *)GetProcAddress(
module, "signal_setmultiout");
}
#else
g_signal_setmultiout = (t_signal_setmultiout)dlsym(dlopen(NULL, RTLD_NOW), "signal_setmultiout");
// search recursively, starting from the main program
g_signal_setmultiout = (t_signal_setmultiout)dlsym(
dlopen(NULL, RTLD_NOW), "signal_setmultiout");
#endif

simplex_tilde_class = class_new(
Expand Down

0 comments on commit e230c3d

Please sign in to comment.