I’m trying to write a playback engine that can play tracks, clips on a global transport. I searched the JUCE classes and the
AudioTransportSource seems to be the best class to play back audio files at a given position (transport). The problem is that this class can only 1 audio file and it doesn’t sync to a global transport. Instead it comes with a transport and also play/stop functions. This class seems to be more suitable to play back just 1 file, not in the context of a DAW. However, this class does come with some great features such as loading the file on a thread and resample it to the correct sample rate.
Then there is the
MixerAudioSource which allows multiple
AudioTransportSource objects to be played back together. However, this doesn’t seem to solve the problem that there is no global transport.
I feel like I’m missing an obvious solution… can anyone point me to it? (please don’t suggest Tracktion Engine, I’m aware that is one of the possible solutions, but I’m first trying to solve it with JUCE).
I don’t think there’s any way to escape the fact that JUCE is for the lower-level audio work, and Tracktion is a level higher in abstraction, and after all - loading clips and playing to sync is exactly what Tracktion is designed to do.
Even if you don’t want to use Tracktion (you really, really should use it for this situation, it rocks hard!) you should still look at the Tracktion code to see how it uses JUCE to solve the same problems you are describing.
But yeah, just use Tracktion.
Can Tracktion safely be used in an audio plug-in?
Yes, Tracktion can be used in an audio plugin. There is even an example included with the Tracktion code. Download and try it out!
I thought it wasn’t easy or possible to implement it in a plug-in but maybe that was in the old days…
Although I asked you not to suggest Tracktion Engine, I guess after your replies I feel like it might be the best way or other wise I’ll have to write a lot of custom code myself.
As already mentioned, even if you decide to write your own code, you can use Tracktion Engine as a guide to what is needed.
Good luck with your code!
Yes, I concur - Tracktion is a pretty great way to learn JUCE.
BTW, if you need a nice Tracktion project for reference, check out FundamentalFrequency’s LMN-3-DAW project, which is very nice: