172 Commits

Author SHA1 Message Date
Michał Janiszewski
eed727474f AUDIO: Fix linking with vcpkg-provided FLAC 2020-07-15 15:30:55 +02:00
sluicebox
92b28e00ad AUDIO: Fix compiler warning 2020-04-11 03:30:35 -07:00
sluicebox
4ce7ae7bf5 AUDIO: Fix seeking past end of AIFF streams
Fixes audio in Mac versions of GK2 and PHANTASMAGORIA1
2020-04-11 03:06:41 -07:00
D G Turner
3959797b85 AUDIO: Fix Remaining Missing Default Switch Cases
These are flagged by GCC if -Wswitch-default is enabled.
2019-11-28 14:38:43 +00:00
D G Turner
28287d70b6 AUDIO: Fix Missing Default Switch Cases
These are flagged by GCC if -Wswitch-default is enabled.
2019-11-17 08:20:01 +00:00
SupSuper
8d17b6c48a AUDIO: Fix MSVC warnings
Fixes warning C4245: signed/unsigned mismatch
(seems in line with other decoders)
2019-05-09 18:13:10 +10:00
Torbjörn Andersson
9d94970c0f AUDIO: Fix compilation with Clang
Reported by angstsmurf.
2019-02-14 17:45:16 +01:00
Torbjörn Andersson
cc958f70ef AUDIO: Simplify _audioGain calculation
No need to explicitly set it to 1.0. (There may have been in an
earlier version, to avoid any possible rounding error. But if so,
that reason is long gone.)
2019-02-10 16:32:02 +02:00
Torbjörn Andersson
9785d5007a ZVISION: Boost volume for MPEG cutscenes
The high-resolution videos play back at much lower volume than the
original ones. This adds hard-coded values for how much to amplify
each cutscene. It's all done by ear, and it does introduce some
clipping, but I think it should be acceptable.

Of course, it could also be a problem with the audio decoder, so
this may be the wrong approach entirely.
2019-02-10 16:32:02 +02:00
Paul Gilbert
08db684864 GLK: Add support for secondary Blorb files separate from the gamefile
It also hads further support for playing AIFF files. However, the
Blorb files for Lurking Horror & Sherlock on the if-archive website
don't seem to be valid AIFF files, so sound doesn't play using them
2018-12-08 19:05:59 -08:00
Paul Gilbert
0cbd51641b GLK: FROTZ: Further sound handling 2018-12-08 19:05:59 -08:00
Torbjörn Andersson
6705b6df9e AUDIO: Add a separate AC-3 decoder
This code comes from clone2727's now defunct (?) ac3 branch.
2018-11-04 22:33:22 +01:00
Paul Gilbert
11e33ba3fc JANITORIAL: Removing trailing spaces after int casts 2018-08-17 20:30:20 -07:00
Colin Snover
e42ade073c AUDIO: Fix uninitialized data structures in PacketizedMP3Stream
If the audio thread called to readBuffer before any packet had been
added to the stream, the state of the stream would be changed from
INIT to EOS. Later, when a packet was received, the state would go
directly from EOS to READY, skipping decoder init, leaving garbage
memory in the decoder structs and causing a crash of the decoder.

Fixes Trac#9653.
2017-11-19 20:53:02 -06:00
Colin Snover
9fc24e19f2 AUDIO: Fix data race in PacketizedMP3Stream 2017-11-19 20:53:00 -06:00
Bastien Bouclet
1757f7dc5d AUDIO: Switch to BitStreamMemoryStream in the QDM2 decoder 2017-11-08 20:57:35 +01:00
Bastien Bouclet
bf3c98815f AUDIO: Add some padding to the QDM2 decoder input buffer
Fixes out of bounds reads in the Myst ME intro videos.

OOB reads may happen because:
- The bitstream implementation reads 4 bytes at a time, and the buffer
  size is not guaranteed to be a multiple of 4.
- The huffman parsing code reads a fixed amount of bits when it
  sometimes needs not all of them.

Also fixed bits vs bytes mismatch for the size parameter of the calls to
the bitstream constructor, and removed a few unnecessary heap
allocations.

Fixes #10220.
2017-11-08 20:57:24 +01:00
Bastien Bouclet
9db2953ca3 AUDIO: QDM2: Use the shared int64 type instead of a custom one 2017-09-30 21:35:16 +02:00
Bastien Bouclet
3eb82462e7 ALL: Specify the DisposeAfterUse constructor argument for dynamic memory write streams 2017-09-22 07:06:21 +02:00
Bastien Bouclet
8547c89b86 VIDEO: Change QT edit list to a Common::Array
And fix an out of bounds acces when seeking to the end of a video.
Skipping samples is needed even when seeking through silent edits
because a silent stream is queued for those.

Fixes #10219.
2017-09-21 13:06:18 +02:00
Colin Snover
dbf2f0c266 AUDIO: Fix compilation on AmigaOS 4 2017-09-10 02:08:21 -05:00
Colin Snover
10db6e9a44 AUDIO: Mark SCI engine as using ADPCM 2017-09-09 23:29:58 -05:00
Colin Snover
41506201b9 AUDIO: Fix incorrect reading of DK3 ADPCM audio data
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.
2017-09-09 23:29:58 -05:00
Willem Jan Palenstijn
dde259f068 COMMON: Remove BitStream base class to allow inlining calls
All users of BitStream were in fact using a specific, hardcoded variant,
so we can hardcode that variant, removing the need for virtual calls,
and enabling inlining.
2017-08-24 19:46:59 +02:00
Paul Gilbert
7b10dac542 AUDIO: Support Wave files with an initial fact chunk 2016-12-20 22:47:49 -05:00
Torbjörn Andersson
579c024653 AUDIO: Keep packetized MP3 stream from ending prematurely
This fixes the audio in the intro AVI movie for German Fullpipe.
2016-09-19 07:25:55 +02:00
Paul Gilbert
7d0c83850c AUDIO: Whitespace fix in MP3 engine usage list 2016-09-03 09:58:50 -04:00
Paul Gilbert
4d11f2fbf0 AUDIO: Add Titanic to list of engines using MP3 decoder 2016-09-02 23:56:44 -04:00
Paul Gilbert
d7e52b4b50 AUDIO: Disable MP3 decoding in Wave files if MAD dependency is disabled 2016-09-02 23:54:55 -04:00
Paul Gilbert
417cc51bcb AUDIO: Add support for MP3 encoded data in WAVE files
This is needed for playback of Starship Titanic speech data
2016-09-02 21:32:32 -04:00
Paul Gilbert
b312c8fe9d AUDIO: Add titanic to list of engines using wave files 2016-08-05 19:19:17 -04:00
Willem Jan Palenstijn
567054d829 AUDIO: Fix build 2016-07-31 08:55:12 +02:00
Eugene Sandulenko
30498bfbf0 AUDIO: Fix indentation 2016-07-31 09:28:46 +03:00
Torbjörn Andersson
9382dab811 AUDIO: Fix audio corruption in MS ADPCM decoder
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.
2016-07-06 20:51:28 +02:00
Colin Snover
848abbee06 AUDIO: Fix incorrect forward declaration 2016-06-21 08:33:50 -05:00
Colin Snover
cbc3b773aa AUDIO: Make WAV streams seekable
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.
2016-06-19 14:48:33 -05:00
Eugene Sandulenko
33184e822d AUDIO: Plug potential memory leak 2016-05-15 12:26:15 +02:00
Ori Avtalion
3564032330 JANITORIAL: Reduce audio header dependencies 2016-04-14 16:10:21 +03:00
Tobia Tesan
914537ab52 JANITORIAL: Mark audio/decoders/vorbis as: used in Wintermute 2016-03-28 12:36:41 +02:00
Christian Krause
1fdeb98e70 AUDIO: Fix compiler warning
This commit fixes a compiler warning about a "set but not used"
variable. The warning was introduced by commit 2f707bf2.
2015-09-15 20:48:09 -04:00
Matthew Hoops
8165e9aa4c AUDIO: Fix uninitialized read in MP3 initialization
Thanks to chkr-private for finding the issue
2015-09-15 20:44:09 -04:00
Matthew Hoops
c8a7e39e05 AUDIO: Mark the old Codec class as deprecated
Once QuickTime audio edits are rewritten to use PacketizedAudioStream, we can remove this class.
2015-08-30 21:01:43 -04:00
Matthew Hoops
331d8ece21 AUDIO: Add a packetized version of ADPCM streams 2015-08-30 19:53:54 -04:00
Matthew Hoops
3aa9e2c581 AUDIO: Add a packetized version of the PCM stream 2015-08-30 19:53:54 -04:00
Matthew Hoops
562234b96b AUDIO: Implement a packetized version of MP3 2015-08-30 19:53:53 -04:00
Matthew Hoops
52f67cba39 AUDIO: Split the seeking MP3 class from the base decoding stream 2015-08-30 19:53:53 -04:00
Martin Kiewitz
10741d5bd6 AUDIO: makeAIFFStream seek to start of dataStream
fixes non working audio when playing a File(Stream)
2015-06-07 00:30:15 +02:00
Matthew Hoops
b6fdc7be88 AUDIO: Make makeAIFFStream return a RewindableAudioStream
All callers requiring SeekableAudioStream have been adapted by using dynamic_cast
2015-06-06 17:20:41 -04:00
Matthew Hoops
7eb663a45b AUDIO: Fix another syntax error 2015-06-06 17:14:24 -04:00
Matthew Hoops
1cea582152 AUDIO: Fix syntax 2015-06-06 17:13:21 -04:00