Age | Commit message (Collapse) | Author |
|
Previously, _topNibble was not reset at the beginning of a new
audio block, and the alignment byte at the end of odd blocks was
being read as audio data, which caused audible clicks and
out-of-bounds sample generation. There may have also been read
errors related to the use of continue/break keywords inside of a
macro wrapped with do-while(0).
The introduction of partial block reads in this code when it was
converted from ffmpeg to a ReadStream interface was also confusing
and somewhat inefficient (calling SeekableReadStream::pos
frequently), so this code has been refactored for clarity and to
improve efficiency by reducing the number of virtual calls. Error
detection has also been improved somewhat by ensuring that there
are enough bytes to read a block header, and that the step indexes
in the header are within the valid range.
|
|
Since _decodedSamples[] is filled with either 2 or 4 samples, we
can't use 1 - (count - 1) to "ensure that acts as a FIFO". When
we have 4 samples, that index will become negative, putting
uninitialized data into the buffer.
We could still use a similar trick, but I think it's much clearer
to use an index variable like this. We need an addition variable
either way.
|
|
This allows raw PCM in WAVE containers to have duration and be
seekable, and opens the door for ADPCM streams to be seekable later
if necessary.
This change is needed to avoid duplication of RIFF/WAVE container
parsing for SCI engine, which uses raw PCM WAVE files and needs to
be able to determine their lengths.
|
|
|
|
|
|
This also adds an omitted _decodedSampleCount initialization in Oki
ADPCM decoder.
|
|
|
|
|
|
Audio is now decoded in AudioStream classes instead of being decoded ahead of time and then queued.
|
|
|
|
of a dispose flag.
|
|
|
|
Some backends may break as I only compiled SDL
|
|
- 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.
|
|
|
|
|
|
IMA is really just the definition on how to decode a sample from a nibble, DVI is just a way for those nibbles to be stored in the stream.
|
|
|
|
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.
|