[Scummvm-git-logs] scummvm master -> 43678ae0c82818896af4770e4fede393981fa9d7
athrxx
athrxx at scummvm.org
Thu Jun 18 16:35:59 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
77dc9dfd09 SCI: (CMS driver) - minor sound improvement
43678ae0c8 SDL: fix --output-rate commandline option
Commit: 77dc9dfd09105af90627149f3fb5e1fd234555b9
https://github.com/scummvm/scummvm/commit/77dc9dfd09105af90627149f3fb5e1fd234555b9
Author: athrxx (athrxx at scummvm.org)
Date: 2020-06-18T18:35:25+02:00
Commit Message:
SCI: (CMS driver) - minor sound improvement
This reintroduces two original bugs that I found too nasty to implement when I made the driver. These are present in all SCI0 CMS drivers. They do actually influence the sound in an positive way and make it more faithful when comparing to DOSBox. I have added an #ifdef option so it can be easily enabled and disabled for testing.
Changed paths:
engines/sci/sound/drivers/cms.cpp
diff --git a/engines/sci/sound/drivers/cms.cpp b/engines/sci/sound/drivers/cms.cpp
index 9c61269dc5..9bb632ea46 100644
--- a/engines/sci/sound/drivers/cms.cpp
+++ b/engines/sci/sound/drivers/cms.cpp
@@ -31,6 +31,8 @@
#include "sci/resource.h"
#include "sci/util.h"
+#define SCI0_CMS_ORIGINAL_BUG 1
+
namespace Sci {
class MidiDriver_CMS;
@@ -115,6 +117,9 @@ private:
uint8 _envSLI;
uint8 _envPAC;
uint8 _envPA;
+#ifdef SCI0_CMS_ORIGINAL_BUG
+ static uint8 _envAR1;
+#endif
uint8 _envNote;
uint8 _envSSL;
@@ -294,9 +299,16 @@ const int CMSVoice::_frequencyTable[48] = {
242, 246, 250, 253
};
+#ifdef SCI0_CMS_ORIGINAL_BUG
+uint8 CMSVoice_V0::_envAR1 = 0;
+#endif
+
CMSVoice_V0::CMSVoice_V0(uint8 id, MidiDriver_CMS* driver, CMSEmulator *cms, SciSpan<const uint8>& patchData) : CMSVoice(id, driver, cms, patchData), _envState(kReady), _currentLevel(0), _strMask(0),
_envAR(0), _envTL(0), _envDR(0), _envSL(0), _envRR(0), _envSLI(0), _vbrOn(false), _vbrSteps(0), _vbrState(0), _vbrMod(0), _vbrCur(0), _isSecondary(id > 7),
_vbrPhase(0), _transOct(0), _transFreq(0), _envPAC(0), _envPA(0), _panMask(_id & 1 ? 0xF0 : 0x0F), _envSSL(0), _envNote(0xFF), _updateCMS(false) {
+#ifdef SCI0_CMS_ORIGINAL_BUG
+ _envAR1 = 0;
+#endif
}
void CMSVoice_V0::noteOn(int note, int) {
@@ -399,8 +411,15 @@ void CMSVoice_V0::update() {
--_envPAC;
break;
} else {
+#ifdef SCI0_CMS_ORIGINAL_BUG
+ // This is bugged in two ways. The attack rate value is misinterpreted as a int8 for the comparison (the only place in the code
+ // where it does that). And it always uses the attack rate of voice no. 1 as a modifier instead of the voice's own attack rate.
+ // Keeping these bugs will result in faithful audio. It probably even sounds as intended, since the sequencer will have likely
+ // suffered from the same bug and calculated the deltas based on that...
+ _currentLevel = ((_currentLevel >> 1) > (int8)_envAR)?((_currentLevel >> 1) - _envAR1) & 0xFF : (_envAR - _envAR1) & 0xFF;
+#else
_currentLevel = ((_currentLevel >> 1) > _envAR) ? ((_currentLevel >> 1) - _envAR) : 0;
- //_currentLevel = ((_currentLevel >> 1) > (int8)_envAR) ? ((_currentLevel >> 1) - _envAR1) & 0xFF : (_envAR - _envAR1) & 0xFF;
+#endif
_envState = kAttack;
}
// fall through
@@ -539,6 +558,10 @@ void CMSVoice_V0::selectEnvelope(int id) {
_vbrCur = _vbrMod;
_vbrState = _vbrSteps & 0x0F;
_vbrPhase = 0;
+#ifdef SCI0_CMS_ORIGINAL_BUG
+ if (_id == 1)
+ _envAR1 = _envAR;
+#endif
}
const uint8 CMSVoice_V0::_volumeTable[176] = {
Commit: 43678ae0c82818896af4770e4fede393981fa9d7
https://github.com/scummvm/scummvm/commit/43678ae0c82818896af4770e4fede393981fa9d7
Author: athrxx (athrxx at scummvm.org)
Date: 2020-06-18T18:35:25+02:00
Commit Message:
SDL: fix --output-rate commandline option
The commandline otion was ignored. The code would only query the scummvm.ini setting but not the transient domain (=commandline) setting.
Changed paths:
backends/mixer/sdl/sdl-mixer.cpp
diff --git a/backends/mixer/sdl/sdl-mixer.cpp b/backends/mixer/sdl/sdl-mixer.cpp
index 2a46d877b2..7e59121fe3 100644
--- a/backends/mixer/sdl/sdl-mixer.cpp
+++ b/backends/mixer/sdl/sdl-mixer.cpp
@@ -146,14 +146,12 @@ static uint32 roundDownPowerOfTwo(uint32 samples) {
SDL_AudioSpec SdlMixerManager::getAudioSpec(uint32 outputRate) {
SDL_AudioSpec desired;
- const char *const appDomain = Common::ConfigManager::kApplicationDomain;
-
- // There was once a GUI option for this, but it was never used;
- // configurability is retained for advanced users only who wish to modify
- // their ScummVM config file directly
+ // There was once a GUI option for this, which was removed. Configurability
+ // is retained for advanced users only who wish to use the commandline
+ // option (--output-rate) or modify their ScummVM config file directly.
uint32 freq = 0;
- if (ConfMan.hasKey("output_rate", appDomain))
- freq = ConfMan.getInt("output_rate", appDomain);
+ if (ConfMan.hasKey("output_rate"))
+ freq = ConfMan.getInt("output_rate");
if (freq <= 0)
freq = outputRate;
@@ -164,8 +162,8 @@ SDL_AudioSpec SdlMixerManager::getAudioSpec(uint32 outputRate) {
// characteristics which are not easily measured, so allow advanced users to
// tweak their audio buffer size if they are experience excess latency or
// drop-outs by setting this value in their ScummVM config file directly
- if (ConfMan.hasKey("audio_buffer_size", appDomain))
- samples = ConfMan.getInt("audio_buffer_size", appDomain);
+ if (ConfMan.hasKey("audio_buffer_size", Common::ConfigManager::kApplicationDomain))
+ samples = ConfMan.getInt("audio_buffer_size", Common::ConfigManager::kApplicationDomain);
// 256 is an arbitrary minimum; 32768 is the largest power-of-two value
// representable with uint16
More information about the Scummvm-git-logs
mailing list