What is the difference between the two types of audio callback?

Found this in daisy_seed.h

/** Begins the audio for the seeds builtin audio.
the specified callback will get called whenever
new data is ready to be prepared.
*/
void StartAudio(dsy_audio_callback cb);

/** Begins the audio for the seeds builtin audio.
the specified callback will get called whenever
new data is ready to be prepared.
This will use the newer non-interleaved callback.
*/
void StartAudio(dsy_audio_mc_callback cb);

But no description of what the ‘non interleaved callback is’, nor can I work out which one is used by default in the various examples.

The difference between interleaved and non-interleaved is in the way the audio sample is returned to the callback. I attached a couple of pages from libdaisy_reference.pdf which can be found in the docs folder of the LibDaisy repo.

Yeah, exactly.

For an inline reference, the dsy_audio_callback (which will be renamed to AudioHandle::InterleavingAudioCallback) has it’s audio samples arranged like this:

{ L0, R0, L1, R1, . . . LN, RN }

While the dsy_audio_mc_callback (which will be renamed to AudioHandle::AudioCallback) has the audio samples arranged like this:

{
    { L0, L1, . . . LN },
    { R0, R1, . . . RN },
}

Where L and R are the stereo channel, and N is the total number of samples.

The latter of the two can be a bit more efficient for doing block processing on the audio since each channel’s data is a contiguous block of memory, but a lot of hardware codecs work using the interleaved format.

1 Like