Dan Wilcox edited this page Apr 22, 2015 · 2 revisions

Miscellaneous

Using externals

When dynamically loaded libraries are available, libpd will automatically load externals as needed, as long as the binaries are on the search path. When dynamic loading is not available, clients can have externals compiled into them and initialize them by calling the setup function after calling the libpd_init function.

In particular, iOS apps will have to have their externals compiled into them because dynamic loading is not available under iOS. On the other hand, loading externals works just fine on Android devices. Make sure not to put externals on the SD card because Android mounts the SD card with noexec. Any attempt to load externals from the SD card will fail with an obscure error message. I learned that the hard way...

The ScenePlayer sample app includes some externals from RjDj, and it illustrates how to build and package externals for Android.

Working with libpd

The Pd Java library illustrates how to work with libpd. The JNI file z_jni.c translates between C types and Java types. The Java class PdBase.java imports the functions of z_jni.c into Java and adds some higher-level functionality, such as thread synchronization, compound messages with a single method call, and bookkeeping for subscriptions to messages from Pd. The interface PdReceiver.java provides the basic functionality for receiving messages from Pd, and PdMidiReceiver.java does the same for MIDI events.

In addition to the core functionality, it may be desirable to build some utilities. For instance, the core Java library only accepts one receiver for Pd messages at a time. The utility class PdDispatcher.class implements the PdReceiver interface and manages a collection of handlers (instances of PdListener.java) for messages sent to individual symbols.

The Objective-C bindings are similar to the Java bindings, up to minor concessions to platform and idiom.

Creating patches for use with libpd

Patches for use with libpd do not use any objects that are specific to libpd; the custom message receiver objects for libpd are added implicitly and do not explicitly occur in the patch. Input and output of samples occur via adc~ and dac~, as usual. The workflow is straightforward: After you've chosen the send and receive objects through which your client code will control your patch, you simply build the patch with the usual GUI elements. Then you equip your GUI elements with the appropriate send and receive symbols, and your patch is ready to be deployed. A more detailed discussion of workflow issues is available here.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.