Any idea why this doesn’t play the file from the beginning? It seems to only want to start half way through. The URL is an mp3.
MainContentComponent::MainContentComponent()
{
setSize (600, 400);
audioDeviceManager.initialiseWithDefaultDevices(0, 2);
AudioFormatManager audioFormatManager;
audioFormatManager.registerBasicFormats();
auto inputStream = url.createInputStream(false);
auto bufferedInputStream = new BufferedInputStream(inputStream, 1024 * 128, true); // required otherwise createReaderFor doesn't work!
auto reader = audioFormatManager.createReaderFor(bufferedInputStream);
readerSource = new AudioFormatReaderSource(reader, true);
transportSource = new AudioTransportSource();
transportSource->setSource(readerSource);
startTimer(2000);
player.setSource(transportSource);
audioDeviceManager.addAudioCallback(&player);
}
void MainContentComponent::timerCallback ()
{
transportSource->setPosition(0);
transportSource->start();
}
