I’ll tell you what I did and I don’t seem to get errors, but can’t tell for sure since my daisy setup has been a pain and isn’t complete. I’m simply mimicking the current behavior, not doing anything smart.
In blockquotes below is all the new stuff I created.
audio.h:
typedef void (*CustomInterleavingAudioCallback)(InterleavingInputBuffer in,
InterleavingOutputBuffer out,
size_t size,
int myint);
This is just below the existing
typedef void (*InterleavingAudioCallback)(InterleavingInputBuffer in,
InterleavingOutputBuffer out,
size_t size);
audio.cpp:
In the Public declaration section at the top:
AudioHandle::Result StartCustom(AudioHandle::CustomInterleavingAudioCallback callback);
Below the existing
AudioHandle::Result Start(AudioHandle::InterleavingAudioCallback callback);
then
AudioHandle::Result
AudioHandle::Impl::StartCustom(AudioHandle::CustomInterleavingAudioCallback callback)
{
// Get instance of object
sai1_.StartDma(buff_rx_[0],
buff_tx_[0],
config_.blocksize * 2 * 2,
audio_handle.InternalCallback);
interleaved_callback_ = (void*)callback;
callback_ = nullptr;
return Result::OK;
}
Below the existing
AudioHandle::Result
AudioHandle::Impl::Start(AudioHandle::InterleavingAudioCallback callback)
{…
audio.h:
Result StartCustom(CustomInterleavingAudioCallback callback);
Below the existing
Result Start(InterleavingAudioCallback callback);
audio.cpp again:
AudioHandle::Result AudioHandle::StartCustom(CustomInterleavingAudioCallback callback)
{
return pimpl_->StartCustom(callback);
}
Below the existing
AudioHandle::Result AudioHandle::Start(InterleavingAudioCallback callback)
{
return pimpl_->Start(callback);
}
daisy_seed.cpp:
void DaisySeed::StartAudioCustom(AudioHandle::CustomInterleavingAudioCallback cb)
{
audio_handle.StartCustom(cb);
}
Below the existing
void DaisySeed::StartAudio(AudioHandle::InterleavingAudioCallback cb)
{
audio_handle.Start(cb);
}
daisy_seed.h:
void StartAudioCustom(AudioHandle::CustomInterleavingAudioCallback cb);
Below the existing
void StartAudio(AudioHandle::InterleavingAudioCallback cb);
daisy_pod.cpp:
void DaisyPod::StartAudioCustom(AudioHandle::CustomInterleavingAudioCallback cb)
{
seed.StartAudioCustom(cb);
}
Below the existing
void DaisyPod::StartAudio(AudioHandle::InterleavingAudioCallback cb)
{
seed.StartAudio(cb);
}
daisy_pod.h:
void StartAudioCustom(AudioHandle::CustomInterleavingAudioCallback cb);
Below the existing
void StartAudio(AudioHandle::InterleavingAudioCallback cb);
Finally, in your .cpp project file
void AudioCallbackCustom(AudioHandle::InterleavingInputBuffer in,
AudioHandle::InterleavingOutputBuffer out,
size_t size,
int myint)
{…
and also change the call in
int main(void)
to
pod.StartAudioCustom(AudioCallbackCustom);