ScummVM API documentation
imuse_track.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_TRACK_H
23 #define GRIM_IMUSE_TRACK_H
24 
25 #include "engines/grim/imuse/imuse_sndmgr.h"
26 
27 namespace Grim {
28 
29 enum {
30  kFlagUnsigned = 1 << 0,
31  kFlag16Bits = 1 << 1,
32  kFlagLittleEndian = 1 << 2,
33  kFlagStereo = 1 << 3,
34  kFlagReverseStereo = 1 << 4
35 };
36 
37 struct Track {
38  int trackId;
39 
40  int32 pan;
41  int32 panFadeDest;
42  int32 panFadeStep;
43  int32 panFadeDelay;
44  bool panFadeUsed;
45  int32 vol;
46  int32 volFadeDest;
47  int32 volFadeStep;
48  int32 volFadeDelay;
49  bool volFadeUsed;
50 
51  char soundName[32];
52  bool used;
53  bool toBeRemoved;
54  int32 priority;
55  int32 regionOffset;
56  int32 dataOffset;
57  int32 curRegion;
58  int32 curHookId;
59  int32 volGroupId;
60  int32 feedSize;
61  int32 mixerFlags;
62 
63  ImuseSndMgr::SoundDesc *soundDesc;
64  Audio::SoundHandle handle;
66 
67  Track() {
68  clear();
69  }
70 
71  void clear() {
72  trackId = 0;
73 
74  pan = 0;
75  panFadeDest = 0;
76  panFadeStep = 0;
77  panFadeDelay = 0;
78  panFadeUsed = 0;
79  vol = 0;
80  volFadeDest = 0;
81  volFadeStep = 0;
82  volFadeDelay = 0;
83  volFadeUsed = 0;
84 
85  for (uint i = 0; i < ARRAYSIZE(soundName); i++) {
86  soundName[i] = 0;
87  }
88  used = false;
89  toBeRemoved = false;
90  priority = 0;
91  regionOffset = 0;
92  dataOffset = 0;
93  curRegion = 0;
94  curHookId = 0;
95  volGroupId = 0;
96  feedSize = 0;
97  mixerFlags = 0;
98 
99  soundDesc = nullptr;
100  // handle not cleared. FIXME: Clear by resetting _val to default (0xFFFFFFFF not 0)?
101  stream = nullptr;
102  }
103 
104  /* getPan() returns -127 ... 127 */
105  int getPan() const { return (pan != 64000) ? 2 * (pan / 1000) - 127 : 0; }
106  int getVol() const { return vol / 1000; }
107  Audio::Mixer::SoundType getType() const {
109  if (volGroupId == IMUSE_VOLGRP_VOICE)
111  else if (volGroupId == IMUSE_VOLGRP_SFX)
113  else if (volGroupId == IMUSE_VOLGRP_MUSIC)
115  else if (volGroupId == IMUSE_VOLGRP_BGND)
117  else if (volGroupId == IMUSE_VOLGRP_ACTION)
119  return type;
120  }
121 };
122 
123 } // end of namespace Grim
124 
125 #endif
#define ARRAYSIZE(x)
Definition: util.h:91
Definition: mixer.h:65
Definition: mixer.h:66
Definition: imuse_track.h:37
Definition: actor.h:33
Definition: mixer.h:49
SoundType
Definition: mixer.h:62
Definition: mixer.h:67
Definition: audiostream.h:370
Definition: imuse_sndmgr.h:62
Definition: mixer.h:63