Commit Graph

536 Commits

Author SHA1 Message Date
Adrian Frühwirth
cee4d6b853 JANITORIAL: Fix trailing whitespace 2018-05-24 15:30:55 +02:00
Adrian Frühwirth
49116b4ae7 ALL: Use CLIP to clip volumes 2018-05-05 17:57:31 +02:00
Adrian Frühwirth
2d62b8efeb AUDIO: Silence compiler warning in Nuked OPL emulator 2018-04-21 01:24:21 +02:00
Adrian Frühwirth
9bee9e1ba6 JANITORIAL: Fix whitespace 2018-04-19 12:08:31 +02:00
Vincent Bernat
9edd8eff01 AUDIO: add support for OPL2LPT
The OPL2LPT is an OPL2 chip plugged on a parallel port. It is
write-only but otherwise acts as a classic AdLib. This commit adds
support for this device.

User is expected to have the right permissions on the parallel
port. By default, the first suitable parallel port is used. It is
possible to override that with the hidden configuration setting
"opl2lpt_parport".

It depends on the presence of the libieee1284 library which abstracts
a bit parallel port handling. An alternative would be to access
directly /dev/parportX on Linux. This would amount of code but it
would be Linux-only.

Tested with Indy 3 and SOMI.
2018-04-08 09:17:19 +02:00
Adrian Frühwirth
28a3faa178 AUDIO: Really fix constant type in Nuked OPL emulator 2018-04-07 14:41:06 +02:00
Eugene Sandulenko
b1d2d56198 AUDIO: Specify constant type in Nuked OPL emulator 2018-04-07 12:40:28 +02:00
Eugene Sandulenko
52fc7e34d8 CONFIGURE: Do not even try to build Nuked OPL when disabled 2018-04-07 12:22:18 +02:00
Eugene Sandulenko
7f6d431fe3 JANITORIAL: Add missing endline 2018-04-07 09:53:46 +02:00
nukeykt
b2052bc66f AUDIO: Add Nuked OPL3 core 2018-04-07 09:34:00 +02:00
Cameron Cawley
9111998c49 DS: Fix compilation with devkitARM r47 2018-04-07 09:30:07 +02:00
nukeykt
e5bfead345 SCUMM HE: Use Miles AdLib driver 2018-02-04 12:56:06 +01:00
Joseph-Eugene Winzer
eef9e18340 AUDIO: Fixes Protracker Portamento effect
.period overflowed if .portaToNoteSpeed > .period in the else if case
2018-01-21 23:03:12 +00:00
Tarek Soliman
50d79c5f26 MT32: Update to munt 2.3.0
This uses upstream commit 939cc986d9ffd044f8c6149361127ad5d94e430f

Closes gh-1091
2018-01-03 10:40:23 -06:00
Tarek Soliman
b8e4821a5a MT32: Remove executable flag from source files 2017-12-20 22:09:03 -06:00
Colin Snover
a5bc89102e ALL: Remove obsolete register keyword
The register keyword was deprecated from the C++11 standard,
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4193.html#809>,
and removed from the C++17 standard,
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4340>, so
cannot exist in a well-formed C++17 program.

It has never done anything in GCC
<https://gcc.gnu.org/ml/gcc/2010-05/msg00113.html>
and because of the way it is specified in the standard, it is “as
meaningful as whitespace”
<http://www.drdobbs.com/keywords-that-arent-or-comments-by-anoth/184403859>.

The one remaining use of the register keyword is in the DS backend,
where it is used to create a local register variable using the
non-standard GCC Extended Asm feature.

Closes gh-1079.
2017-12-03 20:27:42 -06:00
Colin Snover
d087c9605f BASE: Remove bad casts between incompatible Plugin types
Previously, a C-style cast was used to convert a
Common::Array<Plugin *>, populated with pointers to StaticPlugin
and DynamicPlugin instances, to a
Common::Array<PluginSubclass<T> *>, but PluginSubclass<T> is a
*sibling* class to StaticPlugin/DynamicPlugin, so this cast was
invalid and the results undefined. The methods for retrieving
subclasses of plugins can't be easily changed to just generate an
array of temporary wrapper objects that expose an identical API
which dereferences to the preferred PluginObject subclass because
pointers to these objects are retained by other parts of ScummVM,
so the wrappers would needed to be persisted or they would need to
just re-expose the underlying Plugin object again. This indicated
that a way to solve this problem is to have the callers receive
Plugin objects and get the PluginObject from the Plugin by
explicitly stating their desired type, in a similar manner to
std::get(std::variant), so that the pattern used by this patch to
solve the problem.

Closes gh-1051.
2017-12-03 20:26:38 -06:00
Colin Snover
1871c7dfea AUDIO: Fix UB shift of negative integer in AdLib driver 2017-12-01 19:22:31 -06: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
Thierry Crozat
5d419c2b58 AUDIO: Rename two functions in ModuleModXmS3m
This is an attempt to fix a compilation error on some platforms.
The error message seems to indicate that log2 might be a define
on thos platforms.

Note that the log2 implementation in ModuleModXmS3m is not the binary
logarithm, and we cannot use Common::intLog2.
2017-09-11 21:38:58 +01:00
Simei Yin
6558578f54 AUDIO: Import micromod code, xm/s3m/mod decoder 2017-09-11 08:10:09 +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
Torbjörn Andersson
a31fcfff2e AUDIO: Fix some more suspicious-looking expessions
GCC did not warn about these, but surely it should be bitwise OR,
not logical OR, here as well. But I don't think I have any game that
uses MaxTrax (Amiga version of Legend of Kyrandia?), so I can't
really test this.
2017-08-12 07:24:48 +02:00
Eugene Sandulenko
edeb6a636c AUDIO: Fix insufficient memset length in FM-TOWNS synthesizer 2017-08-11 21:55:59 +02:00
Eugene Sandulenko
859b54222f AUDIO: Fix incorrect boolean statement in MaxTrax decoder 2017-08-11 21:52:44 +02:00
Torbjörn Andersson
665f5c99b2 JANITORIAL: Silence some more GCC 7 fall through warnings
I think these are the last one that were already flagged as being
deliberate.
2017-08-06 16:54:38 +02:00
Willem Jan Palenstijn
867511d2d0 MT32: Update Munt to 2.0.3
This update uses upstream commit
777c51cdb4dbb4e02a53c23edea9086f0b600e26.

The new SampleRateConverter is added, but not built as we don't use it.
Also, building it without source changes will need additional include
directories.

This update of Munt reduces the stack size, and thus fixes bug #9630.
2017-02-28 18:40:04 +01:00
D G Turner
77818e9683 MT32: Fix Set-But-Unused Compiler Warning. 2017-01-14 09:14:02 +00:00
Paul Gilbert
7b10dac542 AUDIO: Support Wave files with an initial fact chunk 2016-12-20 22:47:49 -05:00
Colin Snover
b93f4f06e4 MT32: Really add the virtual destructor 2016-12-18 10:25:58 -06:00
Colin Snover
d585c6f852 MT32: Fix virtual dtor warning, incorrect delete, unnecessary allocation 2016-12-18 10:20:23 -06:00
Eugene Sandulenko
f98730028c MT32: Prevent Munt from including <fstream> 2016-12-17 20:32:04 +01:00
Colin Snover
1e23c91914 MT32: Fix driver to be thread-safe 2016-12-16 15:44:29 -06:00
Colin Snover
b8d70d26fa MT32: Update Munt to 2.0.1-pre
This update uses upstream commit
f88ef828a600ce66d1f730c8fb2a7f580f6f6165.

This update switches to use the new Munt C++ interface, which
will allow ScummVM to link to an external Munt library instead
of requiring it to be built-in in the future. For the moment,
the emulator is still built-in, since it is not available from
most package repositories.

The Munt driver in ScummVM now uses writeSysex instead of the
(now-private) playSysexWithoutFraming, per recommendation from
the Munt team <https://github.com/munt/munt/pull/30>.

This changeset also removes direct modifications that used to be
made to Munt code, to ease future updates. To update Munt code in
the future:

1. Replace all source files in the `softsynth/mt32` directory with
   new files from the upstream `mt32emu/src` directory;
2. Update `config.h` with the correct version number for the new
   version of Munt;
3. Update `module.mk` to add any new source files that need to be
   built.
2016-12-16 15:44:29 -06:00
Colin Snover
df4a503622 Revert "MT32: Update Munt to 2.0.0"
This reverts commit b4dbd6d3c2.
2016-11-25 12:24:08 -06:00
Colin Snover
b4dbd6d3c2 MT32: Update Munt to 2.0.0
This changeset also removes unnecessary direct modifications to
Munt code to ease future updates. To update Munt in the future:

1. Replace all source files in the `softsynth/mt32` directory with
   new files from the upstream `mt32emu/src` directory;
2. Update `config.h` with the correct version number for the new
   version of Munt;
3. Update `module.mk` to match the list of sources given in
   `mt32emu/CMakeLists.txt libmt32emu_SOURCES`.
2016-11-25 12:14:13 -06:00
Thierry Crozat
0908fd2225 MT32: Use OSDMessageQueue to post OSD messages from the MT32 thread 2016-10-29 15:13:32 +01:00
Eugene Sandulenko
355c4fa646 JANITORIAL: Remove more trailing spaces 2016-10-09 15:02:02 +02: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
jepael
5cc2696deb AUDIO: Fix CMS chips incorrect pitch.
The CMS emulation assumes the chips run at 8 MHz clock,
but in PCs they run at 7.15909 MHz, so the emulated pitch
is too high. Adjusting the requested sampling rate higher
by matching amount the pitch is lowered down to normal.
2016-09-07 23:22:18 +03:00
Paul Gilbert
7d0c83850c AUDIO: Whitespace fix in MP3 engine usage list 2016-09-03 09:58:50 -04:00