// ---------------------------------------------------------- makeconnection --- Handle makeconnection(const Arg args[], const int nargs) { if (!args[0].isType(StringType)) { die("makeconnection", "First argument must be a string giving " "connection type, e.g. \"mouse\", \"midi\"."); return NULL; } if (args[0] == "mouseX" || args[0] == "mouseY") { die("makeconnection", "New calling convention for mouse is (\"mouse\", \"X\", ...)"); return NULL; } Handle handle = NULL; #ifndef EMBEDDED const char *selector = (const char *) args[0]; char loadPath[1024]; const char *dsoPath = Option::dsoPath(); if (strlen(dsoPath) == 0) dsoPath = SHAREDLIBDIR; sprintf(loadPath, "%s/lib%sconn.so", dsoPath, selector); DynamicLib theDSO; if (theDSO.load(loadPath) == 0) { HandleCreator creator = NULL; if (theDSO.loadFunction(&creator, "create_handle") == 0) { // Pass 2nd thru last args, leaving off selector handle = (*creator)(&args[1], nargs - 1); } else { die("makeconnection", "symbol lookup failed: %s\n", theDSO.error()); theDSO.unload(); return NULL; } } else { die("makeconnection", "dso load failed: %s\n", theDSO.error()); return NULL; } #else // BGG -- create_handle() will invoke the RTInletPField stuff in control/maxmsp // We can't use the 'normal' create_pfield() because of conflict with // inletglue.cpp function (dyn loading keeps them separate, but we // don't dynlaod in max/msp) // same with create_pfbus_handle() if (args[0] == "inlet") { handle = create_handle(&args[1], nargs-1); } else if(args[0] == "pfbus") { handle = create_pfbus_handle(&args[1], nargs-1); } #endif // EMBEDDED return handle; }
// ---------------------------------------------------------- makeconnection --- Handle makeconnection(const Arg args[], const int nargs) { if (!args[0].isType(StringType)) { die("makeconnection", "First argument must be a string giving " "connection type, e.g. \"mouse\", \"midi\"."); return NULL; } if (args[0] == "mouseX" || args[0] == "mouseY") { die("makeconnection", "New calling convention for mouse is (\"mouse\", \"X\", ...)"); return NULL; } Handle handle = NULL; HandleCreator creator = NULL; const char *selector = (const char *) args[0]; // BGG mm -- in max/msp it is compiled-in, no dso loading /* char loadPath[1024]; sprintf(loadPath, "%s/lib%sconn.so", SHAREDLIBDIR, selector); DynamicLib theDSO; if (theDSO.load(loadPath) == 0) { if (theDSO.loadFunction(&creator, "create_handle") == 0) { // Pass 2nd thru last args, leaving off selector handle = (*creator)(&args[1], nargs - 1); } else { die("makeconnection", "symbol lookup failed: %s\n", theDSO.error()); theDSO.unload(); } } else { die("makeconnection", "dso load failed: %s\n", theDSO.error()); } */ // BGG mm create_handle() is going to invoke the RTInletPField stuff in // control/maxmsp // BGG mm // can't use the 'normal' create_pfield() because of conflict with // inletglue.cpp function (dyn loading keeps tehm separate, but we // don't dynlaod in max/msp if (args[0] == "inlet") { handle = create_handle(&args[1], nargs-1); } else if(args[0] == "pfbus") { handle = create_pfbus_handle(&args[1], nargs-1); } return handle; }