It’s pledge season again!
Edit: sorry to anyone following this RSS feed, I’m tweaking the GUID field structure today to support breaking cache on edits, but this probably also created copies of old entries in your reader! Apologies.
Async rendering in the new astrid instrument toolkit is working again! I wasn’t setting the instrument channel count early enough so the scheduler thought there were always 0 channels and happly chugged along mixing every frame and copying it to… no channels, lol.
Anyway, instruments can now optionally define a renderer callback that looks like this:
lpbuffer_t * renderer_callback(lpinstrument_t * instrument) {
lpbuffer_t * out;
syslog(LOG_DEBUG, "Reading soundfile in renderer callback...\n");
out = LPSoundFile.read("chimeC.wav");
syslog(LOG_DEBUG, "done reading got %d frames and %d channels...\n", (int)out->length, out->channels);
return out;
}
That just reads a chime sound from disk and returns a pointer to the buffer. At that point the scheduler owns the memory and will lazily free it (if the cleanup routine is run!) when the event has finished playing and has been moved back into the event nursery.
This doesn’t bring astrid C instruments up to speed with their python versions yet. There are still a number of interfaces I want to expose in the astrid api that are currently contained just in the cython renderer.
Once that’s better sorted, I can work on optionally embedding the cython renderer again. What I’d really like is to keep these renderers mostly agnostic to their environments. Meaning they are either mixed into the instrument output by adding a pointer directly to the scheduler from the C context, or they are serialized and sent over the buffer queue like the previous generation of astrid python instruments do. That opens up writing instruments in any language or environment as long as there is a proper serializer for the buffer…
Anyway, the chime sound is the async renderer and the rest is the new stream-based pulsar instrument I’ve been using as a test bed to work on the rain system: