50 #ifndef SOUND_AUDIOSTREAM_H 51 #define SOUND_AUDIOSTREAM_H 53 #include <boost/noncopyable.hpp> 61 class SeekableReadStream;
98 virtual int getRate()
const = 0;
134 virtual bool rewind() = 0;
245 virtual void finish() = 0;
285 virtual void finish() = 0;
332 #endif // SOUND_AUDIOSTREAM_H int getRate() const
Sample rate of the stream.
virtual uint64 getDuration() const
Estimate the total duration of the stream in milliseconds.
uint64 getDuration() const
bool endOfStream() const
End of stream reached? If this returns true, it means that all data in this stream is used up and no ...
QueuingAudioStream * makeQueuingAudioStream(int rate, int channels)
Factory function for an QueuingAudioStream.
virtual AudioStream * makeStream(Common::SeekableReadStream *data)=0
Make the AudioStream for a given packet.
virtual ~PacketizedAudioStream()
virtual bool endOfStream() const
End of stream reached? If this returns true, it means that all data in this stream is used up and no ...
bool endOfData() const
End of data reached? If this returns true, it means that at this time there is no data available in t...
int getChannels() const
Return the number channels in this stream.
uint64 getDurationOnce() const
Return the duration of one loop.
void finish()
Mark this stream as finished.
virtual int getChannels() const =0
Return the number channels in this stream.
virtual void finish()=0
Mark this stream as finished.
virtual int getRate() const =0
Sample rate of the stream.
A PacketizedAudioStream that works closer to a QueuingAudioStream.
bool isFinished() const
Is the stream marked as finished?
Common::DisposablePtr< RewindableAudioStream > _parent
A simple scoped smart pointer template.
bool endOfData() const
End of data reached? If this returns true, it means that at this time there is no data available in t...
size_t getCompleteIterations() const
Returns number of loops the stream has played.
int getRate() const
Sample rate of the stream.
virtual void queueAudioStream(AudioStream *audStream, bool disposeAfterUse=true)=0
Queue an audio stream for playback.
virtual bool isFinished() const =0
Is the stream marked as finished?
LoopingAudioStream(RewindableAudioStream *stream, size_t loops, bool disposeAfterUse=true)
Creates a looping audio stream object.
int getChannels() const
Return the number channels in this stream.
void queuePacket(Common::SeekableReadStream *data)
Queue the next packet to be decoded.
virtual uint64 getLength() const
Estimate the total number of samples per channel in this stream.
A rewindable audio stream.
virtual ~StatelessPacketizedAudioStream()
int getChannels() const
Return the number channels in this stream.
size_t readBuffer(int16 *buffer, const size_t numSamples)
Fill the given buffer with up to numSamples samples.
Utility templates and functions.
virtual size_t readBuffer(int16 *buffer, const size_t numSamples)=0
Fill the given buffer with up to numSamples samples.
static const size_t kSizeInvalid
An AudioStream designed to work in terms of packets.
static const uint64 kInvalidLength
virtual size_t numQueuedStreams() const =0
Return the number of streams still queued for playback (including the currently playing stream)...
virtual bool rewind()=0
Rewinds the stream to its start.
Common::ScopedPtr< QueuingAudioStream > _stream
Low-level type definitions to handle fixed width types portably.
size_t _completeIterations
A scoped plain pointer, allowing pointer-y access and normal deletion.
size_t readBuffer(int16 *data, const size_t numSamples)
Fill the given buffer with up to numSamples samples.
A disposable plain pointer, allowing pointer-y access and normal deletion.
bool rewind()
Rewinds the stream to its start.
Generic audio input stream.
A smart pointer with a deletion flag.
An empty audio stream that plays nothing.
virtual void queuePacket(Common::SeekableReadStream *data)=0
Queue the next packet to be decoded.
bool endOfData() const
End of data reached? If this returns true, it means that at this time there is no data available in t...
uint64 getLength() const
Estimate the total number of samples per channel in this stream.
virtual bool isFinished() const =0
Is the stream marked as finished?
AudioStream * makeLoopingAudioStream(RewindableAudioStream *stream, size_t loops)
Wrapper functionality to efficiently create a stream, which might be looped.
virtual void finish()=0
Mark this stream as finished.
uint64 getLengthOnce() const
Return the length of one loop.
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.
virtual bool endOfData() const =0
End of data reached? If this returns true, it means that at this time there is no data available in t...
int getRate() const
Sample rate of the stream.
StatelessPacketizedAudioStream(int rate, int channels)