In general, the operation of ZenGarden is very straightforward. A graph is created. It is processed. And it is destroyed when it is no longer needed. Graphs can currently only be created by reading a given Pd-format file. Processing a graph is the only way to advance time, whether audio is computed or not. ZenGarden is single-threaded and not thread-safe. It is also possible to register a callback function with each ZenGarden graph instance. This function is the primary means for a graph to communicate to the “outside world”. It includes things like indicating that a message should be printed (either to standard or error out), or responding to a system, i.e. “pd” e.g. “pd dsp 0”, command.
Though ZenGarden is written in C++, the interface that it outwardly exposes is C-based. This interface is defined in ZenGarden.h. A C-based API makes it easy to integrate ZenGarden into C, C++, and Objective-C projects. An example of this interface in action can be found in the JNI wrapper.
A Java-based interface is also available. The
ZenGarden class encapsulates a graph, and objects implementing the
ZenGardenListener interface can be registered in order to receive callbacks from the graph. This interface can be easily imported by adding
ZenGarden.jar to the classpath. An example of this interface in action can be found in the Java example.