I believe this issue should be a problem for any MemoryMapped file (not only audio) but audio is a tricky case if you want to avoid locks and stuttering
I’ve tried MemoryMappedAudioFormatReader and it works quite well for my needs.
However one stability test I do is:
- Map a file from removable media (hard-drive connected with USB).
- I map a WAVE file from ExFAT parition.
- Play audio and during playback remove the drive physically.
(pulling the cable, yep… nasty but so is coffee spilled on keyboard and it still happens… - yet to me though… )
I saw this under Win/macOS (macOS Sierra was the most reproducible so far).
juce::MemoryMappedWavReader::getSample(long long, float*) const + 351 (juce_WavAudioFormat.cpp:1514)
with juce_ByteOrder pulling some invalid address.
one more thing, we’ve made a watchers for media using atomic file-state but I guess since this is async it does fail in some cases.
I’ve tested Pro Tools 12.7.1 and it got stuck on some lock,
Ableton survived well (but failed to relink once media was available again).
Traktion (mmm… Waveform) crashed and I guess it’s using the exact code.