There's really no need for a non-standard solution here anymore with C++11. This also fixes an unreleased lock in the WildMidi code.
Automatically optimized by CLion IDE with manual corrections
This was done after the players had already been created. To ensure that everything gets set properly it is necessary to pass the desired sample rate to the device's constructor and let it make sure that a proper sample rate gets set.