aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-03-21 16:21:27 +0000
committerJohannes Schickel2008-03-21 16:21:27 +0000
commitb615eb177b0b840204d2f1483a7c677e1fcfeedc (patch)
treed43196e2a2453862e7838eaa44dbc5488956a2e0
parenta169619526c811f1718bbeb5ed980f68b9d2c8e7 (diff)
downloadscummvm-rg350-b615eb177b0b840204d2f1483a7c677e1fcfeedc.tar.gz
scummvm-rg350-b615eb177b0b840204d2f1483a7c677e1fcfeedc.tar.bz2
scummvm-rg350-b615eb177b0b840204d2f1483a7c677e1fcfeedc.zip
Cleanup.
svn-id: r31210
-rw-r--r--engines/kyra/sound.h15
-rw-r--r--engines/kyra/sound_towns.cpp10
2 files changed, 13 insertions, 12 deletions
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 7c3bce38bc..1970daa2e2 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -185,6 +185,12 @@ protected:
enum {
kNumChannelHandles = 4
};
+
+ struct SoundChannel {
+ Common::String file;
+ Audio::SoundHandle channelHandle;
+ };
+ SoundChannel _soundChannels[kNumChannelHandles];
int _musicEnabled;
bool _sfxEnabled;
@@ -197,12 +203,6 @@ protected:
private:
const AudioDataStruct *_soundDataList;
- struct SoundChannel {
- Common::String file;
- Audio::SoundHandle channelHandle;
- };
- SoundChannel _soundChannels[kNumChannelHandles];
-
struct SpeechCodecs {
const char *fileext;
Audio::AudioStream *(*streamFunc)(
@@ -428,14 +428,13 @@ public:
void haltTrack();
void beginFadeOut();
- void voicePlay(const char *file);
+ bool voicePlay(const char *file);
void playSoundEffect(uint8) {}
private:
int _lastTrack;
Audio::AudioStream *_currentSFX;
- Audio::SoundHandle _sfxHandles[kNumChannelHandles];
//SoundTowns_v2_TwnDriver *_driver;
uint8 *_twnTrackData;
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index e34f7d014c..28d869b955 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -1432,15 +1432,15 @@ void SoundTowns_v2::haltTrack() {
//_driver->reset();
}
-void SoundTowns_v2::voicePlay(const char *file) {
+bool SoundTowns_v2::voicePlay(const char *file) {
static const uint16 rates[] = { 0x10E1, 0x0CA9, 0x0870, 0x0654, 0x0438, 0x032A, 0x021C, 0x0194 };
int h = 0;
if (_currentSFX) {
- while (_mixer->isSoundHandleActive(_sfxHandles[h]) && h < kNumChannelHandles)
+ while (_mixer->isSoundHandleActive(_soundChannels[h].channelHandle) && h < kNumChannelHandles)
h++;
if (h >= kNumChannelHandles)
- return;
+ return false;
}
uint8 * data = _vm->resource()->fileData(file, 0);
@@ -1490,9 +1490,11 @@ void SoundTowns_v2::voicePlay(const char *file) {
_currentSFX = Audio::makeLinearInputStream(sfx, outsize, outputRate,
Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN | Audio::Mixer::FLAG_AUTOFREE, 0, 0);
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandles[h], _currentSFX);
+ _soundChannels[h].file = file;
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundChannels[h].channelHandle, _currentSFX);
delete [] data;
+ return true;
}
void SoundTowns_v2::beginFadeOut() {