[Scummvm-git-logs] scummvm master -> 7372d035692b0206eb2cee78337684cf5644835e

scemino noreply at scummvm.org
Fri Jun 20 20:03:17 UTC 2025


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:
7372d03569 AWE: Fix crash when playing sfx music and implement stopSfxMusic


Commit: 7372d035692b0206eb2cee78337684cf5644835e
    https://github.com/scummvm/scummvm/commit/7372d035692b0206eb2cee78337684cf5644835e
Author: scemino (scemino74 at gmail.com)
Date: 2025-06-20T22:01:48+02:00

Commit Message:
AWE: Fix crash when playing sfx music and implement stopSfxMusic

Changed paths:
    engines/awe/awe.cpp
    engines/awe/sound.cpp
    engines/awe/sound.h


diff --git a/engines/awe/awe.cpp b/engines/awe/awe.cpp
index d67ced3766b..de9a64d2170 100644
--- a/engines/awe/awe.cpp
+++ b/engines/awe/awe.cpp
@@ -193,6 +193,8 @@ Common::Error AweEngine::run() {
 		e->run();
 	}
 
+	_mixer->stopAll();
+
 	e->finish();
 	delete e;
 	stub->fini();
diff --git a/engines/awe/sound.cpp b/engines/awe/sound.cpp
index 991ecee2c38..82b6897c55e 100644
--- a/engines/awe/sound.cpp
+++ b/engines/awe/sound.cpp
@@ -38,6 +38,7 @@ void Sound::playMusic(const char *path, int loops) {
 }
 
 void Sound::playSfxMusic(int num) {
+	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _sfxStream, -1, 255, 0, DisposeAfterUse::YES, true);
 	_sfx->play(_mixer->getOutputRate());
 }
 
@@ -53,8 +54,20 @@ void Sound::stopAifcMusic() {
 	warning("TODO: stopAifcMusic");
 }
 
+void Sound::stopAll() {
+	stopSfxMusic();
+	_mixer->stopAll();
+}
+
+void Sound::setPlayer(SfxPlayer *player) {
+	_sfx = player;
+	_sfxStream = new SfxMusicStream(player);
+}
+
 void Sound::stopSfxMusic() {
-	warning("TODO: stopSfxMusic");
+	if (_mixer->isSoundHandleActive(_musicHandle)) {
+		_mixer->stopHandle(_musicHandle);
+	}
 }
 
 void Sound::preloadSoundAiff(byte num, const byte *data) {
diff --git a/engines/awe/sound.h b/engines/awe/sound.h
index 4220f07b410..0cf5c92e034 100644
--- a/engines/awe/sound.h
+++ b/engines/awe/sound.h
@@ -66,15 +66,9 @@ public:
 	explicit Sound(Audio::Mixer *mixer) : _mixer(mixer) {
 	}
 
-	void setPlayer(SfxPlayer *player) {
-		_sfx = player;
-		_sfxStream = new SfxMusicStream(player);
-		_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _sfxStream, -1, 255, 0, DisposeAfterUse::YES, true);
-	}
+	void setPlayer(SfxPlayer *player);
 
-	void stopAll() {
-		_mixer->stopAll();
-	}
+	void stopAll();
 	void playMusic(const char *path, int loops);
 	void playAifcMusic(const char *path, uint32 offset);
 	void playSfxMusic(int num);




More information about the Scummvm-git-logs mailing list