ScummVM API documentation
sci_resource.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 DGDS_SOUND_RESOURCE_SCI_RESOURCE_H
23 #define DGDS_SOUND_RESOURCE_SCI_RESOURCE_H
24 
25 #include "common/str.h"
26 #include "common/list.h"
27 #include "common/hashmap.h"
28 
29 #include "dgds/dgds.h"
30 #include "dgds/sound/scispan.h"
31 
32 namespace Common {
33 class File;
34 class FSList;
35 class FSNode;
36 class WriteStream;
37 class SeekableReadStream;
38 }
39 
40 namespace Dgds {
41 
43 class SciResource : public SciSpan<const byte> {
44 public:
45  SciResource(const byte *data, int dataSz, int16 id);
46  ~SciResource();
47  void unalloc();
48 };
49 
51 public:
52  struct Channel {
53  byte number;
54  byte flags;
55  byte poly;
56  uint16 prio;
58  uint16 curPos;
59  long time;
60  byte prev;
61 
62  Channel() :
63  number(0),
64  flags(0),
65  poly(0),
66  prio(0),
67  data(),
68  curPos(0) {
69  time = 0;
70  prev = 0;
71  }
72  };
73 
74  struct Track {
75  byte type;
76  byte channelCount;
77  SciSpan<const byte> header;
78  Channel *channels;
79  int16 digitalChannelNr;
80  uint16 digitalSampleRate;
81  uint16 digitalSampleSize;
82  uint16 digitalSampleStart;
83  uint16 digitalSampleEnd;
84  };
85 public:
86  SoundResource(uint32 resNumberu, const byte *data, int dataSz);
87  ~SoundResource();
88 
89  Track *getTrackByType(byte type);
90  Track *getDigitalTrack();
91 
92  byte getSoundPriority() const { return _soundPriority; }
93  bool exists() const { return _resource != nullptr; }
94 
95 private:
96  int _trackCount;
97  Track *_tracks;
98  SciResource *_resource;
99  byte _soundPriority;
100 };
101 
102 } // End of namespace Dgds
103 
104 #endif // DGDS_SOUND_RESOURCE_SCI_RESOURCE_H
Definition: sci_resource.h:74
Definition: ads.h:28
Definition: sci_resource.h:50
Definition: algorithm.h:29
Definition: scispan.h:168
Definition: sci_resource.h:43
Definition: sci_resource.h:52