63 #define READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, ptr, isLE) \ 64 ((is16Bit ? (isLE ? _stream->readUint16LE() : _stream->readUint16BE()) : (_stream->readByte() << 8)) ^ (isUnsigned ? 0x8000 : 0)) 71 template<
bool is16Bit,
bool isUn
signed,
bool isLE>
102 template<
bool is16Bit,
bool isUn
signed,
bool isLE>
104 size_t samples = numSamples;
106 while (samples > 0 && !endOfData()) {
111 return numSamples - samples;
114 template<
bool is16Bit,
bool isUn
signed,
bool isLE>
130 #define MAKE_RAW_STREAM(UNSIGNED) \ 133 return new PCMStream<true, UNSIGNED, true>(rate, channels, disposeAfterUse, stream); \ 135 return new PCMStream<true, UNSIGNED, false>(rate, channels, disposeAfterUse, stream); \ 137 return new PCMStream<false, UNSIGNED, false>(rate, channels, disposeAfterUse, stream) 141 int rate,
byte flags,
int channels,
142 bool disposeAfterUse) {
int getRate() const
Sample rate of the stream.
PacketizedAudioStream * makePacketizedPCMStream(int rate, byte flags, int channels)
Creates a PacketizedAudioStream that will automatically queue packets as individual AudioStreams like...
A PacketizedAudioStream that works closer to a QueuingAudioStream.
unsigned samples (default: signed)
RewindableAudioStream * makePCMStream(Common::SeekableReadStream *stream, int rate, byte flags, int channels, bool disposeAfterUse)
Creates an audio stream, which plays from the given stream.
Decoding PCM (Pulse Code Modulation).
const int _rate
Sample rate of stream.
bool rewind()
Rewinds the stream to its start.
const int _channels
Amount of channels.
int getChannels() const
Return the number channels in this stream.
A rewindable audio stream.
AudioStream * makeStream(Common::SeekableReadStream *data)
Make the AudioStream for a given packet.
int getChannels() const
Return the number channels in this stream.
#define MAKE_RAW_STREAM(UNSIGNED)
bool endOfData() const
End of data reached? If this returns true, it means that at this time there is no data available in t...
Common::DisposablePtr< Common::SeekableReadStream > _stream
Stream to read data from.
An AudioStream designed to work in terms of packets.
This is a stream, which allows for playing raw PCM data from a stream.
int getRate() const
Sample rate of the stream.
PCMStream(int rate, int channels, bool disposeStream, Common::SeekableReadStream *stream)
virtual size_t size() const =0
Obtains the total size of the stream, measured in bytes.
Basic reading stream interfaces.
sound is 16 bits wide (default: 8bit)
Generic audio input stream.
PacketizedPCMStream(int rate, byte flags, int channels)
A smart pointer with a deletion flag.
uint64 getLength() const
Estimate the total number of samples per channel in this stream.
samples are little endian (default: big endian)
#define READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, ptr, isLE)
size_t readBuffer(int16 *buffer, const size_t numSamples)
Fill the given buffer with up to numSamples samples.
Interface for a seekable & readable data stream.