[Scummvm-git-logs] scummvm master -> 951c1b77d9f71fabc101c850cbe9caab0c8dce62
lephilousophe
noreply at scummvm.org
Mon Mar 18 14:58:24 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
951c1b77d9 AGS: Don't use FSNode but rely on AGS facilities to load sound files
Commit: 951c1b77d9f71fabc101c850cbe9caab0c8dce62
https://github.com/scummvm/scummvm/commit/951c1b77d9f71fabc101c850cbe9caab0c8dce62
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-03-18T15:58:20+01:00
Commit Message:
AGS: Don't use FSNode but rely on AGS facilities to load sound files
Changed paths:
engines/ags/plugins/ags_waves/ags_waves.h
engines/ags/plugins/ags_waves/sound.cpp
diff --git a/engines/ags/plugins/ags_waves/ags_waves.h b/engines/ags/plugins/ags_waves/ags_waves.h
index db4068ebf6d..f584812c6d1 100644
--- a/engines/ags/plugins/ags_waves/ags_waves.h
+++ b/engines/ags/plugins/ags_waves/ags_waves.h
@@ -163,7 +163,7 @@ private:
/**
* Loads a ScummVM OGG stream for playback
*/
- Audio::AudioStream *loadOGG(const Common::FSNode &fsNode);
+ Audio::AudioStream *loadOGG(const Common::ArchiveMemberPtr member);
void playStream(Audio::Mixer::SoundType type, Audio::SoundHandle *handle, Audio::AudioStream *stream, int repeat);
diff --git a/engines/ags/plugins/ags_waves/sound.cpp b/engines/ags/plugins/ags_waves/sound.cpp
index 4f66de6813a..51b38a2badc 100644
--- a/engines/ags/plugins/ags_waves/sound.cpp
+++ b/engines/ags/plugins/ags_waves/sound.cpp
@@ -20,10 +20,9 @@
*/
#include "audio/decoders/vorbis.h"
-#include "common/file.h"
-#include "common/fs.h"
#include "common/util.h"
#include "ags/plugins/ags_waves/ags_waves.h"
+#include "ags/shared/util/stdio_compat.h"
#include "ags/ags.h"
namespace AGS3 {
@@ -46,10 +45,9 @@ void AGSWaves::SFX_Play(ScriptMethodParams ¶ms) {
}
_mixer->stopHandle(effect._soundHandle);
- Common::FSNode fsNode = ::AGS::g_vm->getGameFolder().getChild(
- "sounds").getChild(Common::String::format("sound%d.sfx", sfxNum));
+ Common::ArchiveMemberPtr member = getFile(Common::String::format("sounds/sound%d.sfx", sfxNum).c_str());
- Audio::AudioStream *sound = loadOGG(fsNode);
+ Audio::AudioStream *sound = loadOGG(member);
if (sound != nullptr) {
effect._volume = 255;
@@ -176,15 +174,11 @@ void AGSWaves::SFX_Filter(ScriptMethodParams ¶ms) {
SFX[sfxNum]._filter = enable;
}
-Audio::AudioStream *AGSWaves::loadOGG(const Common::FSNode &fsNode) {
+Audio::AudioStream *AGSWaves::loadOGG(const Common::ArchiveMemberPtr member) {
#ifdef USE_VORBIS
- if (fsNode.exists()) {
- Common::File *soundFile = new Common::File();
- if (!soundFile->open(fsNode))
- error("Failed to open");
-
- Audio::AudioStream *stream = Audio::makeVorbisStream(soundFile, DisposeAfterUse::YES);
- return (stream) ? stream : nullptr;
+ if (member) {
+ Audio::AudioStream *stream = Audio::makeVorbisStream(member->createReadStream(), DisposeAfterUse::YES);
+ return stream;
}
#endif
@@ -248,9 +242,8 @@ void AGSWaves::MusicPlay(int MusicToPlay, int repeat, int fadeinMS, int fadeoutM
_mixer->stopHandle(MFXStream._soundHandle);
// Load OGG file for music
- Common::FSNode fsNode = ::AGS::g_vm->getGameFolder().getChild(
- "Music").getChild(Common::String::format("music%d.mfx", MusicToPlay));
- Audio::AudioStream *musicStream = loadOGG(fsNode);
+ Common::ArchiveMemberPtr member = getFile(Common::String::format("music/music%d.mfx", MusicToPlay).c_str());
+ Audio::AudioStream *musicStream = loadOGG(member);
if (!musicStream)
return;
More information about the Scummvm-git-logs
mailing list