[Scummvm-git-logs] scummvm master -> 496f5bf200120ea8679f9a5b681083176fda236f
tnm23
noreply at scummvm.org
Mon May 11 14:41:47 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:
496f5bf200 ZVISION: Eliminate redundant duplicate code from SyncSoundNode;
Commit: 496f5bf200120ea8679f9a5b681083176fda236f
https://github.com/scummvm/scummvm/commit/496f5bf200120ea8679f9a5b681083176fda236f
Author: Thomas N McEwan (46427621+tnm23 at users.noreply.github.com)
Date: 2026-05-11T15:40:11+01:00
Commit Message:
ZVISION: Eliminate redundant duplicate code from SyncSoundNode;
simply inherit from MusicNode instead.
This has the additional benefit of allowing animation sounds to be panned and faded.
Adjust priority of PanTrackNode debug message.
Changed paths:
engines/zvision/scripting/effects/music_effect.cpp
engines/zvision/scripting/effects/syncsound_effect.cpp
engines/zvision/scripting/effects/syncsound_effect.h
diff --git a/engines/zvision/scripting/effects/music_effect.cpp b/engines/zvision/scripting/effects/music_effect.cpp
index b6811193b99..3fc852223d3 100644
--- a/engines/zvision/scripting/effects/music_effect.cpp
+++ b/engines/zvision/scripting/effects/music_effect.cpp
@@ -203,7 +203,7 @@ PanTrackNode::~PanTrackNode() {
}
bool PanTrackNode::process(uint32 deltaTimeInMillis) {
- debugC(3, kDebugSound, "Processing PanTrackNode, key %d", _key);
+ debugC(5, kDebugSound, "Processing PanTrackNode, key %d", _key);
ScriptManager *scriptManager = _engine->getScriptManager();
ScriptingEffect *fx = scriptManager->getSideFX(_slot);
if (fx && fx->getType() == SCRIPTING_EFFECT_AUDIO) {
diff --git a/engines/zvision/scripting/effects/syncsound_effect.cpp b/engines/zvision/scripting/effects/syncsound_effect.cpp
index 2010a9aa3a8..b9dec708769 100644
--- a/engines/zvision/scripting/effects/syncsound_effect.cpp
+++ b/engines/zvision/scripting/effects/syncsound_effect.cpp
@@ -33,48 +33,18 @@
namespace ZVision {
SyncSoundNode::SyncSoundNode(ZVision *engine, uint32 key, Common::Path &filename, int32 syncto)
- : ScriptingEffect(engine, key, SCRIPTING_EFFECT_AUDIO) {
+ : MusicNode(engine, key, filename, false, Audio::Mixer::kMaxChannelVolume) {
_syncto = syncto;
- _sub = 0;
-
- Audio::RewindableAudioStream *audioStream = NULL;
-
- if (filename.baseName().contains(".wav")) {
- Common::File *file = new Common::File();
- if (file->open(filename)) {
- audioStream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
- }
- } else {
- audioStream = makeRawZorkStream(filename, _engine);
- }
-
- _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, audioStream);
-
- Common::String subname = filename.baseName();
- subname.setChar('s', subname.size() - 3);
- subname.setChar('u', subname.size() - 2);
- subname.setChar('b', subname.size() - 1);
-
- Common::Path subpath(filename.getParent().appendComponent(subname));
- if (SearchMan.hasFile(subpath))
- _sub = _engine->getSubtitleManager()->create(subpath, _handle); // NB automatic subtitle!
}
SyncSoundNode::~SyncSoundNode() {
- _engine->_mixer->stopHandle(_handle);
- if (_sub)
- _engine->getSubtitleManager()->destroy(_sub);
}
bool SyncSoundNode::process(uint32 deltaTimeInMillis) {
- if (! _engine->_mixer->isSoundHandleActive(_handle))
+ if (_engine->getScriptManager()->getSideFX(_syncto) == NULL)
return stop();
- else {
-
- if (_engine->getScriptManager()->getSideFX(_syncto) == NULL)
- return stop();
- }
- return false;
+ else
+ return MusicNode::process(deltaTimeInMillis);
}
} // End of namespace ZVision
diff --git a/engines/zvision/scripting/effects/syncsound_effect.h b/engines/zvision/scripting/effects/syncsound_effect.h
index ad8af81428c..95fa7dec786 100644
--- a/engines/zvision/scripting/effects/syncsound_effect.h
+++ b/engines/zvision/scripting/effects/syncsound_effect.h
@@ -23,6 +23,7 @@
#define ZVISION_SYNCSOUND_NODE_H
#include "audio/mixer.h"
+#include "zvision/scripting/effects/music_effect.h"
#include "zvision/scripting/scripting_effect.h"
#include "zvision/text/subtitle_manager.h"
@@ -31,23 +32,14 @@ class String;
}
namespace ZVision {
-class SyncSoundNode : public ScriptingEffect {
+class SyncSoundNode : public MusicNode {
public:
SyncSoundNode(ZVision *engine, uint32 key, Common::Path &file, int32 syncto);
- ~SyncSoundNode() override;
+ ~SyncSoundNode();
- /**
- * Decrement the timer by the delta time. If the timer is finished, set the status
- * in _globalState and let this node be deleted
- *
- * @param deltaTimeInMillis The number of milliseconds that have passed since last frame
- * @return If true, the node can be deleted after process() finishes
- */
bool process(uint32 deltaTimeInMillis) override;
private:
int32 _syncto;
- Audio::SoundHandle _handle;
- uint16 _sub;
};
} // End of namespace ZVision
More information about the Scummvm-git-logs
mailing list