[Scummvm-git-logs] scummvm master -> 3be1744666a9cd83fd149c78554d59ea7b64ffa8
sev-
sev at scummvm.org
Sat Sep 5 20:57:09 UTC 2020
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9098af1029 AUDIO: Fix Amiga's SoundFx instrument loading.
5e2365fe83 CINE: Fix loading .AMI files (Amiga samples).
0bedec1304 CINE: OS: Fix playing Amiga samples.
d206dbcdae AUDIO: Add periodScaleDivisor to Paula and SoundFx
3be1744666 CINE: OS: Fix pitch of Amiga music by halving it.
Commit: 9098af102926fd0f7ed7f9d505016bf1a7baaf7f
https://github.com/scummvm/scummvm/commit/9098af102926fd0f7ed7f9d505016bf1a7baaf7f
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-05T22:57:03+02:00
Commit Message:
AUDIO: Fix Amiga's SoundFx instrument loading.
The instrument names are a maximum of 22 characters in length but
were previously shortened to a maximum of 8 characters. At least in
Amiga versions of Operation Stealth some of the instrument names are
longer than 8 characters and failed to be loaded because of this.
Raising the limit from 8 to 22 characters fixes this.
Addresses bug #11676.
Changed paths:
audio/mods/soundfx.cpp
diff --git a/audio/mods/soundfx.cpp b/audio/mods/soundfx.cpp
index 2b4c4c9dba..d557e7aaab 100644
--- a/audio/mods/soundfx.cpp
+++ b/audio/mods/soundfx.cpp
@@ -148,7 +148,7 @@ bool SoundFx::load(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallba
}
} else {
if (ins->name[0]) {
- ins->name[8] = '\0';
+ ins->name[22] = '\0';
ins->data = (int8 *)(*loadCb)(ins->name, 0);
if (!ins->data) {
return false;
Commit: 5e2365fe83df93322350f4f54efb734ed66b59a6
https://github.com/scummvm/scummvm/commit/5e2365fe83df93322350f4f54efb734ed66b59a6
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-05T22:57:03+02:00
Commit Message:
CINE: Fix loading .AMI files (Amiga samples).
The .AMI files load better with loadSpl function than loadAni.
Using loadAni for some of the files resulted in garbled sound when
the input data was presumed to be 4-bit although it was 8-bit.
Fixes loading of some Amiga samples in Operation Stealth
(Not all samples were affected). Addresses bug #11676.
Changed paths:
engines/cine/anim.cpp
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index dab99576dc..fa1f3db527 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -899,7 +899,7 @@ int loadResource(const char *resourceName, int16 idx, int16 frameIndex) {
} else if (strstr(resourceName, ".ADL")) {
result = loadSpl(resourceName, idx);
} else if (strstr(resourceName, ".AMI")) {
- result = loadAni(resourceName, idx, frameIndex);
+ result = loadSpl(resourceName, idx);
} else if (strstr(resourceName, "ECHEC")) { // Echec (French) means failure
g_cine->quitGame();
} else {
Commit: 0bedec13042c34b00425cfc49a251e98309a190a
https://github.com/scummvm/scummvm/commit/0bedec13042c34b00425cfc49a251e98309a190a
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-05T22:57:03+02:00
Commit Message:
CINE: OS: Fix playing Amiga samples.
Previously frequency of zero samples crashed the debug version,
now they are simply discarded. Also the frequency calculation is done
differently in the Amiga version of Operation Stealth than in the
Future Wars. This fixes playing samples in Amiga versions of Operation
Stealth (Not crashing on frequency of zero samples and playing the
samples at their right pitch).
Changed paths:
engines/cine/sound.cpp
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 9c9ccbf6f7..4ae8596643 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -1443,10 +1443,14 @@ void PaulaSound::playSound(int mode, int channel, int param3, int param4, int pa
void PaulaSound::playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat) {
debugC(5, kCineDebugSound, "PaulaSound::playSound() channel %d size %d", channel, size);
Common::StackLock lock(_sfxMutex);
- assert(frequency > 0);
+
+ if (channel < 0 || channel >= NUM_CHANNELS) {
+ warning("PaulaSound::playSound: Channel number out of range (%d)", channel);
+ return;
+ }
stopSound(channel);
- if (size > 0) {
+ if (frequency > 0 && size > 0) {
byte *sound = (byte *)malloc(size);
if (sound) {
// Create the audio stream
@@ -1455,6 +1459,10 @@ void PaulaSound::playSound(int channel, int frequency, const uint8 *data, int si
// Clear the first and last 16 bits like in the original.
sound[0] = sound[1] = sound[size - 2] = sound[size - 1] = 0;
+ if (g_cine->getGameType() == Cine::GType_OS) {
+ frequency = ((frequency * 2) / 20) + 50;
+ }
+
Audio::SeekableAudioStream *stream = Audio::makeRawStream(sound, size, PAULA_FREQ / frequency, 0);
// Initialize the volume control
Commit: d206dbcdaea235d6b4dbca1070a6d9f3e8647c50
https://github.com/scummvm/scummvm/commit/d206dbcdaea235d6b4dbca1070a6d9f3e8647c50
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-05T22:57:03+02:00
Commit Message:
AUDIO: Add periodScaleDivisor to Paula and SoundFx
Add support for dividing the playing rate of Paula and SoundFx audio
by integers other than 1. This is going to be used in the Cine engine
for dividing the playing rate of music in the Amiga version of Operation
Stealth by 2 to get it to sound right. Otherwise it sounds too high
pitched.
This is groundwork for fixing bug #11676.
Changed paths:
audio/mods/paula.cpp
audio/mods/paula.h
audio/mods/soundfx.cpp
audio/mods/soundfx.h
diff --git a/audio/mods/paula.cpp b/audio/mods/paula.cpp
index 283c0cbb7b..d512c75fb3 100644
--- a/audio/mods/paula.cpp
+++ b/audio/mods/paula.cpp
@@ -40,8 +40,8 @@
namespace Audio {
-Paula::Paula(bool stereo, int rate, uint interruptFreq, FilterMode filterMode) :
- _stereo(stereo), _rate(rate), _periodScale((double)kPalPaulaClock / rate), _intFreq(interruptFreq) {
+Paula::Paula(bool stereo, int rate, uint interruptFreq, FilterMode filterMode, int periodScaleDivisor) :
+ _stereo(stereo), _rate(rate), _periodScale((double)kPalPaulaClock / (rate * periodScaleDivisor)), _intFreq(interruptFreq) {
_filterState.mode = filterMode;
_filterState.ledFilter = false;
diff --git a/audio/mods/paula.h b/audio/mods/paula.h
index 93d683064a..07a8793f27 100644
--- a/audio/mods/paula.h
+++ b/audio/mods/paula.h
@@ -69,9 +69,10 @@ public:
};
Paula(bool stereo = false, int rate = 44100, uint interruptFreq = 0,
- FilterMode filterMode = kFilterModeA1200);
+ FilterMode filterMode = Paula::defaultFilterMode(), int periodScaleDivisor = 1);
~Paula();
+ static FilterMode defaultFilterMode() { return kFilterModeA1200; }
bool playing() const { return _playing; }
void setTimerBaseValue( uint32 ticksPerSecond ) { _timerBase = ticksPerSecond; }
uint32 getTimerBaseValue() { return _timerBase; }
diff --git a/audio/mods/soundfx.cpp b/audio/mods/soundfx.cpp
index d557e7aaab..962e687583 100644
--- a/audio/mods/soundfx.cpp
+++ b/audio/mods/soundfx.cpp
@@ -47,7 +47,7 @@ public:
NUM_INSTRUMENTS = 15
};
- SoundFx(int rate, bool stereo);
+ SoundFx(int rate, bool stereo, int periodScaleDivisor = 1);
virtual ~SoundFx();
bool load(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb);
@@ -75,8 +75,8 @@ protected:
uint16 _effects[NUM_CHANNELS];
};
-SoundFx::SoundFx(int rate, bool stereo)
- : Paula(stereo, rate) {
+SoundFx::SoundFx(int rate, bool stereo, int periodScaleDivisor)
+ : Paula(stereo, rate, 0, Paula::defaultFilterMode(), periodScaleDivisor) {
setTimerBaseValue(kPalCiaClock);
_ticks = 0;
_delay = 0;
@@ -264,8 +264,8 @@ void SoundFx::interrupt() {
handleTick();
}
-AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo) {
- SoundFx *stream = new SoundFx(rate, stereo);
+AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate, bool stereo, int periodScaleDivisor) {
+ SoundFx *stream = new SoundFx(rate, stereo, periodScaleDivisor);
if (stream->load(data, loadCb)) {
stream->play();
return stream;
diff --git a/audio/mods/soundfx.h b/audio/mods/soundfx.h
index 40a8efd892..71128b7277 100644
--- a/audio/mods/soundfx.h
+++ b/audio/mods/soundfx.h
@@ -45,7 +45,7 @@ typedef byte *(*LoadSoundFxInstrumentCallback)(const char *name, uint32 *size);
* stream object is kept). If loadCb is non 0, then instruments are loaded using
* it, buffers returned are free'd at the end of playback.
*/
-AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate = 44100, bool stereo = true);
+AudioStream *makeSoundFxStream(Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate = 44100, bool stereo = true, int periodScaleDivisor = 1);
} // End of namespace Audio
Commit: 3be1744666a9cd83fd149c78554d59ea7b64ffa8
https://github.com/scummvm/scummvm/commit/3be1744666a9cd83fd149c78554d59ea7b64ffa8
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-05T22:57:03+02:00
Commit Message:
CINE: OS: Fix pitch of Amiga music by halving it.
Fix playing pitch of Amiga music in Operation Stealth by halving it.
Fixes bug #11676.
Changed paths:
engines/cine/sound.cpp
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 4ae8596643..282923782c 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -1402,7 +1402,10 @@ void PaulaSound::loadMusic(const char *name) {
byte *buf = readBundleSoundFile(name, &size);
if (buf) {
Common::MemoryReadStream s(buf, size);
- _moduleStream = Audio::makeSoundFxStream(&s, readBundleSoundFile, _mixer->getOutputRate());
+ // Operation Stealth for Amiga has to have its music frequency halved
+ // or otherwise the music sounds too high pitched.
+ const int periodScaleDivisor = 2;
+ _moduleStream = Audio::makeSoundFxStream(&s, readBundleSoundFile, _mixer->getOutputRate(), true, periodScaleDivisor);
free(buf);
}
}
More information about the Scummvm-git-logs
mailing list