Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #ifndef AUDIO_3DO_SDX2_H
00030 #define AUDIO_3DO_SDX2_H
00031
00032 #include "common/scummsys.h"
00033 #include "common/types.h"
00034 #include "common/stream.h"
00035
00036 #include "audio/audiostream.h"
00037
00038 namespace Audio {
00039
00040
00041 #define AUDIO_3DO_CACHE_SIZE 1024
00042
00043
00044 struct audio_3DO_ADP4_PersistentSpace {
00045 int16 lastSample;
00046 int16 stepIndex;
00047 };
00048
00049 struct audio_3DO_SDX2_PersistentSpace {
00050 int16 lastSample1;
00051 int16 lastSample2;
00052 };
00053
00054 class Audio3DO_ADP4_Stream : public RewindableAudioStream {
00055 public:
00056 Audio3DO_ADP4_Stream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, DisposeAfterUse::Flag disposeAfterUse, audio_3DO_ADP4_PersistentSpace *persistentSpace);
00057
00058 protected:
00059 const uint16 _sampleRate;
00060 const bool _stereo;
00061
00062 Common::DisposablePtr<Common::SeekableReadStream> _stream;
00063 int32 _streamBytesLeft;
00064
00065 void reset();
00066 bool rewind();
00067 bool endOfData() const { return (_stream->pos() >= _stream->size()); }
00068 bool isStereo() const { return _stereo; }
00069 int getRate() const { return _sampleRate; }
00070
00071 int readBuffer(int16 *buffer, const int numSamples);
00072
00073 bool _initialRead;
00074 audio_3DO_ADP4_PersistentSpace *_callerDecoderData;
00075 audio_3DO_ADP4_PersistentSpace _initialDecoderData;
00076 audio_3DO_ADP4_PersistentSpace _curDecoderData;
00077
00078 private:
00079 int16 decodeSample(byte compressedNibble);
00080 };
00081
00082 class Audio3DO_SDX2_Stream : public RewindableAudioStream {
00083 public:
00084 Audio3DO_SDX2_Stream(Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, DisposeAfterUse::Flag disposeAfterUse, audio_3DO_SDX2_PersistentSpace *persistentSpacePtr);
00085
00086 protected:
00087 const uint16 _sampleRate;
00088 const bool _stereo;
00089
00090 Common::DisposablePtr<Common::SeekableReadStream> _stream;
00091 int32 _streamBytesLeft;
00092
00093 void reset();
00094 bool rewind();
00095 bool endOfData() const { return (_stream->pos() >= _stream->size()); }
00096 bool isStereo() const { return _stereo; }
00097 int getRate() const { return _sampleRate; }
00098
00099 int readBuffer(int16 *buffer, const int numSamples);
00100
00101 bool _initialRead;
00102 audio_3DO_SDX2_PersistentSpace *_callerDecoderData;
00103 audio_3DO_SDX2_PersistentSpace _initialDecoderData;
00104 audio_3DO_SDX2_PersistentSpace _curDecoderData;
00105 };
00106
00119 RewindableAudioStream *make3DO_ADP4AudioStream(
00120 Common::SeekableReadStream *stream,
00121 uint16 sampleRate,
00122 bool stereo,
00123 uint32 *audioLengthMSecsPtr = NULL,
00124 DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES,
00125 audio_3DO_ADP4_PersistentSpace *persistentSpacePtr = NULL
00126 );
00127
00140 RewindableAudioStream *make3DO_SDX2AudioStream(
00141 Common::SeekableReadStream *stream,
00142 uint16 sampleRate,
00143 bool stereo,
00144 uint32 *audioLengthMSecsPtr = NULL,
00145 DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES,
00146 audio_3DO_SDX2_PersistentSpace *persistentSpacePtr = NULL
00147 );
00148
00149 }
00150
00151 #endif