Reduce abuse of the property function to set init vars.
Better distinction between drivers to prevent a GM init on
the Mac driver (which could happen depending on the
launcher sound setting).
This applies to the Mac versions of Loom and The Secret of Monkey
Island. There was a regression some years ago that caused the channel
data to be saved twice, and the instrument data never.
Unfortunately, this does nothing to fix the savegames that were broken
by the regression.
Now plays exactly the same as the original engines.
Notable changes:
- Switch to Audio::Paula from Player_MOD (which predated Paula).
- Music engine now works differently between Indy3 and Loom with regards
to the handling of overlapping notes and limited sound channels.
- Music (and some sound effects) now play in stereo.
- Music now overrides sound effects, as in the original games.
This is guesswork, but it seems like the first channel always contains a
complete rendition of the music. I think that's intended for low-end
Macs, while the other voices (four, but the last one never seems to be
used) is the standard version of the music.
It doesn't sound particularly good, and also not quite as with Mini vMac
(I'm not fully prepared to rule out emulation problems), but it seems
reasonably close.
This is one of the players that has had problems with deadlocks
recently. I'm not very well versed in threaded programming, but arthxx
has promised to fix up some more players later. This one was used as
proof of concept because it deadlocks a lot.
The main purpose of this set of changes is to refactor the code to make
it easier to pass the name of the Macintosh resource file to other parts
of the engine (it used to be hard-coded in the music players), and to
scale-up the graphics by 2.
The actual font rendering is almost completely broken.
There are two buffers when generating audio. The output buffer that
readBuffer() fills, and the sample buffer where new samples are
generated. The sample buffer is the larger of the two.
When readBuffer() is called, samples are copied from the sample buffer
to the output buffer. Usually it will copy some samples to the output
buffer, generate new ones to the sample buffer, and copy the remaining
ones needed to the output buffer.
At the end, the remaining samples in the sample buffer are moved to the
beginning of the buffer. It works out so that samples are always copied
from the beginning of the sample buffer to somewhere in the output
buffer.
But here's where things went wrong: If the sample buffer was not full,
but still contained enough samples to fill the output buffer, it would
still copy the last samples in the sample buffer. It should copy the
samples from right after the ones that had already been copied to the
output buffer.
I spent far too long beating my head against this bug, and I don't know
how well I've explained it here. But the audio corruption appears to be
gone now...
Foo
My commit 0e734722 causes lockups in SCUMM (sometimes) and SCI (very often). I didn't like the way I had fixed this before, but in the end I now had to do it in a similar way.
The audio track is not broken. LEC simply didn't make good euphony music tracks for the FM-Towns. There is nothing we can do about that.
The TODO implies that someone should mess around with the audio data (change the composition?).
- move mac, pc speaker and fm-towns ims sound drivers into separate directory
(AdLib and MT32/GM drivers are still too entangled with common code to be moved so easily, especially MT32/GM. It would require lots of changes to the common code and possibly to all engines using the MidiDriver class. So I leave that for now.)
In some cases the pointer returned is used directly without further
error checking.
As most instances already assert() in this case this commit simply
adds asserts where missing and deemed appropriate.
This fixes bug #7076 "LOOM: AdLib sound effect not stopped at Cygna's grave.".
Original SCUMM (I checked Monkey Island EGA) implemented Sound::isSoundRunning
by checking whether the sound resource of the requested sound id is locked. We
use actual sound state inside the player.