2007-05-30 21:56:52 +00:00
|
|
|
/* 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.
|
2004-01-06 17:28:29 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-01-06 17:28:29 +00:00
|
|
|
*/
|
|
|
|
|
2008-05-06 03:00:26 +00:00
|
|
|
#if !defined(SCUMM_IMUSE_DIGI_H) && defined(ENABLE_SCUMM_7_8)
|
2007-02-19 17:48:19 +00:00
|
|
|
#define SCUMM_IMUSE_DIGI_H
|
2004-01-06 17:28:29 +00:00
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/mutex.h"
|
|
|
|
#include "common/textconsole.h"
|
2005-01-10 22:51:42 +00:00
|
|
|
#include "common/util.h"
|
2004-01-06 17:28:29 +00:00
|
|
|
|
|
|
|
#include "scumm/imuse_digi/dimuse.h"
|
|
|
|
#include "scumm/imuse_digi/dimuse_bndmgr.h"
|
|
|
|
#include "scumm/imuse_digi/dimuse_sndmgr.h"
|
|
|
|
#include "scumm/music.h"
|
2005-01-09 03:15:59 +00:00
|
|
|
#include "scumm/sound.h"
|
2004-01-06 17:28:29 +00:00
|
|
|
|
2011-02-09 01:09:01 +00:00
|
|
|
#include "audio/mixer.h"
|
|
|
|
#include "audio/audiostream.h"
|
2004-01-06 17:28:29 +00:00
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
2008-01-18 16:38:11 +00:00
|
|
|
enum {
|
|
|
|
MAX_DIGITAL_TRACKS = 8,
|
|
|
|
MAX_DIGITAL_FADETRACKS = 8
|
|
|
|
};
|
2004-01-06 17:28:29 +00:00
|
|
|
|
2004-01-17 08:34:54 +00:00
|
|
|
struct imuseDigTable;
|
2004-01-14 22:07:24 +00:00
|
|
|
struct imuseComiTable;
|
2005-04-26 13:17:11 +00:00
|
|
|
class Serializer;
|
2006-10-07 13:57:06 +00:00
|
|
|
class ScummEngine_v7;
|
2008-01-18 17:08:53 +00:00
|
|
|
struct Track;
|
2007-03-02 17:30:29 +00:00
|
|
|
|
2004-01-06 17:28:29 +00:00
|
|
|
class IMuseDigital : public MusicEngine {
|
|
|
|
private:
|
|
|
|
|
2007-06-01 08:59:21 +00:00
|
|
|
int _callbackFps; // value how many times callback needs to be called per second
|
2006-02-05 13:48:27 +00:00
|
|
|
|
2008-01-15 21:35:03 +00:00
|
|
|
struct TriggerParams {
|
|
|
|
char marker[10];
|
|
|
|
int fadeOutDelay;
|
|
|
|
char filename[13];
|
|
|
|
int soundId;
|
|
|
|
int hookId;
|
|
|
|
int volume;
|
2008-01-18 17:08:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
TriggerParams _triggerParams;
|
2008-01-15 21:35:03 +00:00
|
|
|
bool _triggerUsed;
|
|
|
|
|
2004-04-11 14:48:50 +00:00
|
|
|
Track *_track[MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS];
|
2004-01-06 17:28:29 +00:00
|
|
|
|
2006-02-05 13:48:27 +00:00
|
|
|
Common::Mutex _mutex;
|
2006-10-07 13:57:06 +00:00
|
|
|
ScummEngine_v7 *_vm;
|
2006-10-21 12:44:10 +00:00
|
|
|
Audio::Mixer *_mixer;
|
2004-01-06 17:28:29 +00:00
|
|
|
ImuseDigiSndMgr *_sound;
|
2004-04-05 18:24:36 +00:00
|
|
|
|
2007-06-01 08:59:21 +00:00
|
|
|
char *_audioNames; // filenames of sound SFX used in FT
|
|
|
|
int32 _numAudioNames; // number of above filenames
|
2005-04-20 23:33:35 +00:00
|
|
|
|
2007-06-01 08:59:21 +00:00
|
|
|
bool _pause; // flag mean that iMuse callback should be idle
|
2004-01-14 22:07:24 +00:00
|
|
|
|
2007-12-30 21:59:50 +00:00
|
|
|
int32 _attributes[188]; // internal attributes for each music file to store and check later
|
2007-06-01 08:59:21 +00:00
|
|
|
int32 _nextSeqToPlay; // id of sequence type of music needed played
|
|
|
|
int32 _curMusicState; // current or previous id of music
|
|
|
|
int32 _curMusicSeq; // current or previous id of sequence music
|
|
|
|
int32 _curMusicCue; // current cue for current music. used in FT
|
2008-01-21 22:06:14 +00:00
|
|
|
int _stopingSequence;
|
2009-01-10 13:04:33 +00:00
|
|
|
bool _radioChatterSFX;
|
2004-01-14 22:07:24 +00:00
|
|
|
|
2006-02-05 13:48:27 +00:00
|
|
|
static void timer_handler(void *refConf);
|
|
|
|
void callback();
|
2004-11-24 09:47:32 +00:00
|
|
|
void switchToNextRegion(Track *track);
|
2004-05-26 17:03:31 +00:00
|
|
|
int allocSlot(int priority);
|
2008-01-14 17:26:49 +00:00
|
|
|
void startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority, Track *otherTrack);
|
2004-04-11 14:48:50 +00:00
|
|
|
void selectVolumeGroup(int soundId, int volGroupId);
|
2004-01-06 17:28:29 +00:00
|
|
|
|
2004-01-12 19:15:07 +00:00
|
|
|
int32 getPosInMs(int soundId);
|
|
|
|
void getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height);
|
|
|
|
|
|
|
|
int getSoundIdByName(const char *soundName);
|
2004-01-14 22:07:24 +00:00
|
|
|
void fadeOutMusic(int fadeDelay);
|
2008-01-14 17:26:49 +00:00
|
|
|
void fadeOutMusicAndStartNew(int fadeDelay, const char *filename, int soundId);
|
2008-01-15 21:35:03 +00:00
|
|
|
void setTrigger(TriggerParams *trigger);
|
2008-01-14 14:48:35 +00:00
|
|
|
void setHookIdForMusic(int hookId);
|
2007-12-30 16:32:30 +00:00
|
|
|
Track *cloneToFadeOutTrack(Track *track, int fadeDelay);
|
2004-01-17 08:34:54 +00:00
|
|
|
|
2004-01-12 19:15:07 +00:00
|
|
|
void setFtMusicState(int stateId);
|
|
|
|
void setFtMusicSequence(int seqId);
|
|
|
|
void setFtMusicCuePoint(int cueId);
|
2004-03-02 20:35:48 +00:00
|
|
|
void playFtMusic(const char *songName, int opcode, int volume);
|
2004-01-14 22:07:24 +00:00
|
|
|
|
|
|
|
void setComiMusicState(int stateId);
|
|
|
|
void setComiMusicSequence(int seqId);
|
2007-12-30 22:10:24 +00:00
|
|
|
void playComiMusic(const char *songName, const imuseComiTable *table, int attribPos, bool sequence);
|
2004-01-12 19:15:07 +00:00
|
|
|
|
2004-01-17 08:34:54 +00:00
|
|
|
void setDigMusicState(int stateId);
|
|
|
|
void setDigMusicSequence(int seqId);
|
2007-12-30 21:59:50 +00:00
|
|
|
void playDigMusic(const char *songName, const imuseDigTable *table, int attribPos, bool sequence);
|
2004-01-17 08:34:54 +00:00
|
|
|
|
2008-01-01 11:27:29 +00:00
|
|
|
void flushTrack(Track *track);
|
|
|
|
|
2004-01-06 17:28:29 +00:00
|
|
|
public:
|
2006-10-21 12:44:10 +00:00
|
|
|
IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, int fps);
|
2004-01-14 16:00:24 +00:00
|
|
|
virtual ~IMuseDigital();
|
2004-01-06 17:28:29 +00:00
|
|
|
|
2005-04-20 23:33:35 +00:00
|
|
|
void setAudioNames(int32 num, char *names);
|
|
|
|
|
2006-04-29 22:33:31 +00:00
|
|
|
void startVoice(int soundId, Audio::AudioStream *input);
|
2004-04-06 19:46:43 +00:00
|
|
|
void startVoice(int soundId, const char *soundName);
|
|
|
|
void startMusic(int soundId, int volume);
|
|
|
|
void startMusic(const char *soundName, int soundId, int hookId, int volume);
|
2008-01-14 17:26:49 +00:00
|
|
|
void startMusicWithOtherPos(const char *soundName, int soundId, int hookId, int volume, Track *otherTrack);
|
2004-04-06 19:46:43 +00:00
|
|
|
void startSfx(int soundId, int priority);
|
2004-09-25 23:26:46 +00:00
|
|
|
void startSound(int sound)
|
2007-03-20 19:04:51 +00:00
|
|
|
{ error("IMuseDigital::startSound(int) should be never called"); }
|
2004-04-05 18:24:36 +00:00
|
|
|
|
2004-05-02 10:07:59 +00:00
|
|
|
void saveOrLoad(Serializer *ser);
|
2004-04-05 18:24:36 +00:00
|
|
|
void resetState();
|
2009-01-10 13:04:33 +00:00
|
|
|
void setRadioChatterSFX(bool state) {
|
|
|
|
_radioChatterSFX = state;
|
|
|
|
}
|
2004-04-05 18:24:36 +00:00
|
|
|
|
2004-03-27 20:26:25 +00:00
|
|
|
void setPriority(int soundId, int priority);
|
2004-01-18 11:18:46 +00:00
|
|
|
void setVolume(int soundId, int volume);
|
|
|
|
void setPan(int soundId, int pan);
|
|
|
|
void setFade(int soundId, int destVolume, int delay60HzTicks);
|
2005-03-12 18:54:06 +00:00
|
|
|
int getCurMusicSoundId();
|
|
|
|
void setHookId(int soundId, int hookId);
|
2004-11-28 21:24:02 +00:00
|
|
|
void setMusicVolume(int vol) {}
|
2004-10-07 21:18:54 +00:00
|
|
|
void stopSound(int sound);
|
2004-04-26 07:47:12 +00:00
|
|
|
void stopAllSounds();
|
2004-01-06 17:28:29 +00:00
|
|
|
void pause(bool pause);
|
2004-11-24 09:47:32 +00:00
|
|
|
void parseScriptCmds(int cmd, int soundId, int sub_cmd, int d, int e, int f, int g, int h);
|
2004-04-09 05:43:24 +00:00
|
|
|
void refreshScripts();
|
2004-05-26 17:03:31 +00:00
|
|
|
void flushTracks();
|
2004-01-06 17:28:29 +00:00
|
|
|
int getSoundStatus(int sound) const;
|
|
|
|
int32 getCurMusicPosInMs();
|
|
|
|
int32 getCurVoiceLipSyncWidth();
|
|
|
|
int32 getCurVoiceLipSyncHeight();
|
2004-01-09 22:10:32 +00:00
|
|
|
int32 getCurMusicLipSyncWidth(int syncId);
|
|
|
|
int32 getCurMusicLipSyncHeight(int syncId);
|
2004-01-06 17:28:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Scumm
|
|
|
|
|
2004-01-20 00:21:24 +00:00
|
|
|
#endif
|