OK, so. Oddly enough, I managed to get rid of the glitchy audio by changing line PureDataNode.cpp:54 from
mPdBase.processFloat( mNumTicksPerBlock, mBufferInterleaved.getData(), mBufferInterleaved.getData() );
mPdBase.processFloat( mNumTicksPerBlock/2, mBufferInterleaved.getData(), mBufferInterleaved.getData() );
and I suspect that
/2 should rather be
/getNumChannels(). This is how I set up the audio environment
auto ctx = audio::master();
auto format = audio::Node::Format().autoEnable().channels(2);
_pdNode = ctx->makeNode(new cipd::PureDataNode(format));
_patch = _pdNode->loadPatch(loadFile(_appBundlePath/"pd/player.pd"));
_pdNode >> ctx->getOutput();
Now, I feel like I should share my PD patch too, just to make sure I'm not going completely crazy.
Does anybody see anything obvious?
EDIT OK, scratch that. I tested this on a (rather old) device (an iPhone 5, in fact) and I had to revert to no division to get glitch-free audio. I was previously working on the iOS simulator. I'm more confused than ever. I'll test on an iPad later today and see how it goes. This seems rather hit-and-miss, though, so any further pointers to re-implementing my sampler in pure C++ / Cinder Audio are highly appreciated.