Right now, a few places in the frontend code still use printf and
consorts. We mark the affected files with a FIXME for now, and
add a dedicated exception for each. To be fixed!
Also tweak FORBIDDEN_SYMBOL_REPLACEMENT to hopefully really always
enforce a compiler error
- Split The Last Express' ADPCM to the engine. Using the MS IMA routine was really a hack.
- Fixed stereo MS IMA ADPCM, the old routine was completely wrong.
This also adapts our default implementation MixerImpl to handle the newly
added flags properly.
Now we do not need to set the sound volume for all types to 0, in case we want
to mute them, but instead just set the mute flag for all types to true. This
allows engines to be a bit more agonstic about mute support, when it comes to
volume options etc. since they can just setup any volume they like, but are
still muted (and thus will not break muting anymore).
MIDI sound is of course not affected by this.
There are tons of ADPCM variants out there, and it is impractical to
stuff them all into a single adpcm.cpp file. By exposing the internals,
engines can implement their ADPCM decoder variants more easily.
MKID_BE relied on unspecified behavior of the C++ compiler,
and as such was always a bit unsafe. The new MKTAG macro
is slightly less elegant, but does no longer depend on the
behavior of the compiler.
Inspired by FFmpeg, which has an almost identical macro.
Based on the SONiVOX® Embedded Audio Synthesis (EAS™) library, which is
part of the base Android OS.
CPU stats (Cortex A8 1GHz, monkey1 intro, peak values):
MAME OPL: 30%
DosBox OPL: 26%
EAS: 19%
This also should fix some regressions from the previous
commits, related to MidiParser's either being leaked,
or being deleted and then used again (i.e., crashing).
I tested as many games as I had available, but further
testing of all affected engines is called for anyway.
This code is currently not complete, but contains enough code to
allow several engines to switch their pseudo MidiDrivers to be
based on this class, greatly reducing code duplication.
The actual MidiDriver derives from it. MidiDriver_BASE only
provides the minimal API necessary for transmitting MIDI data.
The idea is that this is all MidiParser needs, thus allowing
us to simplify the various MidiPlayer classes in our engines.
This in turn enables modifying MidiDriver_MPU401::close() to allow
it to be called on a midi driver that has not yet been opened.
The specific issue that triggered me to make these changes was a
crash-upon-quit in HUGO, caused by it instantiating a midi driver,
then encountering an error (missing hugo.dat) *before* having
opened the new midi driver; the general cleanup code then tries
to close the (not yet opened) midi driver -> kaboom
Also fixed some engines which were leaking MidiDriver instances.
The RateConverter::flow result was never used, pipe it through
Channel::mix to MixerImpl::mixCallback, so backends can decide
if they want to waste cpu cycles while playing empty buffers.
This assertion was introduced with 633b8ed277. I change the code to first
convert all parameters to the audio stream's framerate to avoid a possible use
of operator- on two AudioTimestamps with different framerates.