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

imuse_sndmgr.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_SNDMGR_H
00024 #define GRIM_IMUSE_SNDMGR_H
00025 
00026 #include "audio/mixer.h"
00027 #include "audio/audiostream.h"
00028 
00029 namespace Grim {
00030 
00031 class McmpMgr;
00032 
00033 class ImuseSndMgr {
00034 public:
00035 
00036 // MAX_IMUSE_SOUNDS needs to be hardcoded, ask aquadran
00037 #define MAX_IMUSE_SOUNDS    16
00038 
00039 // The numbering below fixes talking to Domino in his office
00040 // and it also allows Manny to get the info for Mercedes
00041 // Colomar, without this the game hangs at these points!
00042 #define IMUSE_VOLGRP_BGND   0
00043 #define IMUSE_VOLGRP_SFX    1
00044 #define IMUSE_VOLGRP_VOICE  2
00045 #define IMUSE_VOLGRP_MUSIC  3
00046 #define IMUSE_VOLGRP_ACTION 4
00047 
00048 private:
00049     struct Region {
00050         int32 offset;       // offset of region
00051         int32 length;       // lenght of region
00052     };
00053 
00054     struct Jump {
00055         int32 offset;       // jump offset position
00056         int32 dest;         // jump to dest position
00057         byte hookId;        // id of hook
00058         int16 fadeDelay;    // fade delay in ms
00059     };
00060 
00061 public:
00062 
00063     struct SoundDesc {
00064         uint16 freq;        // frequency
00065         byte channels;      // stereo or mono
00066         byte bits;          // 8, 12, 16
00067         int numJumps;       // number of Jumps
00068         int numRegions;     // number of Regions
00069         Region *region;
00070         Jump *jump;
00071         bool endFlag;
00072         bool inUse;
00073         char name[32];
00074         McmpMgr *mcmpMgr;
00075         int type;
00076         int volGroupId;
00077         bool mcmpData;
00078         uint32 headerSize;
00079         Common::SeekableReadStream *inStream;
00080     };
00081 
00082 private:
00083 
00084     SoundDesc _sounds[MAX_IMUSE_SOUNDS];
00085     bool _demo;
00086 
00087     bool checkForProperHandle(SoundDesc *soundDesc);
00088     SoundDesc *allocSlot();
00089     void parseSoundHeader(SoundDesc *sound, int &headerSize);
00090     void countElements(SoundDesc *sound);
00091 
00092 public:
00093 
00094     ImuseSndMgr(bool demo);
00095     ~ImuseSndMgr();
00096 
00097     SoundDesc *openSound(const char *soundName, int volGroupId);
00098     void closeSound(SoundDesc *sound);
00099     SoundDesc *cloneSound(SoundDesc *sound);
00100 
00101     int getFreq(SoundDesc *sound);
00102     int getBits(SoundDesc *sound);
00103     int getChannels(SoundDesc *sound);
00104     bool isEndOfRegion(SoundDesc *sound, int region);
00105     int getNumRegions(SoundDesc *sound);
00106     int getNumJumps(SoundDesc *sound);
00107     int getRegionOffset(SoundDesc *sound, int region);
00108     int getRegionLength(SoundDesc *sound, int region);
00109     int getJumpIdByRegionAndHookId(SoundDesc *sound, int region, int hookId);
00110     int getRegionIdByJumpId(SoundDesc *sound, int jumpId);
00111     int getJumpHookId(SoundDesc *sound, int number);
00112     int getJumpFade(SoundDesc *sound, int number);
00113 
00114     int32 getDataFromRegion(SoundDesc *sound, int region, byte **buf, int32 offset, int32 size);
00115 };
00116 
00117 } // end of namespace Grim
00118 
00119 #endif


Generated on Sat May 25 2019 05:00:47 for ResidualVM by doxygen 1.7.1
curved edge   curved edge