aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/director.cpp3
-rw-r--r--engines/director/director.h2
-rw-r--r--engines/director/module.mk1
-rw-r--r--engines/director/score.cpp1
-rw-r--r--engines/director/sound.cpp67
-rw-r--r--engines/director/sound.h48
6 files changed, 121 insertions, 1 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 50c4fbdb4c..28651fa8f5 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -41,6 +41,7 @@
#include "director/resource.h"
#include "director/score.h"
#include "director/lingo/lingo.h"
+#include "director/sound.h"
namespace Director {
@@ -69,6 +70,8 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
+ _soundManager = new DirectorSound();
+
//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
diff --git a/engines/director/director.h b/engines/director/director.h
index 205495a62a..9750ad9cc8 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -42,6 +42,7 @@ enum DirectorGameID {
class Archive;
struct DirectorGameDescription;
class Lingo;
+class DirectorSound;
class DirectorEngine : public ::Engine {
public:
@@ -77,6 +78,7 @@ private:
Archive *_mainArchive;
Common::MacResManager *_macBinary;
+ DirectorSound *_soundManager;
Lingo *_lingo;
};
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 6f2e2165a8..4c2628c075 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
director.o \
resource.o \
score.o \
+ sound.o \
lingo/lingo.o
# This module can be built as a plugin
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b95a50e352..25631d569d 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -632,7 +632,6 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
sprite._flags = stream.readUint16BE();
sprite._ink = static_cast<inkType>(sprite._flags & 0x3f); //TODO more flags?
sprite._trails = sprite._flags & 0x40;
- debug("%d", sprite._trails);
fieldPosition += 2;
break;
case kSpritePositionCastId:
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
new file mode 100644
index 0000000000..35071c8072
--- /dev/null
+++ b/engines/director/sound.cpp
@@ -0,0 +1,67 @@
+/* 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.
+*
+*/
+
+#include "director/sound.h"
+#include "audio/decoders/wave.h"
+#include "common/file.h"
+#include "audio/decoders/aiff.h"
+#include "common/system.h"
+#include "common/debug.h"
+
+namespace Director {
+
+DirectorSound::DirectorSound() {
+ _soundHandle = new Audio::SoundHandle();
+ _mixer = g_system->getMixer();
+}
+
+void DirectorSound::playWAV(Common::String filename) {
+ Common::File *file = new Common::File();
+
+ if (!file->open(filename)) {
+ warning("Failed to open %s", filename.c_str());
+ delete file;
+ return;
+ }
+
+ Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound);
+}
+
+void DirectorSound::playAIFF(Common::String filename) {
+
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
+ warning("Failed to open %s", filename.c_str());
+ delete file;
+ return;
+ }
+
+ Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound);
+}
+
+void DirectorSound::stopSound() {
+ _mixer->stopHandle(*_soundHandle);
+}
+
+} //End of namespace Director
diff --git a/engines/director/sound.h b/engines/director/sound.h
new file mode 100644
index 0000000000..3d842c8b51
--- /dev/null
+++ b/engines/director/sound.h
@@ -0,0 +1,48 @@
+/* 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.
+*
+*/
+
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
+#include "common/str.h"
+
+
+#ifndef DIRECTOR_SOUND_H
+#define DIRECTOR_SOUND_H
+namespace Director {
+
+class DirectorSound {
+
+private:
+ Audio::SoundHandle *_soundHandle;
+ Audio::Mixer *_mixer;
+
+public:
+ DirectorSound();
+
+ void playWAV(Common::String filename);
+ void playAIFF(Common::String filename);
+ void stopSound();
+};
+
+} // End of namespace Director
+
+#endif