ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

imuse.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_IMUSE_H
00024 #define GRIM_IMUSE_H
00025 
00026 #include "common/mutex.h"
00027 
00028 #include "engines/grim/imuse/imuse_track.h"
00029 
00030 namespace Grim {
00031 
00032 #define MAX_IMUSE_TRACKS 16
00033 #define MAX_IMUSE_FADETRACKS 16
00034 
00035 struct ImuseTable;
00036 class SaveGame;
00037 
00038 class Imuse {
00039 private:
00040 
00041     int _callbackFps;
00042 
00043     Track *_track[MAX_IMUSE_TRACKS + MAX_IMUSE_FADETRACKS];
00044 
00045     Common::Mutex _mutex;
00046     ImuseSndMgr *_sound;
00047 
00048     bool _pause;
00049     bool _demo;
00050 
00051     int32 _attributes[185];
00052     int32 _curMusicState;
00053     int32 _curMusicSeq;
00054 
00055     const ImuseTable *_stateMusicTable;
00056     const ImuseTable *_seqMusicTable;
00057 
00058     int32 makeMixerFlags(int32 flags);
00059     static void timerHandler(void *refConf);
00060     void callback();
00061     void switchToNextRegion(Track *track);
00062     int allocSlot(int priority);
00063     void selectVolumeGroup(const char *soundName, int volGroupId);
00064 
00065     void fadeOutMusic(int fadeDelay);
00066     void fadeOutMusicAndStartNew(int fadeDelay, const char *filename, int hookId, int vol, int pan);
00067     Track *cloneToFadeOutTrack(Track *track, int fadeDelay);
00068     Track *moveToFadeOutTrack(Track *track, int fadeDelay);
00069 
00070     void playMusic(const ImuseTable *table, int atribPos, bool sequence);
00071 
00072     void flushTrack(Track *track);
00073 
00074 public:
00075     Imuse(int fps, bool demo);
00076     ~Imuse();
00077 
00078     bool startSound(const char *soundName, int volGroupId, int hookId, int volume, int pan, int priority, Track *otherTrack);
00079     bool startVoice(const char *soundName, int volume = 127, int pan = 64);
00080     void startMusic(const char *soundName, int hookId, int volume, int pan);
00081     void startMusicWithOtherPos(const char *soundName, int hookId, int volume, int pan, Track *otherTrack);
00082     void startSfx(const char *soundName, int priority = 127);
00083 
00084     void restoreState(SaveGame *savedState);
00085     void saveState(SaveGame *savedState);
00086     void resetState();
00087 
00088     Track *findTrack(const char *soundName);
00089     void setPriority(const char *soundName, int priority);
00090     void setVolume(const char *soundName, int volume);
00091     int getVolume(const char *soundName);
00092     void setPan(const char *soundName, int pan); /* pan: 0 .. 127 */
00093     void setFadePan(const char *soundName, int destPan, int duration);
00094     void setFadeVolume(const char *soundName, int destVolume, int duration);
00095     void setHookId(const char *soundName, int hookId);
00096     int getCountPlayedTracks(const char *soundName);
00097     void stopSound(const char *soundName);
00098     void stopAllSounds();
00099     void pause(bool pause);
00100     void setMusicState(int stateId);
00101     int setMusicSequence(int seqId);
00102     void refreshScripts();
00103     void flushTracks();
00104     bool isVoicePlaying();
00105     char *getCurMusicSoundName();
00106     int getCurMusicPan();
00107     int getCurMusicVol();
00108     bool getSoundStatus(const char *soundName);
00109     int32 getPosIn16msTicks(const char *soundName);
00110 };
00111 
00112 extern Imuse *g_imuse;
00113 
00114 } // end of namespace Grim
00115 
00116 #endif


Generated on Sat Feb 16 2019 05:00:54 for ResidualVM by doxygen 1.7.1
curved edge   curved edge