Broke music control out into a new class, in preparation for JavaScript music interface. As a side effect, mission music should work on SDL builds, and the theme music should loop. I hope. As another side effect, it’s now possible to add a music/sound file, “OoliteDocked.ogg”, to be automatically played when docking. Music played from JavaScript will override this.
The behaviour of Ootunes (OS X only) and the docking music key will be changed. Previously, the Ootunes setting was stored on a per-file basis, while the docking music setting was a global preference which was toggled each time you pressed the key. In 1.71, Music Mode (Off/On/iTunes, with iTunes being available only on OS X) will be a global setting, and the docking music key will start/stop music in the On mode only.
Edit: implemented JavaScript interface. (Gosh, that was quick.)
Code: Select all
Sound.playMusic("name.ogg") // If name.ogg is already playing, does nothing. Otherwise, stops currently playing music (if any) and starts name.ogg.
Sound.stopMusic("name.ogg") // stops only if name.ogg is playing
Sound.stopMusic() // stops any playing music