aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorOri Avtalion2016-04-14 17:43:56 +0300
committerOri Avtalion2016-04-14 17:43:56 +0300
commitd32941f657397975936dd3f0b2df708438ea355e (patch)
treec3fa5338801327dfd78741d9bf7fedc627846d37 /engines
parent5e4980090198a334b136bcdce16ea6addbe708a2 (diff)
downloadscummvm-rg350-d32941f657397975936dd3f0b2df708438ea355e.tar.gz
scummvm-rg350-d32941f657397975936dd3f0b2df708438ea355e.tar.bz2
scummvm-rg350-d32941f657397975936dd3f0b2df708438ea355e.zip
FULLPIPE: Reduce audio header dependencies
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/fullpipe.cpp4
-rw-r--r--engines/fullpipe/fullpipe.h8
-rw-r--r--engines/fullpipe/sound.cpp22
-rw-r--r--engines/fullpipe/sound.h8
4 files changed, 27 insertions, 15 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index ebaff32550..c2aae9ba88 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -24,6 +24,7 @@
#include "common/archive.h"
#include "common/config-manager.h"
+#include "audio/mixer.h"
#include "engines/util.h"
@@ -112,6 +113,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_musicLocal = 0;
_trackStartDelay = 0;
+ _sceneTrackHandle = new Audio::SoundHandle();
+
memset(_sceneTracks, 0, sizeof(_sceneTracks));
memset(_trackName, 0, sizeof(_trackName));
memset(_sceneTracksCurrentTrack, 0, sizeof(_sceneTracksCurrentTrack));
@@ -192,6 +195,7 @@ FullpipeEngine::~FullpipeEngine() {
delete _rnd;
delete _console;
delete _globalMessageQueueList;
+ delete _sceneTrackHandle;
}
void FullpipeEngine::initialize() {
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 7f20a6d6af..fba61aa13b 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -30,8 +30,6 @@
#include "common/savefile.h"
#include "common/system.h"
-#include "audio/mixer.h"
-
#include "graphics/transparent_surface.h"
#include "engines/engine.h"
@@ -41,6 +39,10 @@
struct ADGameDescription;
+namespace Audio {
+class SoundHandle;
+}
+
namespace Fullpipe {
enum FullpipeGameFeatures {
@@ -312,7 +314,7 @@ public:
void lift_openLift();
GameVar *_musicGameVar;
- Audio::SoundHandle _sceneTrackHandle;
+ Audio::SoundHandle *_sceneTrackHandle;
public:
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 230d6c39a9..c82c2c414c 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -30,6 +30,7 @@
#include "fullpipe/statics.h"
#include "common/memstream.h"
+#include "audio/mixer.h"
#include "audio/audiostream.h"
#include "audio/decoders/vorbis.h"
#include "audio/decoders/wave.h"
@@ -96,12 +97,13 @@ Sound::Sound() {
memset(_directSoundBuffers, 0, sizeof(_directSoundBuffers));
_description = 0;
_volume = 100;
+ _handle = new Audio::SoundHandle();
}
Sound::~Sound() {
freeSound();
-
free(_description);
+ delete _handle;
}
bool Sound::load(MfcArchive &file, NGIArchive *archive) {
@@ -206,14 +208,14 @@ void Sound::setPanAndVolumeByStaticAni() {
}
void Sound::setPanAndVolume(int vol, int pan) {
- g_fp->_mixer->setChannelVolume(_handle, vol / 39); // 0..10000
- g_fp->_mixer->setChannelBalance(_handle, pan / 78); // -10000..10000
+ g_fp->_mixer->setChannelVolume(*_handle, vol / 39); // 0..10000
+ g_fp->_mixer->setChannelBalance(*_handle, pan / 78); // -10000..10000
}
void Sound::play(int flag) {
- Audio::SoundHandle handle = getHandle();
+ Audio::SoundHandle *handle = getHandle();
- if (g_fp->_mixer->isSoundHandleActive(handle))
+ if (g_fp->_mixer->isSoundHandleActive(*handle))
return;
byte *soundData = loadData();
@@ -221,7 +223,7 @@ void Sound::play(int flag) {
Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES);
Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1);
- g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream);
+ g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, audioStream);
}
void Sound::freeSound() {
@@ -231,11 +233,11 @@ void Sound::freeSound() {
}
int Sound::getVolume() {
- return g_fp->_mixer->getChannelVolume(_handle) * 39; // 0..10000
+ return g_fp->_mixer->getChannelVolume(*_handle) * 39; // 0..10000
}
void Sound::stop() {
- g_fp->_mixer->stopHandle(_handle);
+ g_fp->_mixer->stopHandle(*_handle);
}
void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) {
@@ -353,7 +355,7 @@ void FullpipeEngine::startSoundStream1(char *trackName) {
stopAllSoundStreams();
#ifdef USE_VORBIS
- if (_mixer->isSoundHandleActive(_sceneTrackHandle))
+ if (_mixer->isSoundHandleActive(*_sceneTrackHandle))
return;
Common::File *track = new Common::File();
@@ -363,7 +365,7 @@ void FullpipeEngine::startSoundStream1(char *trackName) {
return;
}
Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES);
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _sceneTrackHandle, ogg);
#endif
}
diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h
index 14e766f5bb..983f28312b 100644
--- a/engines/fullpipe/sound.h
+++ b/engines/fullpipe/sound.h
@@ -23,6 +23,10 @@
#ifndef FULLPIPE_SOUND_H
#define FULLPIPE_SOUND_H
+namespace Audio {
+class SoundHandle;
+}
+
namespace Fullpipe {
class Sound : public MemoryObject {
@@ -31,7 +35,7 @@ class Sound : public MemoryObject {
int _directSoundBuffer;
int _directSoundBuffers[7];
byte *_soundData;
- Audio::SoundHandle _handle;
+ Audio::SoundHandle *_handle;
int _volume;
public:
@@ -45,7 +49,7 @@ public:
virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class
void updateVolume();
int getId() const { return _id; }
- Audio::SoundHandle getHandle() const { return _handle; }
+ Audio::SoundHandle *getHandle() const { return _handle; }
void play(int flag);
void freeSound();