ScummVM API documentation
zork_raw.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 ZVISION_ZORK_RAW_H
23#define ZVISION_ZORK_RAW_H
24
25#include "audio/audiostream.h"
26
27namespace Common {
28class SeekableReadStream;
29}
30
31namespace ZVision {
32
33class ZVision;
34
36 char identifier;
37 uint32 rate;
38 bool stereo;
39 bool packed;
40 bool bits16;
41};
42
47public:
48 RawChunkStream(bool stereo);
49
51 }
52private:
53 uint _stereo;
54
59 struct {
60 int32 sample;
61 int16 index;
62 } _lastSample[2];
63
64 static const int16 _stepAdjustmentTable[8];
65 static const int32 _amplitudeLookupTable[89];
66
67public:
68
69 struct RawChunk {
70 int16 *data;
71 uint32 size;
72 };
73
74 void init();
75 //Read next audio portion in new stream (needed for avi), return structure with buffer
76 RawChunk readNextChunk(Common::SeekableReadStream *stream);
77 //Read numSamples from stream to buffer
78 int readBuffer(int16 *buffer, Common::SeekableReadStream *stream, const int numSamples);
79};
80
85public:
86 RawZorkStream(uint32 rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream);
87
88 ~RawZorkStream() override {
89 }
90
91public:
92 static const SoundParams _zNemSoundParamLookupTable[32];
93 static const SoundParams _zgiSoundParamLookupTable[24];
94
95private:
96 const int _rate; // Sample rate of stream
97 Audio::Timestamp _playtime; // Calculated total play time
98 Common::DisposablePtr<Common::SeekableReadStream> _stream; // Stream to read data from
99 bool _endOfData; // Whether the stream end has been reached
100 uint _stereo;
101
102 RawChunkStream _streamReader;
103
104public:
105 int readBuffer(int16 *buffer, const int numSamples) override;
106
107 bool isStereo() const override {
108 return _stereo;
109 }
110 bool endOfData() const override {
111 return _endOfData;
112 }
113
114 int getRate() const override {
115 return _rate;
116 }
117 Audio::Timestamp getLength() const {
118 return _playtime;
119 }
120
121 bool rewind() override;
122};
123
133 int rate,
134 bool stereo,
135 DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
136
138
139} // End of namespace ZVision
140
141#endif
Definition: audiostream.h:109
Definition: timestamp.h:83
Definition: path.h:52
Definition: stream.h:745
Definition: zork_raw.h:46
Definition: zork_raw.h:84
bool endOfData() const override
Definition: zork_raw.h:110
bool rewind() override
int getRate() const override
Definition: zork_raw.h:114
bool isStereo() const override
Definition: zork_raw.h:107
int readBuffer(int16 *buffer, const int numSamples) override
Definition: algorithm.h:29
Definition: focus_list.h:27
Audio::RewindableAudioStream * makeRawZorkStream(Common::SeekableReadStream *stream, int rate, bool stereo, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES)
Definition: zork_raw.h:69
Definition: zork_raw.h:35