[PD] [libPD] Generation of patches

François Zajéga frankie at frankiezafe.org
Wed Apr 5 17:45:50 CEST 2017


Thanks for the quick reply!

Let's say i want to produce this patch:

#N canvas 404 128 765 600 10;
#X obj 10 10 osc~ 440;
#X obj 10 40 dac~;
#X connect 0 0 1 0;
#X connect 0 0 1 1;

I save somewhere an empty.pd containing only:

#N canvas 404 128 765 600 10;

I load it using:

libpd_openfile("empty.pd", ".");

Then I call something like:

libpd_symbol( "pd-empty.pd", ";\nobj 10 10 osc~ 440" );
libpd_symbol( "pd-empty.pd", ";\nobj 10 40 dac~;" );

// definition of libpd_symbol in z_libpd.h
// EXTERN int libpd_symbol(const char *recv, const char *sym);

And so on?

On 04/05/2017 03:03 PM, Miller Puckette wrote:
> You probably can't build up a patch from nothing at all, but at least you can
> add objects to an empty canvas - read the canvas from a file (say, "x.pd")
> and send messages to "pd-x.pd" to add objects to it, connect them, etc.
>
> cheers
> Miller
>
> On Wed, Apr 05, 2017 at 02:59:18PM +0200, François Zajéga wrote:
>> Hello to all,
>>
>> I'm currently bridging puredata and ogre3d via libpd. The whole project is a
>> game engine called polymorph (http://polymorph.cool)
>>
>> I have a question regarding patch generation.
>>
>> I can't find a way to send a patch to pd through a buffer. The only method i
>> found "libpd_openfile" but that requires creating an actual file on the
>> harddrive and passing the path to pd. I would need something like
>> "libpd_newpatch(char*)"...
>>
>> The idea is to be able to build a patch programmatically, on the c++ side,
>> and send it to pd without saving it as a file.
>>
>> Did anyone ever done something like that?
>>
>> Thank in advance!
>>
>> françois z.
>>
>>
>> -- 
>>   _
>> (__
>> | /_
>>
>> [made with http://www.network-science.de/ascii/]
>>
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list


-- 
  _
(__
| /_

[made with http://www.network-science.de/ascii/]




More information about the Pd-list mailing list