ScummVM API documentation
aud_stream.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 BLADERUNNER_AUD_STREAM_H
23 #define BLADERUNNER_AUD_STREAM_H
24 
25 #include "bladerunner/adpcm_decoder.h"
26 
27 #include "audio/audiostream.h"
28 #include "common/endian.h"
29 #include "common/types.h"
30 
31 namespace BladeRunner {
32 
33 class AudioCache;
34 
36  byte *_data;
37  byte *_p;
38  byte *_end;
39  AudioCache *_cache;
40  int32 _hash;
41  uint16 _deafBlockRemain;
42  uint16 _frequency;
43  uint32 _size;
44  uint32 _sizeDecompressed;
45  byte _flags;
46  byte _compressionType;
47  int _overrideFrequency;
48 
49  ADPCMWestwoodDecoder _decoder;
50 
51  void init(byte *data);
52 
53 public:
54  AudStream(byte *data, int overrideFrequency = -1);
55  AudStream(AudioCache *cache, int32 hash, int overrideFrequency = -1);
56  ~AudStream() override;
57 
58  int readBuffer(int16 *buffer, const int numSamples) override;
59  bool isStereo() const override { return false; }
60  int getRate() const override { return _overrideFrequency > 0 ? _overrideFrequency : _frequency; };
61  bool endOfData() const override { return _p == _end; }
62  bool rewind() override;
63  uint32 getLength() const;
64  bool startAtSecond(uint32 startSecond);
65  int getBytesPerSecond() const;
66 };
67 
68 } // End of namespace BladeRunner
69 
70 #endif
Definition: actor.h:31
bool endOfData() const override
Definition: aud_stream.h:61
int readBuffer(int16 *buffer, const int numSamples) override
int getRate() const override
Definition: aud_stream.h:60
Definition: audiostream.h:109
Definition: adpcm_decoder.h:29
Definition: audio_cache.h:33
Definition: aud_stream.h:35
bool rewind() override
bool isStereo() const override
Definition: aud_stream.h:59