In miniaudio they used to add volatile to indicate that a variable can be changed by multiple threads but they removed it, change log "Add the MA_ATOMIC annotation for use with variables that should be used atomically and remove unnecessary volatile qualifiers."
They added a #define MA_ATOMIC that does nothing instead of using volatile. Why isn't the volatile qualifier necessary?
The repo: https://github.com/mackron/miniaudio
volatileis not so much optional as it is insufficient. And if you put in measures that are sufficient, such as protecting access via a mutex or using an atomic object, thenvolatiledoesn't provide anything useful on top.