[PD-dev] Multiple Instance of pdlib

IOhannes m zmoelnig zmoelnig at iem.at
Mon Feb 24 09:50:48 CET 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 2014-02-23 20:46, Dan Wilcox wrote:
> Any further updates on this front? If a consensus is made, we could
> outline a roadmap and move to the task of implementation. At this
> point, I think breaking externals would be less of an issue if said
> breakage would be manageable via about find/replace. I'd be willing
> to handle that, at the least.

i was going to ask something along these lines as well, but more libpd
specific:
when i (last) looked into the libpd API, i noticed that libpd works on
a global namespace as well...what i mean is, that the API (at least
the C-API, i haven't checked the others) does not allow to specify an
"instance" of pd.

the current API looks like:

<snip>
void libpd_init(void);
int libpd_process_float(int ticks, const float *in, float *out);
// ...
</snip>

obviously with this API it will *never* be possible to initialize
multiple instances of libpd.
so i would have expected something along:
<snip>
typedef struct libpd_ libpd_t;
libpd_t*libpd_init(void);
int libpd_process_float(libpd_t*instance, int ticks, ...);
// ...
libpd_deinit(libpd_t*instance);
</snip>

now obviously we *currently* cannot have multiple instances of pd
(afaiu, that's what dan's question is about).
but i fail to see why libpd doesn't provide the API for this, even if
the "instance" pointer would not be used (until Pd does support
multiple instances).

e.g. the application programmer would have to check that libpd_init()
returns non-NULL anyhow, and in the current implementation it would
always return NULL but the first time being called.

this would have allowed for a transition to multiple instances without
having to change the API...


ghsdft
IOhannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBCAAGBQJTCwfjAAoJELZQGcR/ejb4uDsQAIrdZNgHX4zFytnGCjeG/PkB
UVbyXLy6EJwLNd15sFcO1u9VG6LWWC3LB7pSmw5DDoGhpnVcr4vCtNtRNX1hLFqy
n8WAI8IKyzioQlno1ed29Cjb9T0n2IKHZryHqPTobukURKmAWh4ZwQxGe7yM8AbM
6e+KyZb3JZHb7IVbf6DqqnPlb9hlLz7TP7f5SgDzY0TJGAbmSsfLha1SVoblZjY5
VzEQ3jl3rhblmWVmEFmHDR+LIBCJkKwGmPG0r3N8dbhvMFMFWVFtZCEKujbStvzz
cKvzjtgwtEL6n3kcw2eRHttCpZOnGsd/RW59r/68Pa+a2UvOhKdff0MELUSqm2Iu
rOjwl58mBtkXdtrqlgNPu2ZmdSNmwaw8OJizz2ttlX+r1CiBQPhEAzmRDYdtMN4V
QTDad5wKCW4l/eaSTX4+z/Dn3qZJ9X6CmQjc+fX2OgrTnWPe1P1Q0FpZ4ZuVHbGB
DYdFD5dJp/DU2OygQg6MO4h25VfalQ++MAujC5EPUxKkXZjOAsS8Nt29EFgC7mCc
QLeB/zlGbRNI7iRfrHI6zWANuPIvLuomHmhnc1UhkLZNPxFJ+GVkEfK+nyWq+rEG
n7751NYxGOdI5D8X3CZHuVOmmlRAqBceaEkH0gtJumr/o2k/GvN8kWjKQFSCncuc
/phnie1+8fSV7MlZ1rVr
=wrR6
-----END PGP SIGNATURE-----



More information about the Pd-dev mailing list