From eb03de63bc7ac85d1c0c37a01998751c59ac0ec4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 18 Jan 2008 17:08:53 +0000 Subject: iMuse Digital: Moved track & table definition from dimuse.h into separate header files svn-id: r30550 --- engines/scumm/imuse_digi/dimuse.cpp | 5 +- engines/scumm/imuse_digi/dimuse.h | 125 +---------------------------- engines/scumm/imuse_digi/dimuse_music.cpp | 1 + engines/scumm/imuse_digi/dimuse_script.cpp | 1 + engines/scumm/imuse_digi/dimuse_tables.cpp | 3 +- engines/scumm/imuse_digi/dimuse_tables.h | 89 ++++++++++++++++++++ engines/scumm/imuse_digi/dimuse_track.cpp | 3 +- engines/scumm/imuse_digi/dimuse_track.h | 101 +++++++++++++++++++++++ 8 files changed, 201 insertions(+), 127 deletions(-) create mode 100644 engines/scumm/imuse_digi/dimuse_tables.h create mode 100644 engines/scumm/imuse_digi/dimuse_track.h (limited to 'engines/scumm') diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 0d13ffb513..ed244651dd 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -32,16 +32,13 @@ #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_track.h" #include "sound/audiostream.h" #include "sound/mixer.h" namespace Scumm { -IMuseDigital::Track::Track() - : soundId(-1), used(false), stream(NULL) { -} - void IMuseDigital::timer_handler(void *refCon) { IMuseDigital *imuseDigital = (IMuseDigital *)refCon; imuseDigital->callback(); diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index 45d5024695..4783188c3b 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -48,77 +48,13 @@ struct imuseDigTable; struct imuseComiTable; class Serializer; class ScummEngine_v7; - -// These flag bits correspond exactly to the sound mixer flags of March 2007. -// We don't want to use the mixer flags directly, because then our saved games -// will break in interesting ways if the mixer flags are ever assigned new -// values. Now they should keep working, as long as these flags don't change. - -enum { - kFlagUnsigned = 1 << 0, - kFlag16Bits = 1 << 1, - kFlagLittleEndian = 1 << 2, - kFlagStereo = 1 << 3, - kFlagReverseStereo = 1 << 4 - - // Not used by Digital iMUSE - // kFlagAutoFree = 1 << 5, - // kFlagLoop = 1 << 6 -}; +struct Track; class IMuseDigital : public MusicEngine { private: int _callbackFps; // value how many times callback needs to be called per second - struct Track { - int trackId; // used to identify track by value (0-15) - - int8 pan; // panning value of sound - int32 vol; // volume level (values 0-127 * 1000) - int32 volFadeDest; // volume level which fading target (values 0-127 * 1000) - int32 volFadeStep; // delta of step while changing volume at each imuse callback - int32 volFadeDelay; // time in ms how long fading volume must be - bool volFadeUsed; // flag if fading is in progress - - int32 soundId; // sound id used by scumm script - char soundName[15]; // sound name but also filename of sound in bundle data - bool used; // flag mean that track is used - bool toBeRemoved; // flag mean that track need to be free - bool mixerStreamRunning; // flag mean sound mixer's stream is running OBSOLETE - bool souStreamUsed; // flag mean that track use stream from sou file - bool sndDataExtComp;// flag mean that sound data is compressed by scummvm tools - int32 soundPriority;// priority level of played sound (0-127) - int32 regionOffset; // offset to sound data relative to begining of current region - int32 dataOffset; // offset to sound data relative to begining of 'DATA' chunk - int32 curRegion; // id of current used region - int32 curHookId; // id of current used hook id - int32 volGroupId; // id of volume group (IMUSE_VOLGRP_VOICE, IMUSE_VOLGRP_SFX, IMUSE_VOLGRP_MUSIC) - int32 soundType; // type of sound data (kSpeechSoundType, kSFXSoundType, kMusicSoundType) - int32 feedSize; // size of sound data needed to be filled at each callback iteration - int32 dataMod12Bit; // value used between all callback to align 12 bit source of data - int32 mixerFlags; // flags for sound mixer's channel (kFlagStereo, kFlag16Bits, kFlagReverseStereo, kFlagUnsigned, kFlagLittleEndian) - - ImuseDigiSndMgr::SoundDesc *soundDesc; // sound handle used by iMuse sound manager - Audio::SoundHandle mixChanHandle; // sound mixer's channel handle - Audio::AppendableAudioStream *stream; // sound mixer's audio stream handle for *.la1 and *.bun - - Track(); - - int getPan() const { return (pan != 64) ? 2 * pan - 127 : 0; } - int getVol() const { return vol / 1000; } - Audio::Mixer::SoundType getType() const { - Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; - if (volGroupId == 1) - type = Audio::Mixer::kSpeechSoundType; - else if (volGroupId == 2) - type = Audio::Mixer::kSFXSoundType; - else if (volGroupId == 3) - type = Audio::Mixer::kMusicSoundType; - return type; - } - }; - struct TriggerParams { char marker[10]; int fadeOutDelay; @@ -126,7 +62,9 @@ private: int soundId; int hookId; int volume; - } _triggerParams; + }; + + TriggerParams _triggerParams; bool _triggerUsed; Track *_track[MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS]; @@ -221,61 +159,6 @@ public: int32 getCurMusicLipSyncHeight(int syncId); }; -struct imuseRoomMap { - int8 roomId; - byte stateIndex1; - byte offset; - byte stateIndex2; - byte attribPos; - byte stateIndex3; -}; - -struct imuseDigTable { - byte transitionType; - int16 soundId; - char name[20]; - byte attribPos; - byte hookId; - char filename[13]; -}; - -struct imuseComiTable { - byte transitionType; - int16 soundId; - char name[20]; - byte attribPos; - byte hookId; - int16 fadeOutDelay; - char filename[13]; -}; - - -struct imuseFtNames { - char name[20]; -}; - -struct imuseFtStateTable { - char audioName[9]; - byte transitionType; - byte volume; - char name[21]; -}; - -struct imuseFtSeqTable { - char audioName[9]; - byte transitionType; - byte volume; -}; - -extern const imuseRoomMap _digStateMusicMap[]; -extern const imuseDigTable _digStateMusicTable[]; -extern const imuseDigTable _digSeqMusicTable[]; -extern const imuseComiTable _comiStateMusicTable[]; -extern const imuseComiTable _comiSeqMusicTable[]; -extern const imuseFtStateTable _ftStateMusicTable[]; -extern const imuseFtSeqTable _ftSeqMusicTable[]; -extern const imuseFtNames _ftSeqNames[]; - } // End of namespace Scumm #endif diff --git a/engines/scumm/imuse_digi/dimuse_music.cpp b/engines/scumm/imuse_digi/dimuse_music.cpp index a43e93dcad..84f8599e5e 100644 --- a/engines/scumm/imuse_digi/dimuse_music.cpp +++ b/engines/scumm/imuse_digi/dimuse_music.cpp @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "scumm/scumm.h" #include "scumm/imuse_digi/dimuse.h" +#include "scumm/imuse_digi/dimuse_tables.h" namespace Scumm { diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp index 23c49d6c68..76c349d4b6 100644 --- a/engines/scumm/imuse_digi/dimuse_script.cpp +++ b/engines/scumm/imuse_digi/dimuse_script.cpp @@ -31,6 +31,7 @@ #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_track.h" #include "sound/audiostream.h" #include "sound/mixer.h" diff --git a/engines/scumm/imuse_digi/dimuse_tables.cpp b/engines/scumm/imuse_digi/dimuse_tables.cpp index e190e5a755..b11d8e4d5a 100644 --- a/engines/scumm/imuse_digi/dimuse_tables.cpp +++ b/engines/scumm/imuse_digi/dimuse_tables.cpp @@ -23,7 +23,8 @@ */ -#include "scumm/imuse_digi/dimuse.h" +//#include "scumm/imuse_digi/dimuse.h" +#include "scumm/imuse_digi/dimuse_tables.h" namespace Scumm { diff --git a/engines/scumm/imuse_digi/dimuse_tables.h b/engines/scumm/imuse_digi/dimuse_tables.h new file mode 100644 index 0000000000..ddd7c571f3 --- /dev/null +++ b/engines/scumm/imuse_digi/dimuse_tables.h @@ -0,0 +1,89 @@ +/* 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. + * + * $URL$ + * $Id$ + */ + +#if !defined(SCUMM_IMUSE_DIGI_TABLES_H) && !defined(DISABLE_SCUMM_7_8) +#define SCUMM_IMUSE_DIGI_TABLES_H + +#include "common/scummsys.h" + +namespace Scumm { + +struct imuseRoomMap { + int8 roomId; + byte stateIndex1; + byte offset; + byte stateIndex2; + byte attribPos; + byte stateIndex3; +}; + +struct imuseDigTable { + byte transitionType; + int16 soundId; + char name[20]; + byte attribPos; + byte hookId; + char filename[13]; +}; + +struct imuseComiTable { + byte transitionType; + int16 soundId; + char name[20]; + byte attribPos; + byte hookId; + int16 fadeOutDelay; + char filename[13]; +}; + + +struct imuseFtNames { + char name[20]; +}; + +struct imuseFtStateTable { + char audioName[9]; + byte transitionType; + byte volume; + char name[21]; +}; + +struct imuseFtSeqTable { + char audioName[9]; + byte transitionType; + byte volume; +}; + +extern const imuseRoomMap _digStateMusicMap[]; +extern const imuseDigTable _digStateMusicTable[]; +extern const imuseDigTable _digSeqMusicTable[]; +extern const imuseComiTable _comiStateMusicTable[]; +extern const imuseComiTable _comiSeqMusicTable[]; +extern const imuseFtStateTable _ftStateMusicTable[]; +extern const imuseFtSeqTable _ftSeqMusicTable[]; +extern const imuseFtNames _ftSeqNames[]; + +} // End of namespace Scumm + +#endif diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index 179779a0dc..191e227eae 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -30,6 +30,7 @@ #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_track.h" #include "sound/audiostream.h" #include "sound/mixer.h" @@ -330,7 +331,7 @@ void IMuseDigital::setTrigger(TriggerParams *trigger) { _triggerUsed = true; } -IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDelay) { +Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDelay) { assert(track); Track *fadeTrack; diff --git a/engines/scumm/imuse_digi/dimuse_track.h b/engines/scumm/imuse_digi/dimuse_track.h new file mode 100644 index 0000000000..e613798569 --- /dev/null +++ b/engines/scumm/imuse_digi/dimuse_track.h @@ -0,0 +1,101 @@ +/* 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. + * + * $URL$ + * $Id$ + */ + +#if !defined(SCUMM_IMUSE_DIGI_TRACK_H) && !defined(DISABLE_SCUMM_7_8) +#define SCUMM_IMUSE_DIGI_TRACK_H + +#include "common/scummsys.h" + +namespace Scumm { + + +// These flag bits correspond exactly to the sound mixer flags of March 2007. +// We don't want to use the mixer flags directly, because then our saved games +// will break in interesting ways if the mixer flags are ever assigned new +// values. Now they should keep working, as long as these flags don't change. + +enum { + kFlagUnsigned = 1 << 0, + kFlag16Bits = 1 << 1, + kFlagLittleEndian = 1 << 2, + kFlagStereo = 1 << 3, + kFlagReverseStereo = 1 << 4 + + // Not used by Digital iMUSE + // kFlagAutoFree = 1 << 5, + // kFlagLoop = 1 << 6 +}; + +struct Track { + int trackId; // used to identify track by value (0-15) + + int8 pan; // panning value of sound + int32 vol; // volume level (values 0-127 * 1000) + int32 volFadeDest; // volume level which fading target (values 0-127 * 1000) + int32 volFadeStep; // delta of step while changing volume at each imuse callback + int32 volFadeDelay; // time in ms how long fading volume must be + bool volFadeUsed; // flag if fading is in progress + + int32 soundId; // sound id used by scumm script + char soundName[15]; // sound name but also filename of sound in bundle data + bool used; // flag mean that track is used + bool toBeRemoved; // flag mean that track need to be free + bool mixerStreamRunning; // flag mean sound mixer's stream is running OBSOLETE + bool souStreamUsed; // flag mean that track use stream from sou file + bool sndDataExtComp;// flag mean that sound data is compressed by scummvm tools + int32 soundPriority;// priority level of played sound (0-127) + int32 regionOffset; // offset to sound data relative to begining of current region + int32 dataOffset; // offset to sound data relative to begining of 'DATA' chunk + int32 curRegion; // id of current used region + int32 curHookId; // id of current used hook id + int32 volGroupId; // id of volume group (IMUSE_VOLGRP_VOICE, IMUSE_VOLGRP_SFX, IMUSE_VOLGRP_MUSIC) + int32 soundType; // type of sound data (kSpeechSoundType, kSFXSoundType, kMusicSoundType) + int32 feedSize; // size of sound data needed to be filled at each callback iteration + int32 dataMod12Bit; // value used between all callback to align 12 bit source of data + int32 mixerFlags; // flags for sound mixer's channel (kFlagStereo, kFlag16Bits, kFlagReverseStereo, kFlagUnsigned, kFlagLittleEndian) + + ImuseDigiSndMgr::SoundDesc *soundDesc; // sound handle used by iMuse sound manager + Audio::SoundHandle mixChanHandle; // sound mixer's channel handle + Audio::AppendableAudioStream *stream; // sound mixer's audio stream handle for *.la1 and *.bun + + Track() : soundId(-1), used(false), stream(NULL) { + } + + int getPan() const { return (pan != 64) ? 2 * pan - 127 : 0; } + int getVol() const { return vol / 1000; } + Audio::Mixer::SoundType getType() const { + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; + if (volGroupId == 1) + type = Audio::Mixer::kSpeechSoundType; + else if (volGroupId == 2) + type = Audio::Mixer::kSFXSoundType; + else if (volGroupId == 3) + type = Audio::Mixer::kMusicSoundType; + return type; + } +}; + +} // End of namespace Scumm + +#endif -- cgit v1.2.3