ScummVM API documentation
sol.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 SCI_SOUND_DECODERS_SOL_H
23 #define SCI_SOUND_DECODERS_SOL_H
24 
25 #include "audio/audiostream.h"
26 #include "common/stream.h"
27 
28 namespace Sci {
29 
30 enum SOLFlags {
31  kCompressed = 1,
32  k16Bit = 4,
33  kStereo = 16
34 };
35 
36 template <bool STEREO, bool S16BIT, bool OLDDPCM8>
38 private:
43 
47  uint16 _sampleRate;
48 
52  int32 _rawDataSize;
53 
60  struct PopFixData {
61  const bool enabled;
62  uint8 state;
63  uint8 preRepairSample;
64 
65  PopFixData(const bool e):
66  enabled(e), state(0), preRepairSample(0) {}
67  } _popfixDPCM8;
68 
72  union {
73  struct { int16 l; int16 r; } _dpcmCarry16;
74  struct { uint8 l; uint8 r; } _dpcmCarry8;
75  };
76 
80  Audio::Timestamp _length;
81 
82  bool seek(const Audio::Timestamp &where) override;
83  Audio::Timestamp getLength() const override;
84  int readBuffer(int16 *buffer, const int numSamples) override;
85  bool isStereo() const override;
86  int getRate() const override;
87  bool endOfData() const override;
88  bool rewind() override;
89 
90 public:
91  SOLStream(Common::SeekableReadStream *stream, const DisposeAfterUse::Flag disposeAfterUse, const uint16 sampleRate, const int32 rawDataSize);
92 };
93 
94 Audio::SeekableAudioStream *makeSOLStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
95 
96 } // End of namespace Sci
97 
98 #endif // SCI_SOUND_DECODERS_SOL_H
Definition: timestamp.h:83
Definition: stream.h:745
Definition: audiostream.h:212
Definition: console.h:28
Definition: sol.h:37