aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2014-12-07 22:28:03 +0100
committerPaul Gilbert2014-12-12 23:02:56 -0500
commit07456932d4be48fcf27a991d9d764a111abc5524 (patch)
tree1d07350a6cfb4f3fd933ed1756636acfa1e0f5f6 /engines
parent3cf08939797c1963264cf1ef49ed227fba3daf00 (diff)
downloadscummvm-rg350-07456932d4be48fcf27a991d9d764a111abc5524.tar.gz
scummvm-rg350-07456932d4be48fcf27a991d9d764a111abc5524.tar.bz2
scummvm-rg350-07456932d4be48fcf27a991d9d764a111abc5524.zip
ACCESS: Add a debug channel for the sound & music handling
Diffstat (limited to 'engines')
-rw-r--r--engines/access/access.cpp1
-rw-r--r--engines/access/access.h3
-rw-r--r--engines/access/sound.cpp42
3 files changed, 36 insertions, 10 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 428c4c603a..b63bb29e0a 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -120,6 +120,7 @@ void AccessEngine::initialize() {
DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
+ DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling");
if (isCD()) {
const Common::FSNode gameDataDir(ConfMan.get("path"));
diff --git a/engines/access/access.h b/engines/access/access.h
index 2fdf26318e..284ac2690c 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -71,7 +71,8 @@ enum {
enum AccessDebugChannels {
kDebugPath = 1 << 0,
kDebugScripts = 1 << 1,
- kDebugGraphics = 1 << 2
+ kDebugGraphics = 1 << 2,
+ kDebugSound = 1 << 3
};
struct AccessGameDescription;
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 95576d212b..b5800ba82f 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -30,8 +30,7 @@
namespace Access {
-SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) :
- _vm(vm), _mixer(mixer) {
+SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
_playingSound = false;
_isVoice = false;
}
@@ -41,12 +40,16 @@ SoundManager::~SoundManager() {
}
void SoundManager::clearSounds() {
+ debugC(1, kDebugSound, "clearSounds()");
+
for (uint i = 0; i < _soundTable.size(); ++i)
delete _soundTable[i]._res;
_soundTable.clear();
}
void SoundManager::queueSound(int idx, int fileNum, int subfile) {
+ debugC(1, kDebugSound, "queueSound(%d, %d, %d)", idx, fileNum, subfile);
+
Resource *soundResource;
if (idx >= (int)_soundTable.size())
@@ -59,15 +62,20 @@ void SoundManager::queueSound(int idx, int fileNum, int subfile) {
}
Resource *SoundManager::loadSound(int fileNum, int subfile) {
+ debugC(1, kDebugSound, "loadSound(%d, %d)", fileNum, subfile);
return _vm->_files->loadFile(fileNum, subfile);
}
void SoundManager::playSound(int soundIndex) {
+ debugC(1, kDebugSound, "playSound(%d)", soundIndex);
+
int priority = _soundTable[soundIndex]._priority;
playSound(_soundTable[soundIndex]._res, priority);
}
void SoundManager::playSound(Resource *res, int priority) {
+ debugC(1, kDebugSound, "playSound");
+
byte *resourceData = res->data();
Audio::SoundHandle audioHandle;
Audio::RewindableAudioStream *audioStream = 0;
@@ -125,6 +133,8 @@ void SoundManager::playSound(Resource *res, int priority) {
}
void SoundManager::loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds) {
+ debugC(1, kDebugSound, "loadSounds");
+
clearSounds();
for (uint i = 0; i < sounds.size(); ++i) {
@@ -134,10 +144,14 @@ void SoundManager::loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds) {
}
void SoundManager::stopSound() {
+ debugC(3, kDebugSound, "stopSound");
+
_mixer->stopHandle(Audio::SoundHandle());
}
void SoundManager::freeSounds() {
+ debugC(3, kDebugSound, "freeSounds");
+
stopSound();
clearSounds();
}
@@ -177,7 +191,8 @@ void MusicManager::send(uint32 b) {
}
void MusicManager::midiPlay() {
- warning("MusicManager::midiPlay");
+ debugC(1, kDebugSound, "midiPlay");
+
if (_music->_size < 4) {
error("midiPlay() wrong music resource size");
}
@@ -208,12 +223,13 @@ void MusicManager::midiPlay() {
}
bool MusicManager::checkMidiDone() {
- warning("MusicManager::checkMidiDone");
+ debugC(1, kDebugSound, "checkMidiDone");
return (!_isPlaying);
}
void MusicManager::midiRepeat() {
- warning("MusicManager::midiRepeat");
+ debugC(1, kDebugSound, "midiRepeat");
+
if (!_parser)
return;
@@ -224,22 +240,26 @@ void MusicManager::midiRepeat() {
}
void MusicManager::stopSong() {
- warning("MusicManager::stopSong");
+ debugC(1, kDebugSound, "stopSong");
+
stop();
}
void MusicManager::loadMusic(int fileNum, int subfile) {
- warning("MusicManager::loadMusic %d %d", fileNum, subfile);
+ debugC(1, kDebugSound, "loadMusic(%d, %d)", fileNum, subfile);
+
_music = _vm->_files->loadFile(fileNum, subfile);
}
void MusicManager::loadMusic(FileIdent file) {
- warning("MusicManager::loadMusic %d %d", file._fileNum, file._subfile);
+ debugC(1, kDebugSound, "loadMusic(%d, %d)", file._fileNum, file._subfile);
+
_music = _vm->_files->loadFile(file);
}
void MusicManager::newMusic(int musicId, int mode) {
- warning("MusicManager::newMusic %d %d", musicId, mode);
+ debugC(1, kDebugSound, "newMusic(%d, %d)", musicId, mode);
+
if (mode == 1) {
stopSong();
freeMusic();
@@ -258,11 +278,15 @@ void MusicManager::newMusic(int musicId, int mode) {
}
void MusicManager::freeMusic() {
+ debugC(3, kDebugSound, "freeMusic");
+
delete _music;
_music = nullptr;
}
void MusicManager::setLoop(bool loop) {
+ debugC(3, kDebugSound, "setLoop");
+
_isLooping = loop;
if (_parser)
_parser->property(MidiParser::mpAutoLoop, _isLooping);