Difference between revisions of "LibPD and externals"

From CCRMA Wiki
Jump to: navigation, search
m
m
 
Line 6: Line 6:
  
 
  http://createdigitalnoise.com/discussion/1986/reson-cyclone-with-libpd-and-android
 
  http://createdigitalnoise.com/discussion/1986/reson-cyclone-with-libpd-and-android
 +
 +
https://github.com/libpd/pd-for-ios/wiki/ios
 +
 +
Using compiled C-language Externals on iOS
 +
 +
Because iOS does not support dynamic libraries it is necessary to compile and statically link any C-language Pd externals in with your iOS app. It is also necessary to explicitly initialize any such external before it can be used from a Pd patch. This registers the external objects as available to Libpd.
 +
 +
For example, to use the C-language external lrshift~ with an iOS app. Add lrshift~.c to your project (it is located in the extra folder along with the Libpd source). Then call the lrshift_tilde_setup() function after initializing Libpd.
 +
 +
extern void lrshift_tilde_setup(void);
 +
 +
- (BOOL)application:(UIApplication *)application
 +
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
 +
    pdAudioController = [[PdAudioController alloc] init];
 +
    [pdAudioController configurePlaybackWithSampleRate:44100
 +
        numberChannels:2 inputEnabled:YES mixingEnabled:NO];
 +
    lrshift_tilde_setup();
 +
    ...
 +
}

Latest revision as of 13:21, 3 December 2014

"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."
- https://github.com/libpd/libpd/wiki/misc
"All Pd assets (patches, audio files, text files, externals) must be placed in Assets > StreamingAssets > PdAssets. libpd will not be able to find any of the resources in a build if the assets are placed in another folder."
- http://twobigears.com/labs/unity-and-libpd/
http://createdigitalnoise.com/discussion/1986/reson-cyclone-with-libpd-and-android
https://github.com/libpd/pd-for-ios/wiki/ios 

Using compiled C-language Externals on iOS

Because iOS does not support dynamic libraries it is necessary to compile and statically link any C-language Pd externals in with your iOS app. It is also necessary to explicitly initialize any such external before it can be used from a Pd patch. This registers the external objects as available to Libpd.

For example, to use the C-language external lrshift~ with an iOS app. Add lrshift~.c to your project (it is located in the extra folder along with the Libpd source). Then call the lrshift_tilde_setup() function after initializing Libpd.

extern void lrshift_tilde_setup(void);

- (BOOL)application:(UIApplication *)application 
   didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   pdAudioController = [[PdAudioController alloc] init];
   [pdAudioController configurePlaybackWithSampleRate:44100
        numberChannels:2 inputEnabled:YES mixingEnabled:NO];
   lrshift_tilde_setup();
   ...

}