ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

3do.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 // amount of bytes to be used within the decoder classes as buffers
00041 #define AUDIO_3DO_CACHE_SIZE 1024
00042 
00043 // persistent spaces
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, // returns the audio length in milliseconds
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, // returns the audio length in milliseconds
00145     DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES,
00146     audio_3DO_SDX2_PersistentSpace *persistentSpacePtr = NULL
00147 );
00148 
00149 } // End of namespace Audio
00150 
00151 #endif


Generated on Sat Oct 19 2019 05:00:46 for ResidualVM by doxygen 1.7.1
curved edge   curved edge