Has anyone noticed sometimes audio playback using AudioTransportSource will be delayed ~1 second before it actually starts to play? 4 out of 5 times there is no delay it plays instantly, but randomly it will occur if you keep restarting the software.
This happens in my personal application as well as the Juce File Playback demo, the Latency Detector demo, and The Synthesizers demo. I was able to reproduce this issue on both Windows 7 and 10 and on separate systems so it appears to be a bug, I have not yet tested it on other platforms.
You can test it yourself by restarting the JuceDemo until it occurs. Just play any audio file and eventually you will notice the delay if you listen closely or look closely at the waveform. This bug was present in older versions of Juce so I updated today hoping it would be fixed but it is still present in this version.
It doesn’t matter if I use DirectSound, Windows Audio or ASIO, the result is always the same. I tried to detect the delay in code with no success, getCurrentPosition() and getNextReadPosition() always increments as if there was no delay. It can only be heard audibly.
It seems consistant its always around 1 second when it happens but I have no idea how to compensate for it. I thought maybe AudioTransportSource.setSource was causing the problem, so I tried changing the readAheadBufferSize and the sourceSampleRateToCorrectFor, and using no background thread but to no avail.
I can’t be the only one experiencing this, someone must know a solution but I can’t find anything in the forums. The only thread I could find is 5 years old and seems unrelated: Slight delay in looping audio files using AudioSource
Hopefully someone can offer some advice. Tom