AudioTransportSource and AudioProcessor [solved]

Would someone mind casting an eye over this code and letting me know where I’m going wrong. I’m trying to stream some audio out of a plugin, actually for now I’m just trying to call getNextAudioBlock() without my plugin hanging. Do these source classes need their own processing threads? In which case should I always create a subclass of my source player. When their start method is called do they start a background thread to read samples? And if so what do you get each time you called getNextAudioBlock(). Apologies for all the questions but I have to admit I’m a little confused! In the posted code I try to call getNextAudioBlock() in my processBlock, but it just hangs each time. fileSource->start() is called with a button press in my plugin editor.

PlaybackPluginAudioProcessor::PlaybackPluginAudioProcessor():thread("audioThread")
{
   currentAudioFileSource = NULL;
   AudioFormatManager formatManager;
   formatManager.registerBasicFormats();  
   setupAudioFile("/home/rory/sourcecode/cabbage/Examples/banjo.wav");
}

//=============================================================================
PlaybackPluginAudioProcessor::~PlaybackPluginAudioProcessor()
{
   fileSource.setSource(0);
   deleteAndZero(currentAudioFileSource);
}

//=============================================================================
void PlaybackPluginAudioProcessor::setupAudioFile (String _audioFile)
{
    File audioFile (_audioFile);
	if(audioFile.exists())Logger::writeToLog("File exists");

    AudioFormatManager formatManager;
    formatManager.registerBasicFormats();   
    AudioFormatReader* reader = formatManager.createReaderFor (audioFile);
   
    if (reader != 0)
    {
        currentAudioFileSource = new AudioFormatReaderSource (reader, true);
        fileSource.setSource(currentAudioFileSource, 32768, &thread, reader->sampleRate, 1);
    } 
}

//=============================================================================
void PlaybackPluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
 	if(fileSource.isPlaying())
	fileSource.getNextAudioBlock(sourceChannelInfo);

    for (int channel = 0; channel < getNumInputChannels(); ++channel)
        float* channelData = buffer.getSampleData (channel);		

    for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
        buffer.clear (i, 0, buffer.getNumSamples());
}

Problem solved. I’ve attached source for the very simplest of audio file playback plugins in case anyone is interested.

I’d be interested to see it but I don’t see an attachment anywhere

Those attachments seem to have got eaten when Juce changed its forum. I’m afraid I no longer have the source code. If you are having an issue prepare a simple example and send it on. In my case I think I was just calling some things in the wrong order but I can’t recall for sure.