Been taking some time again this weekend (while working on the new
Audiobulb tape edition!) to keep moving bits of the current
(soon-to-be-old) standalone astrid-seq,
astrid-dac and astrid-adc into library
functions in astrid.c.
The first steps of this were setting up wrappers for the jack callback.
These set up jack and take the instrument callback and wrap it in the
real jack callback. That’s a fair bit of what the current
adc and dac programs do, but the
dac program also (and this is its main job in current
astrid) has an extra thread that listens for serialized buffers to
arrive from an associated renderer program. When deserialized, these
buffers are placed into the astrid scheduler queue for playback and
mixing in the jack callback.
There’s also the astrid-seq program. This program basically
exists to schedule astrid messages.
It’s a weird situation, maybe, but I think it helped me develop each piece in isolation even if these pieces might not be used anymore, they’ll likely stick around for a while at least for development.
For example there’s a single well-known message queue for the
astrid-seq program that all instruments relay their
sequences through now. If they all embed a message sequencer, then
astrid can standardize on all messages being sent to instrument message
queues, including messages scheduled for the future.
I like this because it means astrid can just be a single instrument.
That instrument could (once these new interfaces are exposed via cython)
be a single python file run simply like python
myinstrument.py or anything that uses these components via
libpippi and astrid C interfaces directly: like the
astrid-pulsar program in progress for rain.
Currently all the pieces of astrid are orchestrated by a console script which starts the programs in the background, sends commands to instruments and etc etc. This console script can be moved into library functions mostly, too. If it’s readline-based (actually, I like antirez’s readline replacement) and astrid C implements the REPL, both programs can optionally expose a command interface, or the standalone console interface could be implemented as a new special program.
The nice thing is because these things are already set up to be
independent components with any number of instances talking to each
other (the seq program was designed to run as a single
instance, but the dac programs are meant to just be
abstract outputs and currently support multiple instances for
multichannel routing) then in their library form, these features can be
picked and chosen from for each instrument, while still only needing to
know instrument names to be able to communicate with any other
instrument. (Some kind of registry to discover running instruments would
be good, too. This could probably just be a directory filled with all
their filesystem message queue handles.)