aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/sound.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2007-05-12 12:56:35 +0000
committerNicola Mettifogo2007-05-12 12:56:35 +0000
commit346f0746d6c83623498a8dc57018d60cb1372b3b (patch)
tree1720ca5956a1bbf2c5c4181631c5d7ed14bc881d /engines/parallaction/sound.cpp
parent069e84b33be5b5d0579019bf87fdf1518e888418 (diff)
downloadscummvm-rg350-346f0746d6c83623498a8dc57018d60cb1372b3b.tar.gz
scummvm-rg350-346f0746d6c83623498a8dc57018d60cb1372b3b.tar.bz2
scummvm-rg350-346f0746d6c83623498a8dc57018d60cb1372b3b.zip
Added Audio debug level and fixed a bug when freeing music streams.
svn-id: r26804
Diffstat (limited to 'engines/parallaction/sound.cpp')
-rw-r--r--engines/parallaction/sound.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/engines/parallaction/sound.cpp b/engines/parallaction/sound.cpp
index 8a00b2972f..07a5528c32 100644
--- a/engines/parallaction/sound.cpp
+++ b/engines/parallaction/sound.cpp
@@ -231,10 +231,14 @@ DosSoundMan::DosSoundMan(Parallaction *vm, MidiDriver *midiDriver) : SoundMan(vm
}
DosSoundMan::~DosSoundMan() {
+ debugC(1, kDebugAudio, "DosSoundMan::playMusic()");
+
delete _midiPlayer;
}
void DosSoundMan::playMusic() {
+ debugC(1, kDebugAudio, "DosSoundMan::playMusic()");
+
_midiPlayer->play(_musicFile);
}
@@ -313,6 +317,8 @@ void AmigaSoundMan::playSfx(const char *filename, uint channel, bool looping, in
return;
}
+ debugC(1, kDebugAudio, "AmigaSoundMan::playSfx(%s, %i)", filename, channel);
+
Channel *ch = &_channels[channel];
Common::ReadStream *stream = _vm->_disk->loadSound(filename);
Audio::A8SVXDecoder decoder(*stream, ch->header, ch->data, ch->dataSize);
@@ -349,6 +355,8 @@ void AmigaSoundMan::stopSfx(uint channel) {
return;
}
+ debugC(1, kDebugAudio, "AmigaSoundMan::stopSfx(%i)", channel);
+
_mixer->stopHandle(_channels[channel].handle);
free(_channels[channel].data);
_channels[channel].data = 0;
@@ -357,16 +365,25 @@ void AmigaSoundMan::stopSfx(uint channel) {
void AmigaSoundMan::playMusic() {
stopMusic();
+ debugC(1, kDebugAudio, "AmigaSoundMan::playMusic()");
+
Common::ReadStream *stream = _vm->_disk->loadMusic(_musicFile);
_musicStream = Audio::makeProtrackerStream(stream);
delete stream;
+ debugC(3, kDebugAudio, "AmigaSoundMan::playMusic(): created new music stream");
+
_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _musicStream, -1, 255, 0, false, false);
}
void AmigaSoundMan::stopMusic() {
- _mixer->stopHandle(_musicHandle);
- delete _musicStream;
+ debugC(1, kDebugAudio, "AmigaSoundMan::stopMusic()");
+
+ if (_mixer->isSoundHandleActive(_musicHandle)) {
+ _mixer->stopHandle(_musicHandle);
+ delete _musicStream;
+ _musicStream = 0;
+ }
}
void AmigaSoundMan::playCharacterMusic(const char *character) {