Hi,
I am currently playing a wav file using AudioTransportSource and applying an effect in AudioAppComponent::getNextAudioBlock(). The application is a standalone application so I can derive the MainContentComponent from AudioAppComponent and have access to a getNextAudioBlock() to apply an effect.
Mainly I just jump to a different part of the wav file after a button is pressed by using transportSource.setPosition():
void getNextAudioBlock(const AudioSourceChannelInfo& bufferToFill) override
{
if (readerSource.get() == nullptr)
{
bufferToFill.clearActiveBufferRegion();
return;
}
auto pos = transportSource.getCurrentPosition();
if (pos > m_switchAt) {
transportSource.setPosition(m_switchTo);
}
transportSource.getNextAudioBlock(bufferToFill);
}
Now I want to no longer use a AudioAppComponent as I dont really need an UI.
Is there a substitute class for AudioAppComponent that also provides audio playback by repeated calls to its getNextAudioBlock(), but is not a component? In that, I want to put in the above getNextAudioBlock() implementation.
So basically I need a AudioAppComponent minus Component, but with all the other automatic connections to the speakers that makes it so convenient. I do not really want to setup a AudioProcessorGraph for this simple case.
I am trying out a custom AudioTransportSource:
AudioDeviceManager& audioDeviceManager { getSharedAudioDeviceManager (0, 2) };
AudioSourcePlayer audioSourcePlayer;
MyAudioTransportSource transportSource;
audioDeviceManager.addAudioCallback (&audioSourcePlayer);
audioSourcePlayer.setSource (&transportSource);
And now there would be calls to MyAudioTransportSource::getNextAudioBlock() as it derives from AudioTransportSource. But after the above code, how exactly do I get things going? Will the getNextAudioBlock() calls start immediately?