Wav file playback with AudioTransportSource + getNextAudioBlock() [SOLVED]


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)

    auto pos = transportSource.getCurrentPosition();
    if (pos > m_switchAt) {


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?


It seems I have to just implement my custom AudioSource just as in AudioAppComponent but remove the Component inheritance.

So I took the AudioAppComponent class and removed Component inheritance, called setAudioChannels(2,2) in the ctor, called shutdownAudio() in the dtor and everything is working.

After I instantiate MyAudioSource, audio is flowing.