MobMuPlat icon indicating copy to clipboard operation
MobMuPlat copied to clipboard

adding 3rd party externals to MobMuPlat

Open batchku opened this issue 8 years ago • 3 comments

Hi Daniel, Moving the email discussion here for clarity (mark down) and posterity.

I think i've quite close here. I'm following your recommendation; my external is called "resonators~":

  • i've cloned your MobMuPlat repo within my repo as a submodule and i've pulled in the libpd and pdparty submodules.
  • i created a subfolder for my exteranl's .c file and it's helpfile in "libpd/pure-data/extra"
  • i added the name of this subfolder to "libpd/pure-data/extra/Makefile.am"
SUBDIRS=bob~ bonk~ choice fiddle~ loop~ lrshift~ pd~ pique sigmund~ stdout resonators~
  • i added my externals set-up function in two places in "libpd/libpd_rapper/z_libpd.c"
// (optional) built in pd externals setup functions
#ifdef LIBPD_EXTRA
  void bob_tilde_setup();
  void bonk_tilde_setup();
  void choice_setup();
  void fiddle_tilde_setup();
  void loop_tilde_setup();
  void lrshift_tilde_setup();
  void pique_setup();
  void sigmund_tilde_setup();
  void stdout_setup();
  void resonators_tilde_setup();  //added by ali
#endif

and

#ifdef LIBPD_EXTRA
  bob_tilde_setup();
  bonk_tilde_setup();
  choice_setup();
  fiddle_tilde_setup();
  loop_tilde_setup();
  lrshift_tilde_setup();
  pique_setup();
  sigmund_tilde_setup();
  stdout_setup();
  resonators_tilde_setup();  //added by ali
#endif

My only question is: The last time i was doing this, i also had to add a line near the top of "MMPViewController.m" like this:

extern void expr_setup(void);
extern void bonk_tilde_setup(void);
extern void choice_setup(void);
extern void fiddle_tilde_setup(void);
extern void loop_tilde_setup(void);
extern void lrshift_tilde_setup(void);
extern void sigmund_tilde_setup(void);
extern void pique_setup(void);
extern void resonators_tilde_setup(void);  //added by ali

However, in the current version of MobMuPlat, "MMPViewController.m" no longer lists any of those externals. Is that because those externals are now included in pd 0.47.1?

batchku avatar Jan 20 '17 23:01 batchku

Update:

It is not necessary to add anything to "MMPViewController.m". In order to include additional externals, only changes to "libpd/pure-data/extra/Makefile.am" and "libpd/libpd_rapper/z_libpd.c" are necessary. I am successfully running a 3rd party DSP on my iPhone now.

-ali

batchku avatar Jan 21 '17 04:01 batchku

I'm now trying to repeat this process (of adding 3rd party externals) for Android and am running into troubles; it seems that the core pd engine on the android side is pre-built and binaries for the 3rd party externals are included in your repo.

Can you recommend a way to add 3rd party externals to the Android build?

batchku avatar Feb 04 '17 20:02 batchku

Oops apologies for delay. When using the normal distribution of libd for android, it does indeed use a prebuilt binary in a remote repository, which has only the built-in objects. You'll have to instead set up a build of libpd and pure data as local dependencies, add the object code to the externals folder, and recompile using the NDK (which should output a series of .so files. Note that I heard there have been changes to NDK/C/C++ support within Android Studio recently, so this process may have changed).

monkeyswarm avatar Apr 22 '17 17:04 monkeyswarm