ScummVM API documentation
adpcm.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 TINSEL_ADPCM_H
23#define TINSEL_ADPCM_H
24
25#include "audio/decoders/adpcm_intern.h"
26
27namespace Tinsel {
28
30protected:
31 struct {
32 // Tinsel
33 double predictor;
34 double K0, K1;
35 double d0, d1;
36 } _status;
37
38 void reset() override {
39 ADPCMStream::reset();
40 memset(&_status, 0, sizeof(_status));
41 }
42
43 int16 decodeTinsel(int16, double);
44 void readBufferTinselHeader();
45
46public:
47 Tinsel_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
48 : ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
49
50 if (blockAlign == 0)
51 error("Tinsel_ADPCMStream(): blockAlign isn't specified");
52
53 if (channels != 1)
54 error("Tinsel_ADPCMStream(): Tinsel ADPCM only supports mono");
55
56 memset(&_status, 0, sizeof(_status));
57 }
58
59};
60
62public:
63 Tinsel4_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
64 : Tinsel_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
65
66 int readBuffer(int16 *buffer, const int numSamples) override;
67};
68
70protected:
71 uint8 _chunkPos;
72 uint16 _chunkData;
73
74 void reset() override {
75 ADPCMStream::reset();
76 _chunkPos = 0;
77 _chunkData = 0;
78 }
79
80public:
81 Tinsel6_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
82 : Tinsel_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
83 _chunkPos = 0;
84 _chunkData = 0;
85 }
86
87 int readBuffer(int16 *buffer, const int numSamples) override;
88};
89
91public:
92 Tinsel8_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
93 : Tinsel_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
94
95 int readBuffer(int16 *buffer, const int numSamples) override;
96};
97
98
99} // End of namespace Tinsel
100
101#endif
Definition: adpcm_intern.h:42
Definition: stream.h:745
Definition: adpcm.h:61
int readBuffer(int16 *buffer, const int numSamples) override
Definition: adpcm.h:69
int readBuffer(int16 *buffer, const int numSamples) override
Definition: adpcm.h:90
int readBuffer(int16 *buffer, const int numSamples) override
Definition: adpcm.h:29
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: actors.h:36