ScummVM API documentation
3do.h
Go to the documentation of this file.
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
28#ifndef AUDIO_3DO_SDX2_H
29#define AUDIO_3DO_SDX2_H
30
31#include "common/scummsys.h"
32#include "common/types.h"
33#include "common/stream.h"
34
35#include "audio/audiostream.h"
36
37namespace Audio {
38
39// amount of bytes to be used within the decoder classes as buffers
40#define AUDIO_3DO_CACHE_SIZE 1024
41
42// persistent spaces
44 int16 lastSample;
45 int16 stepIndex;
46};
47
49 int16 lastSample1;
50 int16 lastSample2;
51};
52
54public:
55 Audio3DO_ADP4_Stream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, DisposeAfterUse::Flag disposeAfterUse, audio_3DO_ADP4_PersistentSpace *persistentSpace);
56
57protected:
58 const uint16 _sampleRate;
59 const bool _stereo;
60
62 int32 _streamBytesLeft;
63
64 void reset();
65 bool rewind() override;
66 bool endOfData() const override { return (_stream->pos() >= _stream->size()); }
67 bool isStereo() const override { return _stereo; }
68 int getRate() const override { return _sampleRate; }
69
70 int readBuffer(int16 *buffer, const int numSamples) override;
71
72 bool _initialRead;
73 audio_3DO_ADP4_PersistentSpace *_callerDecoderData;
74 audio_3DO_ADP4_PersistentSpace _initialDecoderData;
75 audio_3DO_ADP4_PersistentSpace _curDecoderData;
76
77private:
78 int16 decodeSample(byte compressedNibble);
79};
80
82public:
83 Audio3DO_SDX2_Stream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, DisposeAfterUse::Flag disposeAfterUse, audio_3DO_SDX2_PersistentSpace *persistentSpacePtr);
84
85protected:
86 const uint16 _sampleRate;
87 const bool _stereo;
88
90 int32 _streamBytesLeft;
91
92 void reset();
93 bool rewind() override;
94 bool endOfData() const override { return (_stream->pos() >= _stream->size()); }
95 bool isStereo() const override { return _stereo; }
96 int getRate() const override { return _sampleRate; }
97
98 int readBuffer(int16 *buffer, const int numSamples) override;
99
100 bool _initialRead;
101 audio_3DO_SDX2_PersistentSpace *_callerDecoderData;
102 audio_3DO_SDX2_PersistentSpace _initialDecoderData;
103 audio_3DO_SDX2_PersistentSpace _curDecoderData;
104};
105
120 uint16 sampleRate,
121 bool stereo,
122 uint32 *audioLengthMSecsPtr = NULL, // returns the audio length in milliseconds
123 DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES,
124 audio_3DO_ADP4_PersistentSpace *persistentSpacePtr = NULL
125);
126
141 uint16 sampleRate,
142 bool stereo,
143 uint32 *audioLengthMSecsPtr = NULL, // returns the audio length in milliseconds
144 DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES,
145 audio_3DO_SDX2_PersistentSpace *persistentSpacePtr = NULL
146);
147
148} // End of namespace Audio
149
150#endif
Definition: 3do.h:53
int getRate() const override
Definition: 3do.h:68
bool endOfData() const override
Definition: 3do.h:66
bool isStereo() const override
Definition: 3do.h:67
int readBuffer(int16 *buffer, const int numSamples) override
Definition: 3do.h:81
int readBuffer(int16 *buffer, const int numSamples) override
int getRate() const override
Definition: 3do.h:96
bool isStereo() const override
Definition: 3do.h:95
bool endOfData() const override
Definition: 3do.h:94
Definition: audiostream.h:109
Definition: stream.h:745
virtual int64 pos() const =0
virtual int64 size() const =0
Definition: system.h:39
RewindableAudioStream * make3DO_ADP4AudioStream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, uint32 *audioLengthMSecsPtr=NULL, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES, audio_3DO_ADP4_PersistentSpace *persistentSpacePtr=NULL)
RewindableAudioStream * make3DO_SDX2AudioStream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, uint32 *audioLengthMSecsPtr=NULL, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES, audio_3DO_SDX2_PersistentSpace *persistentSpacePtr=NULL)