Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

API Overview

In this chapter, we will discuss the parts of libpd that are common to both Android and iOS, up to some minor concessions to language and idiom. Those parts include methods for opening and closing patches, for sending messages to and receiving messages from Pd, and for reading and writing arrays in Pd. That’s almost all of libpd, except for the most important parts, the methods that perform the actual audio processing. Musical apps will never call those directly; rather, they will use them by way of platform-specific audio glue.

In both Java and Objective-C, the low-level bindings for libpd are provided by a class called PdBase that is designed to be as small and thin as possible. Its methods are meant to preserve the flavor of old-school C programming that marks Pd itself. In particular, all methods of PdBase are static, and most of them don’t throw exceptions; if something goes wrong, they return a nonzero error code. In some cases, it may make sense to create a class that wraps PdBase in a more object-oriented way; this can be useful if you want to mock out the Pd components for testing, or if you want to provide high-level exception handling. Still, in the spirit of minimality, libpd refrains from introducing unnecessary layers of indirection.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint