[Scummvm-git-logs] scummvm master -> 8b77980a7654f06e4d56e790cf8f33434efb02b5
sev-
noreply at scummvm.org
Tue Jan 20 23:50:36 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
8b77980a76 AUDIO: Reduce the volume for the PC Speaker emulator
Commit: 8b77980a7654f06e4d56e790cf8f33434efb02b5
https://github.com/scummvm/scummvm/commit/8b77980a7654f06e4d56e790cf8f33434efb02b5
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-01-21T02:50:32+03:00
Commit Message:
AUDIO: Reduce the volume for the PC Speaker emulator
Changed paths:
audio/softsynth/pcspk.cpp
audio/softsynth/pcspk.h
engines/agi/sound_a2.cpp
engines/agi/sound_coco3.cpp
engines/freescape/freescape.cpp
engines/freescape/games/castle/castle.cpp
engines/freescape/games/dark/dark.cpp
engines/freescape/sound.cpp
engines/freescape/sound.h
diff --git a/audio/softsynth/pcspk.cpp b/audio/softsynth/pcspk.cpp
index fa689e0a10c..0caaa9eda1f 100644
--- a/audio/softsynth/pcspk.cpp
+++ b/audio/softsynth/pcspk.cpp
@@ -43,7 +43,7 @@ PCSpeakerStream::PCSpeakerStream(int rate) {
_oscSamples = 0;
_remainingSamples = 0;
_mixedSamples = 0;
- _volume = 255;
+ _volume = 20; // The maximum volume is 255
_commandQueue = new Common::Queue<Command>();
_commandActive = false;
}
@@ -96,10 +96,6 @@ void PCSpeakerStream::stop(int32 delay) {
_playForever = false;
}
-void PCSpeakerStream::setVolume(byte volume) {
- _volume = volume;
-}
-
bool PCSpeakerStream::isPlaying() const {
Common::StackLock lock(_mutex);
diff --git a/audio/softsynth/pcspk.h b/audio/softsynth/pcspk.h
index 13d2aaf8469..9cdd3ae0b5d 100644
--- a/audio/softsynth/pcspk.h
+++ b/audio/softsynth/pcspk.h
@@ -129,8 +129,6 @@ public:
void playQueue(PCSpeaker::WaveForm wave, float freq, uint32 lengthus);
/** Stop the currently playing note after delay ms. */
void stop(int32 delay = 0);
- /** Adjust the volume. */
- void setVolume(byte volume);
bool isPlaying() const;
diff --git a/engines/agi/sound_a2.cpp b/engines/agi/sound_a2.cpp
index 2e808a7f643..fec01afa23e 100644
--- a/engines/agi/sound_a2.cpp
+++ b/engines/agi/sound_a2.cpp
@@ -37,11 +37,7 @@ namespace Agi {
// driven by the engine's own inner loops instead of a timer, so games are
// blocked until a sound is completed or interrupted by a key press.
//
-// Common::PCSpeaker is used for sound generation. It produces significantly
-// louder volumes than the other AGI sound generators, so I've lowered the
-// mixer volume for consistency.
-
-#define A2_MIXER_VOLUME 20
+// TODO: Migrate to Audio::PCSpeaker
static void calculateNote(uint16 clickCount, uint16 delayCount, float &freq, uint32 &duration_usec);
static uint32 calculateDelayCycles(uint16 delayCount);
@@ -51,7 +47,7 @@ SoundGenA2::SoundGenA2(AgiBase *vm, Audio::Mixer *pMixer) :
_isPlaying(false),
SoundGen(vm, pMixer) {
- _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, A2_MIXER_VOLUME, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
SoundGenA2::~SoundGenA2() {
diff --git a/engines/agi/sound_coco3.cpp b/engines/agi/sound_coco3.cpp
index 1da61e3929d..6f7ac495c00 100644
--- a/engines/agi/sound_coco3.cpp
+++ b/engines/agi/sound_coco3.cpp
@@ -36,12 +36,10 @@ namespace Agi {
// index. The volume is a boolean. The duration changed between interpreters;
// originally the units were 1/10 of a second, then 1/60.
//
-// Common::PCSpeaker is used for sound generation. It produces significantly
-// louder volumes than the other AGI sound generators, so I've lowered the
-// mixer volume for consistency.
-//
// Thanks to Guillaume Major for documenting the sound format in their
// conversion program, cc3snd.c.
+//
+// TODO: Migrate to Audio::PCSpeaker
static const uint16 cocoFrequencies[] = {
130, 138, 146, 155, 164, 174, 184, 195, 207, 220, 233, 246,
@@ -51,13 +49,11 @@ static const uint16 cocoFrequencies[] = {
2093, 2217, 2349, 2489, 2637, 2793, 2959, 3135, 3322, 3520, 3729, 3951
};
-#define COCO3_MIXER_VOLUME 20
-
SoundGenCoCo3::SoundGenCoCo3(AgiBase *vm, Audio::Mixer *pMixer) :
_isPlaying(false),
SoundGen(vm, pMixer) {
- _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, COCO3_MIXER_VOLUME, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
SoundGenCoCo3::~SoundGenCoCo3() {
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 68a4bef67aa..3bc5dc64791 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -787,7 +787,6 @@ Common::Error FreescapeEngine::run() {
//_screenH = g_system->getHeight();
_gfx = createRenderer(_screenW, _screenH, _renderMode, ConfMan.getBool("authentic_graphics"));
_speaker = new SizedPCSpeaker();
- _speaker->setVolume(50);
_crossairPosition.x = _screenW / 2;
_crossairPosition.y = _screenH / 2;
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 62d90440f5d..deb2c661cc6 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -1303,7 +1303,7 @@ void CastleEngine::checkSensors() {
/*if (!_mixer->isSoundHandleActive(_soundFxGhostHandle)) {
_speaker->play(Audio::PCSpeaker::kWaveFormSquare, 25.0f, -1);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundFxGhostHandle, _speaker, -1, kFreescapeDefaultVolume / 2, 0, DisposeAfterUse::NO);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundFxGhostHandle, _speaker, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}*/
// This is the frequency to shake the screen
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 56624a0a7d0..c4a71d2a0ce 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -697,7 +697,7 @@ void DarkEngine::pressedKey(const int keycode) {
} else if (_flyMode) {
float hzFreq = 1193180.0f / 0xd537;
_speaker->play(Audio::PCSpeaker::kWaveFormSquare, hzFreq, -1);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundFxHandleJetpack, _speaker, -1, Audio::Mixer::kMaxChannelVolume / 2, 0, DisposeAfterUse::NO);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundFxHandleJetpack, _speaker, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
insertTemporaryMessage(_messagesList[11], _countdown - 2);
} else {
_speaker->stop();
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index e03642c436c..f4eb3107920 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -527,7 +527,7 @@ void FreescapeEngine::playSoundZX(Common::Array<soundUnitZX> *data, Audio::Sound
}
_mixer->stopHandle(_soundFxHandle);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, _speaker, -1, kFreescapeDefaultVolume, 0, DisposeAfterUse::NO);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, _speaker, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}
void FreescapeEngine::playSoundDOS(soundSpeakerFx *speakerFxInfo, bool sync, Audio::SoundHandle &handle) {
@@ -543,7 +543,7 @@ void FreescapeEngine::playSoundDOS(soundSpeakerFx *speakerFxInfo, bool sync, Aud
}
_mixer->stopHandle(handle);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, _speaker, -1, kFreescapeDefaultVolume / 2, 0, DisposeAfterUse::NO);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, _speaker, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}
void FreescapeEngine::loadSoundsFx(Common::SeekableReadStream *file, int offset, int number) {
diff --git a/engines/freescape/sound.h b/engines/freescape/sound.h
index b4ca66c6699..f937a6e3c5e 100644
--- a/engines/freescape/sound.h
+++ b/engines/freescape/sound.h
@@ -52,6 +52,7 @@ struct soundSpeakerFx {
Common::Array<struct soundSpeakerFx *>additionalSteps;
};
+// TODO: Migrate to Audio::PCSpeaker
class SizedPCSpeaker : public Audio::PCSpeakerStream {
public:
bool endOfStream() const override { return !isPlaying(); }
More information about the Scummvm-git-logs
mailing list