[Scummvm-git-logs] scummvm master -> 7134d15f2abade45830ec9a137d0b84e19b133dd
a-yyg
76591232+a-yyg at users.noreply.github.com
Fri Jul 2 00:43:24 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ac1e9837dd SAGA2: Merge SoundQueue with audioInterface
7134d15f2a SAGA2: Remove references to decoders in audioInterface
Commit: ac1e9837ddb7abd241a023dc103760001ad1a6d1
https://github.com/scummvm/scummvm/commit/ac1e9837ddb7abd241a023dc103760001ad1a6d1
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-02T08:28:58+09:00
Commit Message:
SAGA2: Merge SoundQueue with audioInterface
Changed paths:
R engines/saga2/audqueue.h
engines/saga2/audio.cpp
engines/saga2/audio.h
engines/saga2/audiobuf.cpp
engines/saga2/audiosys.h
engines/saga2/noise.cpp
engines/saga2/uidialog.cpp
diff --git a/engines/saga2/audio.cpp b/engines/saga2/audio.cpp
index d04847924b..c7a5f8531f 100644
--- a/engines/saga2/audio.cpp
+++ b/engines/saga2/audio.cpp
@@ -26,12 +26,14 @@
#include "saga2/saga2.h"
#include "saga2/audio.h"
+#include "saga2/fta.h"
+#include "saga2/shorten.h"
+#include "saga2/hresmgr.h"
#include "saga2/rect.h"
#include "saga2/queues.h"
#include "saga2/idtypes.h"
#include "saga2/audiosmp.h"
-#include "saga2/audqueue.h"
#include "saga2/audiosys.h"
#include "saga2/audiodec.h"
@@ -41,6 +43,10 @@ namespace Saga2 {
audioInterface *audio;
+extern hResContext *voiceRes;
+extern hResContext *soundRes;
+extern hResContext *musicRes;
+
bool initAudio() {
warning("STUB: initAudio()");
audio = new audioInterface();
@@ -88,18 +94,25 @@ void audioInterface::resumeGameClock(void) {
bool audioInterface::playFlag(void) {
debugC(5, kDebugSound, "STUB: audioInterface::playFlag()");
- return (!audio->queue.isPlaying() && audio->queue.getSize() > 0);
+ bool isSoundActive = g_system->getMixer()->isSoundHandleActive(audio->_speechSoundHandle);
+ return !isSoundActive && audio->_speechQueue.size() > 0;
}
void audioInterface::playMe(void) {
warning("STUB: audioInterface::PlayMe()");
- audio->queue.playNext();
+ SoundInstance si = audio->_speechQueue.pop();
+
+ Common::SeekableReadStream *stream = loadResourceToStream(voiceRes, si.seg, "voice data");
+
+ Audio::AudioStream *aud = makeShortenStream(*stream);
+
+ g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &audio->_speechSoundHandle, aud);
+
+ delete stream;
}
void audioInterface::playMusic(soundSegment s, int16 loopFactor, sampleLocation where) {
warning("STUB: audioInterface::queueMusic()");
-
-
}
void audioInterface::stopMusic(void) {
@@ -113,7 +126,13 @@ bool audioInterface::goodMIDICard(void) {
void audioInterface::queueSound(soundSegment s, decoderSet *, int16 loopFactor, sampleLocation where) {
warning("STUB: audioInterface::queueSound(%d, @%d,%d)", s, where.x, where.y);
- audio->queue.pushSound(s);
+ SoundInstance si;
+
+ si.seg = s;
+ si.loop = loopFactor;
+ si.loc = where;
+
+ audio->_sfxQueue.push(si);
}
void audioInterface::queueLoop(soundSegment s, decoderSet *sDec, int16 loopFactor, sampleLocation where) {
@@ -130,12 +149,28 @@ void audioInterface::setLoopPosition(sampleLocation newLoc) {
void audioInterface::queueVoice(soundSegment s, decoderSet *, sampleLocation where) {
warning("STUB: audioInterface::queueVoice(soundSegment, decoderSet *, sampleLocation)");
- audio->queue.pushVoice(s);
+ SoundInstance si;
+
+ si.seg = s;
+ si.loop = false;
+ si.loc = where;
+
+ audio->_speechQueue.push(si);
}
void audioInterface::queueVoice(soundSegment s[], decoderSet *, sampleLocation where) {
warning("STUB: audioInterface::queueVoice(soundSegment [], decoderSet *, sampleLocation)");
- audio->queue.pushVoice(s);
+ SoundInstance si;
+
+ soundSegment *p = s;
+ while (*p) {
+ si.seg = *p;
+ si.loop = false;
+ si.loc = where;
+
+ audio->_speechQueue.push(si);
+ p++;
+ }
}
void audioInterface::stopVoice(void) {
diff --git a/engines/saga2/audio.h b/engines/saga2/audio.h
index 4dab1ab807..78438570f7 100644
--- a/engines/saga2/audio.h
+++ b/engines/saga2/audio.h
@@ -27,6 +27,8 @@
#ifndef SAGA2_AUDIO_H
#define SAGA2_AUDIO_H
+#include "audio/mixer.h"
+
/* ===================================================================== *
the library(s) must be recompiled if you change these settings
* ===================================================================== */
diff --git a/engines/saga2/audiobuf.cpp b/engines/saga2/audiobuf.cpp
index 5868efc40c..e5d7670589 100644
--- a/engines/saga2/audiobuf.cpp
+++ b/engines/saga2/audiobuf.cpp
@@ -31,7 +31,6 @@
#include "saga2/queues.h"
#include "saga2/idtypes.h"
#include "saga2/audiosmp.h"
-#include "saga2/audqueue.h"
#include "saga2/audiosys.h"
#include "saga2/audiobuf.h"
diff --git a/engines/saga2/audiosys.h b/engines/saga2/audiosys.h
index b3375c0ce8..c4ad9d2023 100644
--- a/engines/saga2/audiosys.h
+++ b/engines/saga2/audiosys.h
@@ -128,6 +128,11 @@ private:
/* Audio Interface Class */
/* */
/*******************************************************************/
+struct SoundInstance {
+ soundSegment seg;
+ bool loop;
+ sampleLocation loc;
+};
class audioInterface {
public:
@@ -216,7 +221,12 @@ private:
int32 suspendCalls;
public:
- SoundQueue queue; // the queue
+ Audio::SoundHandle _speechSoundHandle;
+ Audio::SoundHandle _sfxSoundHandle;
+ Audio::SoundHandle _bgmSoundHandle;
+ Common::Queue<SoundInstance> _speechQueue;
+ Common::Queue<SoundInstance> _sfxQueue;
+ Common::Queue<SoundInstance> _bgmQueue;
HDIGDRIVER dig; // AIL sample driver
HMDIDRIVER mid; // AIL MIDI driver
audioAttenuationFunction attenuator;
@@ -299,7 +309,7 @@ public:
verbosity = n;
}
int16 getQueueSize(void) {
- return queue.getSize();
+ return _speechQueue.size() + _sfxQueue.size() + _bgmQueue.size();
}
// moving sample calls
diff --git a/engines/saga2/audqueue.h b/engines/saga2/audqueue.h
deleted file mode 100644
index 8466f3796f..0000000000
--- a/engines/saga2/audqueue.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Based on the original sources
- * Faery Tale II -- The Halls of the Dead
- * (c) 1993-1996 The Wyrmkeep Entertainment Co.
- */
-
-#ifndef SAGA2_AUDQUEUE_H
-#define SAGA2_AUDQUEUE_H
-
-#include "audio/mixer.h"
-#include "saga2/saga2.h"
-#include "saga2/fta.h"
-#include "saga2/shorten.h"
-#include "saga2/hresmgr.h"
-
-namespace Saga2 {
-
-extern hResContext *voiceRes;
-extern hResContext *soundRes;
-extern hResContext *musicRes;
-
-class SoundQueue {
-private:
- Common::Queue<soundSegment> _speechQueue;
- Common::Queue<soundSegment> _sfxQueue;
- Common::Queue<soundSegment> _bgmQueue;
- Audio::SoundHandle _speechSoundHandle;
- Audio::SoundHandle _sfxSoundHandle;
- Audio::SoundHandle _bgmSoundHandle;
-
- soundSegment _currentSpeech;
-
-public:
- SoundQueue() {
- _currentSpeech = 0;
- }
-
- void pushVoice(soundSegment s) {
- _speechQueue.push(s);
- }
-
- void pushVoice(soundSegment s[]) {
- soundSegment *p = s;
- while (*p) {
- _speechQueue.push(*p);
- p++;
- }
- }
-
- void pushSound(soundSegment s) {
- _sfxQueue.push(s);
- }
-
- void pushMusic(soundSegment s) {
- _bgmQueue.push(s);
- }
-
- void playNext() {
- if (_speechQueue.size()) {
- soundSegment s = _speechQueue.pop();
- _currentSpeech = s;
- playSpeech(s);
- }
-
- if (_sfxQueue.size()) {
- soundSegment s = _sfxQueue.pop();
- playSound(s);
- }
- }
-
- void playSpeech(soundSegment s) {
- Common::SeekableReadStream *stream = loadResourceToStream(voiceRes, s, "voice data");
-
- Audio::AudioStream *aud = makeShortenStream(*stream);
-
- g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &_speechSoundHandle, aud);
-
- delete stream;
- }
-
- void playSound(soundSegment s) {
- warning("STUB: SoundQueue::playSound");
-
-#if 0
- Common::SeekableReadStream *stream = loadResourceToStream(soundRes, s, "voice data");
-
- Audio::AudioStream *aud = makeShortenStream(*stream);
-
- g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &_sfxSoundHandle, aud);
-
- delete stream;
-#endif
- }
-
- void playMusic(soundSegment s) {
- warning("STUB: SoundQueue::playMusic");
-
-#if 0
- Common::SeekableReadStream *stream = loadResourceToStream(musicRes, s, "voice data");
-
- Audio::AudioStream *aud = makeShortenStream(*stream);
-
- g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &_bgmSoundHandle, aud);
-
- delete stream;
-#endif
- }
-
- bool isSpeechPlaying() {
- return g_system->getMixer()->isSoundHandleActive(_speechSoundHandle);
- }
-
- bool isSpeechPlaying(soundSegment s) {
- debugC(2, kDebugSound, "STUB: Sound: isSpeechPlaying(%d) vs %d", s, _currentSpeech);
- return isSpeechPlaying() && _currentSpeech <= s;
- }
-
- bool isSoundPlaying() {
- return g_system->getMixer()->isSoundHandleActive(_sfxSoundHandle);
- }
-
- bool isMusicPlaying() {
- return g_system->getMixer()->isSoundHandleActive(_bgmSoundHandle);
- }
-
- bool isPlaying() {
- return isSpeechPlaying() || isSoundPlaying() || isMusicPlaying();
- }
-
- int getSize() {
- return _speechQueue.size() + _sfxQueue.size() + _bgmQueue.size();
- }
-};
-
-} // end of namespace Saga2
-
-#endif
diff --git a/engines/saga2/noise.cpp b/engines/saga2/noise.cpp
index 5820956ca1..798a350710 100644
--- a/engines/saga2/noise.cpp
+++ b/engines/saga2/noise.cpp
@@ -37,7 +37,6 @@
#include "saga2/player.h"
#include "saga2/queues.h"
#include "saga2/audiosmp.h"
-#include "saga2/audqueue.h"
#include "saga2/audiosys.h"
#include "saga2/hresmgr.h"
#include "saga2/shorten.h"
@@ -632,7 +631,7 @@ void moveLoop(Location loc) {
bool stillDoingVoice(uint32 sampno) {
warning("STUB: stillDoingVoice(%s)", tag2strP(sampno));
- return audio->queue.isSpeechPlaying(sampno);
+ return g_system->getMixer()->isSoundHandleActive(audio->_speechSoundHandle);
}
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index 2419650af3..0a7f5466fc 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -39,7 +39,6 @@
#include "saga2/queues.h"
#include "saga2/audiosmp.h"
-#include "saga2/audqueue.h"
#include "saga2/audiosys.h"
#include "saga2/uidialog.h"
Commit: 7134d15f2abade45830ec9a137d0b84e19b133dd
https://github.com/scummvm/scummvm/commit/7134d15f2abade45830ec9a137d0b84e19b133dd
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-02T09:42:06+09:00
Commit Message:
SAGA2: Remove references to decoders in audioInterface
Changed paths:
engines/saga2/audio.cpp
engines/saga2/audiosys.h
engines/saga2/noise.cpp
diff --git a/engines/saga2/audio.cpp b/engines/saga2/audio.cpp
index c7a5f8531f..4f0d69270b 100644
--- a/engines/saga2/audio.cpp
+++ b/engines/saga2/audio.cpp
@@ -124,7 +124,7 @@ bool audioInterface::goodMIDICard(void) {
return false;
}
-void audioInterface::queueSound(soundSegment s, decoderSet *, int16 loopFactor, sampleLocation where) {
+void audioInterface::queueSound(soundSegment s, int16 loopFactor, sampleLocation where) {
warning("STUB: audioInterface::queueSound(%d, @%d,%d)", s, where.x, where.y);
SoundInstance si;
@@ -135,7 +135,7 @@ void audioInterface::queueSound(soundSegment s, decoderSet *, int16 loopFactor,
audio->_sfxQueue.push(si);
}
-void audioInterface::queueLoop(soundSegment s, decoderSet *sDec, int16 loopFactor, sampleLocation where) {
+void audioInterface::queueLoop(soundSegment s, int16 loopFactor, sampleLocation where) {
warning("STUB: audioInterface::queueLoop()");
}
@@ -147,8 +147,8 @@ void audioInterface::setLoopPosition(sampleLocation newLoc) {
warning("STUB: audioInterface::setLoopPosition(%d,%d)", newLoc.x, newLoc.y);
}
-void audioInterface::queueVoice(soundSegment s, decoderSet *, sampleLocation where) {
- warning("STUB: audioInterface::queueVoice(soundSegment, decoderSet *, sampleLocation)");
+void audioInterface::queueVoice(soundSegment s, sampleLocation where) {
+ warning("STUB: audioInterface::queueVoice(soundSegment, sampleLocation)");
SoundInstance si;
si.seg = s;
@@ -158,8 +158,8 @@ void audioInterface::queueVoice(soundSegment s, decoderSet *, sampleLocation whe
audio->_speechQueue.push(si);
}
-void audioInterface::queueVoice(soundSegment s[], decoderSet *, sampleLocation where) {
- warning("STUB: audioInterface::queueVoice(soundSegment [], decoderSet *, sampleLocation)");
+void audioInterface::queueVoice(soundSegment s[], sampleLocation where) {
+ warning("STUB: audioInterface::queueVoice(soundSegment [], sampleLocation)");
SoundInstance si;
soundSegment *p = s;
diff --git a/engines/saga2/audiosys.h b/engines/saga2/audiosys.h
index c4ad9d2023..47032cd6dd 100644
--- a/engines/saga2/audiosys.h
+++ b/engines/saga2/audiosys.h
@@ -31,8 +31,6 @@ namespace Saga2 {
class Buffer;
class musicBuffer;
-class soundQueue;
-class decoderSet;
/*******************************************************************/
/* DRIVERS subdirectory */
@@ -263,14 +261,12 @@ public:
bool goodMIDICard(void);
// sound calls
- void queueSound(soundSegment s, decoderSet *, int16 loopFactor = 1, sampleLocation where = Here);
- //void queueSoundAt( soundSegment s, decoderSet *, sampleLocation where, int16 loopFactor=1);
- void queueSoundSample(positionedSample *ss, decoderSet *sDec, int16 loopFactor);
+ void queueSound(soundSegment s, int16 loopFactor = 1, sampleLocation where = Here);
+ void queueSoundSample(positionedSample *ss, int16 loopFactor);
// loop calls
- void queueLoop(soundSegment s, decoderSet *sDec, int16 loopFactor = 0, sampleLocation where = Here);
- //void queueLoopAt( soundSegment s, decoderSet *sDec, sampleLocation where , int16 loopFactor=0 );
- void queueLoopSample(positionedSample *ss, decoderSet *sDec, int16 loopFactor = 0);
+ void queueLoop(soundSegment s, int16 loopFactor = 0, sampleLocation where = Here);
+ void queueLoopSample(positionedSample *ss, int16 loopFactor = 0);
void stopLoop(void);
void setLoopPosition(sampleLocation newLoc);
soundSegment currentLoop(void) {
@@ -278,8 +274,8 @@ public:
}
// voice calls
- void queueVoice(soundSegment s, decoderSet *, sampleLocation where = Here);
- void queueVoice(soundSegment s[], decoderSet *, sampleLocation where = Here);
+ void queueVoice(soundSegment s, sampleLocation where = Here);
+ void queueVoice(soundSegment s[], sampleLocation where = Here);
void stopVoice(void);
void endVoice(sampleStopLevel ssl = sStopCleanup);
void resetState(BufferRequest br);
@@ -317,18 +313,7 @@ public:
private:
- void load_drivers(const char *driver_path = DRIVER_PATH, const char *undriver_path = UNDRIVER_PATH);
- void load_dig_driver(void);
- void load_mid_driver(void);
- bool notEmpty(void);
- BufferRequest needBuffer(positionedSample *ss, BufferRequest needBufNo);
- void format(void);
- void openSample(decoderSet *decList, Buffer *); // open/seek function
- void closeSample(decoderSet *decList, Buffer *); // close/flush function
- void playSample(decoderSet *decList, BufferRequest, positionedSample *); // read/load function
- sampleFlags playQueue(decoderSet *decList, BufferRequest, soundQueue *); // read/load function
void playMusic(decoderSet *decList, BufferRequest targBuffer, positionedSample *ss, int16 loopFactor);
- void makeWriteable(Buffer *sb); // buffer release
void setSoundMasterVolume(Volume val);
void setMusicMasterVolume(Volume val);
diff --git a/engines/saga2/noise.cpp b/engines/saga2/noise.cpp
index 798a350710..1b351ab2b4 100644
--- a/engines/saga2/noise.cpp
+++ b/engines/saga2/noise.cpp
@@ -451,7 +451,7 @@ void playMemSound(uint32 s) {
debugC(1, kDebugSound, "playMemSound(%s)", tag2strP(s));
if (bufCheckResID(NULL, s))
- audio->queueSound(s, memDec, 1, Here);
+ audio->queueSound(s, 1, Here);
}
//-----------------------------------------------------------------------
@@ -461,7 +461,7 @@ void playSound(uint32 s) {
debugC(1, kDebugSound, "playSound(%s)", tag2strP(s));
if (hResCheckResID(soundRes, s))
- audio->queueSound(s, soundDec, 1, Here);
+ audio->queueSound(s, 1, Here);
}
//-----------------------------------------------------------------------
@@ -471,7 +471,7 @@ void playLongSound(uint32 s) {
debugC(1, kDebugSound, "playLongSound(%s)", tag2strP(s));
if (hResCheckResID(longRes, s))
- audio->queueVoice(s, longSoundDec);
+ audio->queueVoice(s);
else
audio->stopVoice();
}
@@ -484,7 +484,7 @@ void playVoice(uint32 s) {
if (hResCheckResID(voiceRes, s)) {
if (s)
- audio->queueVoice(s, voiceDec, Here);
+ audio->queueVoice(s, Here);
else
audio->stopVoice();
}
@@ -504,7 +504,7 @@ bool sayVoice(uint32 s[]) {
bool worked = false;
if (hResCheckResID(voiceRes, s)) {
- audio->queueVoice(s, voiceDec, Here);
+ audio->queueVoice(s, Here);
if (audio->talking())
worked = true;
}
@@ -530,7 +530,7 @@ void _playLoop(uint32 s) {
warning("Size: %d", size);
Common::hexdump(data, MIN<uint>(size, 256));
- audio->queueLoop(s, loopDec, 0, Here);
+ audio->queueLoop(s, 0, Here);
}
//-----------------------------------------------------------------------
@@ -553,7 +553,7 @@ void playSoundAt(uint32 s, Point32 p) {
debugC(1, kDebugSound, "playSoundAt(%s, %d,%d)", tag2strP(s), p.x, p.y);
if (hResCheckResID(soundRes, s))
- audio->queueSound(s, soundDec, 1, p);
+ audio->queueSound(s, 1, p);
}
void playSoundAt(uint32 s, Location playAt) {
@@ -573,7 +573,7 @@ bool sayVoiceAt(uint32 s[], Point32 p) {
debugC(1, kDebugSound, "], %d,%d)", p.x, p.y);
- audio->queueVoice(s, voiceDec, p);
+ audio->queueVoice(s, p);
return true;
}
@@ -592,7 +592,7 @@ void playLoopAt(uint32 s, Point32 loc) {
debugC(1, kDebugSound, "playLoopAt(%s, %d,%d)", tag2strP(s), loc.x, loc.y);
if (hResCheckResID(loopRes, s))
- audio->queueLoop(s, loopDec, 0, loc);
+ audio->queueLoop(s, 0, loc);
else
audio->stopLoop();
}
More information about the Scummvm-git-logs
mailing list