aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound
AgeCommit message (Collapse)Author
2017-04-23SCI32: Add debugger command to list digital audio samplesColin Snover
2017-04-23SCI32: Fix race conditions in Audio32Colin Snover
2017-04-23SCI32: Fix audio playback with monitored channel in SCI3Colin Snover
SCI3 changes the way that monitored channel works. In SCI2/2.1, when a channel is monitored, it is the only audible channel. In SCI3, monitored channels mix normally. This is very noticeable in LSL7, where music disappears totally during speech if the monitored channel is the only channel played back.
2017-04-23SCI32: Fix missing break statementColin Snover
2017-04-21SCI: Improve audio volume & settings sync codeColin Snover
This patch includes enhancements to the ScummVM integration with SCI engine, with particular focus on SCI32 support. 1. Fixes audio volumes syncing erroneously to ScummVM in games that modify the audio volume without user action (e.g. SCI1.1 talkies that reduce music volume during speech playback). Now, volumes will only be synchronised when the user interacts with the game's audio settings. This mechanism works by looking for a known volume control object in the stack, and only syncing when the control object is present. (Ports and planes were researched and found unreliable.) 2. Fixes audio syncing in SCI32 games that do not set game volumes through kDoSoundMasterVolume/kDoAudioVolume, like GK1, GK2, Phant1, and Torin. 3. Fixes speech/subtitles syncing in SCI32 games that do not use global 90, like LSL6hires. 4. Fixes in-game volume controls in SCI32 games reflecting outdated audio volumes when a change is made during the game from the ScummVM launcher. 5. Fixes SCI32 games that would restore volumes from save games or reset volumes on startup, which caused game volumes to be out-of-sync with ScummVM when started. 6. ScummVM integration code for audio sync has been abstracted into a new GuestAdditions class. This keeps the ScummVM- specific code all in one place, with only small hooks into the engine code. ScummVM integrated save/load code should probably also go here in the future. Fixes Trac#9700.
2017-04-16SCI: Improve MidiParser_SCI robustness against bad sound resourcesColin Snover
1. KQ4 sound 104 has an extra 0xFC (MIDI Stop command/kEndOfTrack) at the end of the resource, which causes an out-of-bounds read because the filtering loop continues after the first 0xFC and unconditionally attempts to read 2 bytes (expecting there to always be a delta value + a command, whereas in this file there is only another kEndOfTrack command). This is corrected by exiting the filtering loop when a kEndOfTrack is encountered and there is not enough data remaining in the resource to continue reading. 2. KQ5 sound 699 is truncated, which causes the parser to attempt to read past the end of the resource. This is addressed by adding bounds checks that exit the mix loop early if there is no more data available to read. This allows truncated sounds to be played as far as possible (previously, trying to read truncated resources would result in a fatal error). 3. midiMixChannels allocates an arbitrary amount of raw memory for the mixed MIDI sequence, without performing any bounds checking when writing to this memory, potentially leading to a crash or silent corruption of adjacent memory. This is mitigated by using SciSpan instead of a raw pointer for the mixed data. Fixes Trac#9727.
2017-04-14SCI: Fix speech in QfG IV on big endian platformsThierry Crozat
2017-03-30SCI32: Hack around MIDI parser causing stuck harp animation in KQ7Colin Snover
The eventual proper fix for this is to change the current MIDI parser to work the same as in SSCI, but for now this workaround allows the game to continue. Fixes Trac#9696.
2017-03-30SCI: Change default master MIDI volume to 15Colin Snover
GK1 handles MIDI volume by changing the volumes of individual sound objects, rather than by using the MIDI master volume. As a result, the master volume needs to default to the maximum output level in order for GK1 to play music at the correct volume. This change does not affect earlier games, since SCI16 managed MIDI volume via the master volume, and for these games the master volume from ScummVM is synced at startup.
2017-03-30SCI32: Do not default to General MIDI for SCI2.1 gamesColin Snover
The only SCI32 game that uses MIDI and does not support AdLib is MGDX, and it its MIDI playback is currently broken regardless of the synth setting.
2017-03-30SCI32: Fix audio, wave, VMD, Duck, CLUT, TGA, ZZZ, Etc patchesColin Snover
Specifically, audio patches are used in at least PQ:SWAT (40103.AUD), Lighthouse (9103.AUD), and the GK2 demo (300.AUD).
2017-03-30SCI32: Implement known-used portions of kPlayDuckColin Snover
2017-03-30SCI: Update formatting strings to match updated Span APIColin Snover
2017-03-27SCI: Implement bounds-checked reads of game resourcesColin Snover
2017-02-26SCI: Clean up unnecessary castsWillem Jan Palenstijn
2017-01-09SCI32: Fix crashes and bad cel positioning in GK2 demoColin Snover
2017-01-09SCI32: Enable playback of stereo audioColin Snover
2016-12-03SCI: Fix buffer overflow in AmigaMac sound driverColin Snover
2016-12-03SCI: Fix non-responsive application warning during sysex transfersColin Snover
This also fixes the display of the startup LCD message, which had been delayed until after the sysex transfer was finished.
2016-10-20SCI32: Split out detection of features that cross SSCI versionsColin Snover
2016-09-29SCI32: Explicitly instantiate MIN/MAX templatesColin Snover
2016-09-29SCI32: Guard against dynamic_cast failureColin Snover
CID 1361762, 1361763, 1361764, 1361765.
2016-08-19SCI32: Implement kRobotColin Snover
2016-08-06SCI32: Remove VMD flags from Audio32 mixerColin Snover
The VMD decoder sends audio directly to the system mixer.
2016-07-11SCI32: Fix broken background volume in Torin during speechColin Snover
2016-07-11SCI32: Silence non-monitored channels while monitoring is activeColin Snover
2016-07-11SCI32: Fix sign comparison warningColin Snover
2016-07-11SCI32: Fix audio deadlocksColin Snover
Several functions in Audio32 would call into the mixer to pause or resume the audio handle, which would cause a deadlock if the mixer's mixCallback timer fired while one of these functions was running on the main thread. To address this, calls to mixer to pause/unpause the digital audio handle have been removed. Since this was just an optimisation to prevent unnecessary calls to fill the audio buffer, the only problem now is that a tiny amount of CPU is wasted on unnecessary callbacks to read from the empty SCI mixer.
2016-07-11SCI32: Minor Audio32 cleanupColin Snover
2016-07-08SCI: Set isSample when starting digital sample from soundInitSndWillem Jan Palenstijn
This fixes digital samples in at least QfG1, SQ3, LSL5. Bug #7159.
2016-07-01SCI32: Use better audio fading algorithmColin Snover
Using the one from SCI2.1mid makes fades very slow because SDL has a larger audio buffer than SSCI DOS. This new algorithm is based on wall time so will always fade at the correct speed, although the larger buffers will have a coarser granularity so the fades may not be as smooth as in the original engine. If anyone cares, the fade volume could be mixed into individual samples in `readBuffer` instead of applying just once per complete buffer. SSCI did not do this, however, so this implementation should be pretty accurate.
2016-07-01SCI32: Fix audio fadingColin Snover
2016-06-30SCI32: Specify default hardware ratesColin Snover
This normally happens in SSCI when the audio hardware is initialised. CID 1357048
2016-06-26SCI32: Fix hang when playing auto-play audio channelsColin Snover
2016-06-26SCI32: Fix race condition when freeing audio resourcesColin Snover
It's not possible to call any ResourceManager methods from any thread other than the main thread because it is not thread-safe.
2016-06-25SCI32: Properly initialize pausedAtTick inside Audio32::play()Filippos Karapetis
Fixes audio not playing in later SCI32 games that use Audio32
2016-06-25Revert "SCI32: Properly initialize AudioChannel inside Audio32::play()"Filippos Karapetis
This reverts commit 5eaea05a2b6af0ddcf28fca1f0cd3fc0c54f4d07.
2016-06-23SCI32: Properly initialize AudioChannel inside Audio32::play()Filippos Karapetis
Fixes audio issues caused by uninitialized variables
2016-06-23SCI32: Fix usage of the C++11 override keyword with MSVCFilippos Karapetis
MSVC does not allow the usage of the "override" keyword on function definition, only on declaration
2016-06-23SCI32: Fix potentially uninitialized variableFilippos Karapetis
2016-06-23SCI32: Const correction in Audio32's readBuffer() implementationFilippos Karapetis
2016-06-21SCI32: Add low-pass filter to 8-bit SOL audioColin Snover
This improves the perceived quality of audio in games that use 8-bit samples for music, like Torin.
2016-06-20SCI: Minor cleanup of kDoSoundColin Snover
Replaces unused kernel calls to use kEmpty, and set correct signatures for SCI32 kernel calls.
2016-06-20SCI32: Rewrite digital audio engineColin Snover
This provides a complete implementation of kDoAudio through SCI2.1mid, plus partial implementation of SCI3 features. Digital audio calls shunted through kDoSound have also been updated to go through the SCI32 audio mixer, though these shunts are a bit hacky because the ScummVM implementation of kDoSound does not currently match how SSCI kDoSound is designed. It is probably possible in the future to just replace the SCI1.1 audio code (audio.cpp) with the new SCI32 code, since the major differences seem to be that (1) SCI1.1 only supported one digital audio playback channel (this is configurable already), (2) it had extra commands for CD audio playback and queued sample playback.
2016-06-19SCI: Split audio sync to its own classColin Snover
SCI32 has its own audio handling code, but audio sync code is the same as SCI16.
2016-06-12SCI: Fix uninitialized read in SoundCommandParserColin Snover
2016-06-07SCI: Plug memory leakEugene Sandulenko
2016-04-14JANITORIAL: Reduce audio header dependenciesOri Avtalion
2016-03-13BACKENDS: Only expose one set of functions for AudioCDManagerMatthew Hoops
Engines should only have to call one set of functions and not decide between the two. In fact, the 'emulation' API was documented to just call the 'real CD' API.
2016-03-13SCI: Ensure openCD() is calledMatthew Hoops