I have successfully managed to embed libpd into a project I'm working on, however in testing with even the most rudimentary patches, I'm getting: "error: ... couldn't create" on simple things (metro and dac~ being good examples).
I assume this is due to the fact that libpd isn't loading the external modules that define these blocks. How can I get the library to load these externals?
Also, when setting up a receiver for a signal message in my patch, it doesn't seem to receive anything. I have an absolute minimum patch as follows:
[osc~ 440]
|
|
|
[s~ toCPP]
Yet the following code:
class PdRec : public pd::PdReceiver
{
public:
void receiveFloat(const std::string & dest, float num)
{
std::cout << "Received float from: " << dest << " : " << num << std::endl;
}
}
pd::PdBase pdEngine;
pdEngine.init(1,1, 44100);
pdEngine.addToSearchPath("path/to/my/pd_patches");
pd::Patch patch = pdEngine.openPatch("test.pd", "path/to/my/pd_patches");
PdRec pdRec;
pdEngine.subscribe("toCPP");
pdEngine.setReceiver(pdRec);
pdEngine.computeAudio(true);
float inbuf[64], outbuf[64];
for(int i = 0; i < 10 * 44100 / 64; i++)
{
pdEngine.processFloat(1, inbuf[0], outbuf);
}
does not seem to receive anything from the patch. I am, however, able to receive the aforementioned error messages, as well as print commands from the patch if I use polling (but still none of the [s~ toCPP] messages).
What am I doing wrong?