ScummVM API documentation
scx.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 GRIM_SCX_H
23 #define GRIM_SCX_H
24 
25 namespace Common {
26  class SeekableReadStream;
27 }
28 
29 namespace Grim {
30 
31 // I've only ever seen up to two
32 #define SCX_MAX_CHANNELS 2
33 
35 public:
36  SCXStream(Common::SeekableReadStream *stream, const Audio::Timestamp *start, DisposeAfterUse::Flag disposeAfterUse);
37  ~SCXStream();
38 
39  bool isStereo() const override { return _channels == 2; }
40  bool endOfData() const override { return _xaStreams[0]->endOfData(); }
41  int getRate() const override { return _rate; }
42  int readBuffer(int16 *buffer, const int numSamples) override;
43 
44  bool rewind() override;
45  Audio::Timestamp getPos() const;
46 
47 private:
48  int _channels;
49  int _rate;
50  uint16 _blockSize;
51 
52  Common::SeekableReadStream *_fileStreams[SCX_MAX_CHANNELS];
53  Audio::RewindableAudioStream *_xaStreams[SCX_MAX_CHANNELS];
54 };
55 
64 SCXStream *makeSCXStream(
66  const Audio::Timestamp *start,
67  DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
68 
69 } // End of namespace Grim
70 
71 #endif
Definition: scx.h:34
Definition: timestamp.h:83
Definition: stream.h:745
Definition: actor.h:33
bool endOfData() const override
Definition: scx.h:40
Definition: algorithm.h:29
Definition: audiostream.h:109
int getRate() const override
Definition: scx.h:41
bool isStereo() const override
Definition: scx.h:39