Play a new source when a positionnable source has reached its end


Excuse me if the problem may seem stupid, as I have relatively little experience with programming.

Let's suppose I have an object containing a positionnable source and a pointer to another object containing the positionnable source that is to follow. It would be a linked list of positionnable sources. I'd want the next source to take over when the current one has reached its end.

I'm not sure about what is the right way to do this. 

I used the audio application preset of Introjucer. I achieved the result by putting in the main component's getNextAudioBlock a condition that checks source's hasStreamFinished() method. It works, but I'm affraid there are some big underlying problems.

Also, I'm sorry for my English if it is not clear enough.