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 
37 namespace 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 
54 public:
55  Audio3DO_ADP4_Stream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, DisposeAfterUse::Flag disposeAfterUse, audio_3DO_ADP4_PersistentSpace *persistentSpace);
56 
57 protected:
58  const uint16 _sampleRate;
59  const bool _stereo;
60 
62  int32 _streamBytesLeft;
63 
64  void reset();
65  bool rewind();
66  bool endOfData() const { return (_stream->pos() >= _stream->size()); }
67  bool isStereo() const { return _stereo; }
68  int getRate() const { return _sampleRate; }
69 
70  int readBuffer(int16 *buffer, const int numSamples);
71 
72  bool _initialRead;
73  audio_3DO_ADP4_PersistentSpace *_callerDecoderData;
74  audio_3DO_ADP4_PersistentSpace _initialDecoderData;
75  audio_3DO_ADP4_PersistentSpace _curDecoderData;
76 
77 private:
78  int16 decodeSample(byte compressedNibble);
79 };
80 
82 public:
83  Audio3DO_SDX2_Stream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, DisposeAfterUse::Flag disposeAfterUse, audio_3DO_SDX2_PersistentSpace *persistentSpacePtr);
84 
85 protected:
86  const uint16 _sampleRate;
87  const bool _stereo;
88 
90  int32 _streamBytesLeft;
91 
92  void reset();
93  bool rewind();
94  bool endOfData() const { return (_stream->pos() >= _stream->size()); }
95  bool isStereo() const { return _stereo; }
96  int getRate() const { return _sampleRate; }
97 
98  int readBuffer(int16 *buffer, const int numSamples);
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
bool endOfData() const
Definition: 3do.h:94
virtual int64 size() const =0
bool isStereo() const
Definition: 3do.h:67
virtual int64 pos() const =0
RewindableAudioStream * make3DO_SDX2AudioStream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, uint32 *audioLengthMSecsPtr=NULL, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES, audio_3DO_SDX2_PersistentSpace *persistentSpacePtr=NULL)
Definition: stream.h:745
bool endOfData() const
Definition: 3do.h:66
int getRate() const
Definition: 3do.h:68
bool isStereo() const
Definition: 3do.h:95
Definition: 3do.h:53
Definition: audiostream.h:109
RewindableAudioStream * make3DO_ADP4AudioStream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, uint32 *audioLengthMSecsPtr=NULL, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES, audio_3DO_ADP4_PersistentSpace *persistentSpacePtr=NULL)
Definition: 3do.h:81
Definition: system.h:37
int getRate() const
Definition: 3do.h:96