aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Battaglia2009-03-15 10:25:22 +0000
committerFabio Battaglia2009-03-15 10:25:22 +0000
commit647276b8859210223c10abe51c09aac5fb6e9159 (patch)
tree319fcf6d9c4bcff781a6038d5a6063305b09fd23
parent08638c5f772667ea70807bd8780164f0084df147 (diff)
downloadscummvm-rg350-647276b8859210223c10abe51c09aac5fb6e9159.tar.gz
scummvm-rg350-647276b8859210223c10abe51c09aac5fb6e9159.tar.bz2
scummvm-rg350-647276b8859210223c10abe51c09aac5fb6e9159.zip
Moving sword1/vag.* into sound/, to be used by Broken Sword 2 PSX
svn-id: r39416
-rw-r--r--engines/sword1/module.mk3
-rw-r--r--engines/sword1/music.cpp4
-rw-r--r--engines/sword1/sound.cpp6
-rw-r--r--sound/module.mk1
-rw-r--r--sound/vag.cpp (renamed from engines/sword1/vag.cpp)4
-rw-r--r--sound/vag.h (renamed from engines/sword1/vag.h)14
6 files changed, 18 insertions, 14 deletions
diff --git a/engines/sword1/module.mk b/engines/sword1/module.mk
index e7297bfecd..1dbff19464 100644
--- a/engines/sword1/module.mk
+++ b/engines/sword1/module.mk
@@ -18,8 +18,7 @@ MODULE_OBJS := \
sound.o \
staticres.o \
sword1.o \
- text.o \
- vag.o
+ text.o
# This module can be built as a plugin
ifeq ($(ENABLE_SWORD1), DYNAMIC_PLUGIN)
diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp
index 8553b6a286..850a861f67 100644
--- a/engines/sword1/music.cpp
+++ b/engines/sword1/music.cpp
@@ -31,7 +31,6 @@
#include "sword1/sword1.h"
#include "sword1/music.h"
-#include "sword1/vag.h"
#include "sound/aiff.h"
#include "sound/flac.h"
@@ -39,6 +38,7 @@
#include "sound/mp3.h"
#include "sound/vorbis.h"
#include "sound/wave.h"
+#include "sound/vag.h"
#define SMP_BUFSIZE 8192
@@ -274,7 +274,7 @@ bool MusicHandle::playPSX(uint16 id, bool loop) {
if (size != 0xffffffff) {
_file.seek(offset, SEEK_SET);
- _audioSource = new VagStream(_file.readStream(size), loop);
+ _audioSource = new Audio::VagStream(_file.readStream(size), loop);
fadeUp();
} else {
_audioSource = NULL;
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index cab3c2d2a4..d03afa809a 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -34,12 +34,12 @@
#include "sword1/resman.h"
#include "sword1/logic.h"
#include "sword1/sword1.h"
-#include "sword1/vag.h"
#include "sound/flac.h"
#include "sound/mp3.h"
#include "sound/vorbis.h"
#include "sound/wave.h"
+#include "sound/vag.h"
namespace Sword1 {
@@ -169,7 +169,7 @@ void Sound::playSample(QueueElement *elem) {
if (SwordEngine::isPsx()) { ;
uint32 size = READ_LE_UINT32(sampleData);
- Audio::AudioStream *audStream = new VagStream(new Common::MemoryReadStream(sampleData + 4, size-4), _fxList[elem->id].type == FX_LOOP);
+ Audio::AudioStream *audStream = new Audio::VagStream(new Common::MemoryReadStream(sampleData + 4, size-4), _fxList[elem->id].type == FX_LOOP);
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan, false, false, false);
} else {
uint32 size = READ_LE_UINT32(sampleData + 0x28);
@@ -268,7 +268,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
_mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_speechHandle, data, size, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID, speechVol, speechPan);
} else if (_cowMode == CowPSX && sampleSize != 0xffffffff) {
_cowFile.seek(index * 2048);
- _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, new VagStream(_cowFile.readStream(sampleSize)), SOUND_SPEECH_ID, speechVol, speechPan);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, new Audio::VagStream(_cowFile.readStream(sampleSize)), SOUND_SPEECH_ID, speechVol, speechPan);
// with compressed audio, we can't calculate the wave volume.
// so default to talking.
for (int cnt = 0; cnt < 480; cnt++)
diff --git a/sound/module.mk b/sound/module.mk
index c11716a107..bcf101d78e 100644
--- a/sound/module.mk
+++ b/sound/module.mk
@@ -19,6 +19,7 @@ MODULE_OBJS := \
null.o \
shorten.o \
timestamp.o \
+ vag.o \
voc.o \
vorbis.o \
wave.o \
diff --git a/engines/sword1/vag.cpp b/sound/vag.cpp
index afd064ad4a..df596b00dc 100644
--- a/engines/sword1/vag.cpp
+++ b/sound/vag.cpp
@@ -23,9 +23,9 @@
*
*/
-#include "sword1/vag.h"
+#include "sound/vag.h"
-namespace Sword1 {
+namespace Audio {
VagStream::VagStream(Common::SeekableReadStream *stream, bool loop) : _stream(stream) {
_samplesRemaining = 0;
diff --git a/engines/sword1/vag.h b/sound/vag.h
index e9f429a599..2b3e35b35d 100644
--- a/engines/sword1/vag.h
+++ b/sound/vag.h
@@ -22,14 +22,19 @@
* $Id$
*
*/
-
-#ifndef SWORD1_VAG_H
-#define SWORD1_VAG_H
+
+/* Sound decoder used in engines:
+ * sword1 (PSX port of the game)
+ * sword2 (PSX port of the game)
+ */
+
+#ifndef SOUND_VAG_H
+#define SOUND_VAG_H
#include "sound/audiostream.h"
#include "common/stream.h"
-namespace Sword1 {
+namespace Audio {
class VagStream : public Audio::AudioStream {
public:
@@ -40,7 +45,6 @@ public:
bool endOfData() const { return _stream->pos() == _stream->size(); }
int getRate() const { return 11025; }
int readBuffer(int16 *buffer, const int numSamples);
-
void rewind();
private: