ScummVM API documentation
imuse_sndmgr.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRIM_IMUSE_SNDMGR_H
23 #define GRIM_IMUSE_SNDMGR_H
24 
25 #include "audio/mixer.h"
26 #include "audio/audiostream.h"
27 
28 namespace Grim {
29 
30 class McmpMgr;
31 
32 class ImuseSndMgr {
33 public:
34 
35 // MAX_IMUSE_SOUNDS needs to be hardcoded, ask aquadran
36 #define MAX_IMUSE_SOUNDS 16
37 
38 // The numbering below fixes talking to Domino in his office
39 // and it also allows Manny to get the info for Mercedes
40 // Colomar, without this the game hangs at these points!
41 #define IMUSE_VOLGRP_BGND 0
42 #define IMUSE_VOLGRP_SFX 1
43 #define IMUSE_VOLGRP_VOICE 2
44 #define IMUSE_VOLGRP_MUSIC 3
45 #define IMUSE_VOLGRP_ACTION 4
46 
47 private:
48  struct Region {
49  int32 offset; // offset of region
50  int32 length; // length of region
51  };
52 
53  struct Jump {
54  int32 offset; // jump offset position
55  int32 dest; // jump to dest position
56  byte hookId; // id of hook
57  int16 fadeDelay; // fade delay in ms
58  };
59 
60 public:
61 
62  struct SoundDesc {
63  uint16 freq; // frequency
64  byte channels; // stereo or mono
65  byte bits; // 8, 12, 16
66  int numJumps; // number of Jumps
67  int numRegions; // number of Regions
68  Region *region;
69  Jump *jump;
70  bool endFlag;
71  bool inUse;
72  char name[32];
73  McmpMgr *mcmpMgr;
74  int type;
75  int volGroupId;
76  bool mcmpData;
77  uint32 headerSize;
79  };
80 
81 private:
82 
83  SoundDesc _sounds[MAX_IMUSE_SOUNDS];
84  bool _demo;
85 
86  bool checkForProperHandle(SoundDesc *soundDesc);
87  SoundDesc *allocSlot();
88  void parseSoundHeader(SoundDesc *sound, int &headerSize);
89  void countElements(SoundDesc *sound);
90 
91 public:
92 
93  ImuseSndMgr(bool demo);
94  ~ImuseSndMgr();
95 
96  SoundDesc *openSound(const char *soundName, int volGroupId);
97  void closeSound(SoundDesc *sound);
98  SoundDesc *cloneSound(SoundDesc *sound);
99 
100  int getFreq(SoundDesc *sound);
101  int getBits(SoundDesc *sound);
102  int getChannels(SoundDesc *sound);
103  bool isEndOfRegion(SoundDesc *sound, int region);
104  int getNumRegions(SoundDesc *sound);
105  int getNumJumps(SoundDesc *sound);
106  int getRegionOffset(SoundDesc *sound, int region);
107  int getRegionLength(SoundDesc *sound, int region);
108  int getJumpIdByRegionAndHookId(SoundDesc *sound, int region, int hookId);
109  int getRegionIdByJumpId(SoundDesc *sound, int jumpId);
110  int getJumpHookId(SoundDesc *sound, int number);
111  int getJumpFade(SoundDesc *sound, int number);
112 
113  int32 getDataFromRegion(SoundDesc *sound, int region, byte **buf, int32 offset, int32 size, int32 *flags);
114 };
115 
116 } // end of namespace Grim
117 
118 #endif
Definition: imuse_sndmgr.h:32
Definition: stream.h:745
Definition: actor.h:33
Definition: imuse_mcmp_mgr.h:27
Definition: imuse_sndmgr.h:62