This fixes a problem with the Lands of Lore character selection music. Due to
pitch bend events at the end of the track, two instruments go out of tune when
the track loops. This occurs in both MT-32 and GM tracks, but in GM the pitch
bend is smaller, so it is not very noticable. Westwood fixed this in the CD
version for MT-32 only. This fixes it for MT-32 floppy and both GM versions.
Apparently, as I have been told, there are (still) OS'es with non-compositing window managers which may cause glitches when drawing windows over the ScummVM window, unless the engine keeps updating the screen. So, now we do that, even if there isn't any actual on-screen activity. The whole thing is a bit more tricky than it would appear at first glance, since one misplaced/untimely screen update may cause palette glitches. I have implemented a timer which is reset whenever actual on-screen activity happens. That should work around any such glitches.
Maybe the rates for the timer have to be tweaked some more. I have also added an ifdef so this could be disabled or restricted to certain platforms if required.
Starting a sound effect will lock up the mixer thread in a mutex until the sound effect has been loaded and initialized. Which means the music may be disrupted if that period is too long. This commit tries to speed up the process...
We use the same method for finding both the unpacked Legend of Kyrandia
executable and the Legend of Kyrandia installer, so there's no need for
duplicate code.
Now that the audio drive uses the same StuffIt archive as the rest of
the engine (thanks for the help with that!), it no longer needs to
verify that the installer file is present.
The flute will terminate the current background music (verified with emulator), since the flute sound is actually a song itself. This change makes sure that the music restarts when leaving the screen...
Once an executable has been found, break out of both loops. (I had
renamed mine to use an UTF-8 trademark glyph, and it was found in the
first code page. Not in the second.)
The LoK/Mac sound class was accidently declared inside the ENABLE_EOB ifdef. I don't know whether the riscos build don't have EOB enabled, but this is at least a possible issue that I can see..
I put this in an extra commit, since I really can't foresee how this is going to build on certain platforms. I have tested MSVC, GCC and clang, but still...
- The high quality music seems to work fine. I haven't done any extensive comparison with emulation, but all music tracks have been played with asan enabled. I haven't actually finished playing through the game, though (still stuck in the damn fireberry cave), so the finale still needs to be tested...
- I am not sure about the low quality music. It should work, but hasn't really seen much testing. Currently, I don't have any way to switch to the low quality music anyway. Maybe I'll add a launcher option for it.
- The 16bit mode I have been trying to invent doesn't work. Priority was finishing the original sound first.
- GMM volume settings haven't been fully implemented and don't work
Call the opcode functions with a pointer to the parameters instead
of data poiner reference and first parameter. The data pointer is
updated in AdLibDriver::executePrograms() before calling the opcode
function; an opcode can change channel.dataptr if (and only if) it
wants to jump (and is responsible not to change it inadvertently).