xoreos  0.0.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Sound::WwRIFFVorbisStream Class Reference
Inheritance diagram for Sound::WwRIFFVorbisStream:
Inheritance graph
[legend]
Collaboration diagram for Sound::WwRIFFVorbisStream:
Collaboration graph
[legend]

Public Member Functions

 WwRIFFVorbisStream (Common::SeekableReadStream *inStream, bool disposeStream, Common::SeekableReadStream *codebooks, bool disposeCodebooks, bool fullSetup)
 
size_t readBuffer (int16 *buffer, const size_t numSamples)
 Fill the given buffer with up to numSamples samples. More...
 
int getChannels () const
 Return the number channels in this stream. More...
 
int getRate () const
 Sample rate of the stream. More...
 
bool endOfData () const
 End of data reached? If this returns true, it means that at this time there is no data available in the stream. More...
 
bool rewind ()
 Rewinds the stream to its start. More...
 
uint64 getLength () const
 Estimate the total number of samples per channel in this stream. More...
 
- Public Member Functions inherited from Sound::RewindableAudioStream
virtual uint64 getDuration () const
 Estimate the total duration of the stream in milliseconds. More...
 
- Public Member Functions inherited from Sound::AudioStream
virtual ~AudioStream ()
 
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 additional data will appear in it in the future. More...
 

Private Member Functions

void init ()
 
Common::SeekableReadStreamgenerateHeaderIdentification ()
 
Common::SeekableReadStreamgenerateHeaderComment ()
 
Common::SeekableReadStreamgenerateHeaderSetup ()
 
Common::SeekableReadStreamcreatePacket ()
 

Private Attributes

Common::ScopedPtr< Sound::PacketizedAudioStream_vorbis
 
Common::DisposablePtr< Common::SeekableReadStream_inStream
 
Common::DisposablePtr< Common::SeekableReadStream_codebooks
 
bool _fullSetup
 
bool _headerTriadPresent
 
bool _oldPacketHeaders
 
bool _noGranule
 
bool _modPackets
 
size_t _dataOffset
 
size_t _dataSize
 
size_t _currentOffset
 
size_t _setupPacketOffset
 
size_t _firstAudioPacketOffset
 
uint16 _channels
 
uint32 _sampleRate
 
uint32 _averageBytesPerSecond
 
uint64 _sampleCount
 
uint32 _uid
 
uint8 _blocksize0Pow
 
uint8 _blocksize1Pow
 
uint32 _loopCount
 
uint32 _loopStart
 
uint32 _loopEnd
 
Common::ScopedArray< bool > _modeBlockFlags
 
size_t _modeBits
 
bool _end
 

Additional Inherited Members

- Static Public Attributes inherited from Sound::RewindableAudioStream
static const uint64 kInvalidLength = UINT64_C(0xFFFFFFFFFFFFFFFF)
 
- Static Public Attributes inherited from Sound::AudioStream
static const size_t kSizeInvalid = SIZE_MAX
 

Detailed Description

Definition at line 313 of file wwriffvorbis.cpp.

Constructor & Destructor Documentation

◆ WwRIFFVorbisStream()

Sound::WwRIFFVorbisStream::WwRIFFVorbisStream ( Common::SeekableReadStream inStream,
bool  disposeStream,
Common::SeekableReadStream codebooks,
bool  disposeCodebooks,
bool  fullSetup 
)

Definition at line 407 of file wwriffvorbis.cpp.

References _headerTriadPresent, _modPackets, _oldPacketHeaders, init(), and rewind().

Here is the call graph for this function:

Member Function Documentation

◆ createPacket()

Common::SeekableReadStream * Sound::WwRIFFVorbisStream::createPacket ( )
private

Definition at line 1002 of file wwriffvorbis.cpp.

References _currentOffset, _dataOffset, _dataSize, _inStream, _noGranule, Sound::Packet::headerSize(), Sound::Packet::nextOffset(), Sound::Packet::offset(), and Sound::Packet::size().

Referenced by readBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ endOfData()

bool Sound::WwRIFFVorbisStream::endOfData ( ) const
virtual

End of data reached? If this returns true, it means that at this time there is no data available in the stream.

However there may be more data in the future. This is used by e.g. a rate converter to decide whether to keep on converting data or stop.

Implements Sound::AudioStream.

Definition at line 442 of file wwriffvorbis.cpp.

References _end.

◆ generateHeaderComment()

Common::SeekableReadStream * Sound::WwRIFFVorbisStream::generateHeaderComment ( )
private

◆ generateHeaderIdentification()

Common::SeekableReadStream * Sound::WwRIFFVorbisStream::generateHeaderIdentification ( )
private

◆ generateHeaderSetup()

Common::SeekableReadStream * Sound::WwRIFFVorbisStream::generateHeaderSetup ( )
private

◆ getChannels()

int Sound::WwRIFFVorbisStream::getChannels ( ) const
virtual

Return the number channels in this stream.

Implements Sound::AudioStream.

Definition at line 434 of file wwriffvorbis.cpp.

References _vorbis.

◆ getLength()

uint64 Sound::WwRIFFVorbisStream::getLength ( ) const
virtual

Estimate the total number of samples per channel in this stream.

If this value is not calculatable, return kInvalidLength.

Reimplemented from Sound::RewindableAudioStream.

Definition at line 460 of file wwriffvorbis.cpp.

References _sampleCount.

◆ getRate()

int Sound::WwRIFFVorbisStream::getRate ( ) const
virtual

Sample rate of the stream.

Implements Sound::AudioStream.

Definition at line 438 of file wwriffvorbis.cpp.

References _vorbis.

◆ init()

void Sound::WwRIFFVorbisStream::init ( )
private

◆ readBuffer()

size_t Sound::WwRIFFVorbisStream::readBuffer ( int16 buffer,
const size_t  numSamples 
)
virtual

Fill the given buffer with up to numSamples samples.

Returns the actual number of samples read, or kSizeInvalid if a critical error occurred (note: you must check if this value is less than what you requested, this can happen when the stream is fully used up).

Data has to be in native endianness, 16 bit per sample, signed. For stereo stream, buffer will be filled with interleaved left and right channel samples, starting with a left sample. Furthermore, the samples in the left and right are summed up. So if you request 4 samples from a stereo stream, you will get a total of two left channel and two right channel samples.

The same holds true for more channels. Channel configurations recognized:

  • 5.1: front left, front right, front center, low frequency rear left, rear right

Implements Sound::AudioStream.

Definition at line 464 of file wwriffvorbis.cpp.

References _end, _vorbis, createPacket(), and Common::ScopedPtrBase< T, Deallocator >::release().

Here is the call graph for this function:

◆ rewind()

bool Sound::WwRIFFVorbisStream::rewind ( )
virtual

Rewinds the stream to its start.

Returns
true on success, false otherwise.

Implements Sound::RewindableAudioStream.

Definition at line 446 of file wwriffvorbis.cpp.

References _currentOffset, _dataOffset, _end, _firstAudioPacketOffset, _vorbis, generateHeaderComment(), generateHeaderIdentification(), generateHeaderSetup(), Sound::makePacketizedVorbisStream(), and Common::ScopedPtrBase< T, Deallocator >::reset().

Referenced by WwRIFFVorbisStream().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _averageBytesPerSecond

uint32 Sound::WwRIFFVorbisStream::_averageBytesPerSecond
private

Definition at line 350 of file wwriffvorbis.cpp.

Referenced by generateHeaderIdentification(), and init().

◆ _blocksize0Pow

uint8 Sound::WwRIFFVorbisStream::_blocksize0Pow
private

Definition at line 355 of file wwriffvorbis.cpp.

Referenced by generateHeaderIdentification(), and init().

◆ _blocksize1Pow

uint8 Sound::WwRIFFVorbisStream::_blocksize1Pow
private

Definition at line 356 of file wwriffvorbis.cpp.

Referenced by generateHeaderIdentification(), and init().

◆ _channels

uint16 Sound::WwRIFFVorbisStream::_channels
private

Definition at line 348 of file wwriffvorbis.cpp.

Referenced by generateHeaderIdentification(), generateHeaderSetup(), and init().

◆ _codebooks

Common::DisposablePtr<Common::SeekableReadStream> Sound::WwRIFFVorbisStream::_codebooks
private

Definition at line 333 of file wwriffvorbis.cpp.

Referenced by generateHeaderSetup().

◆ _currentOffset

size_t Sound::WwRIFFVorbisStream::_currentOffset
private

Definition at line 343 of file wwriffvorbis.cpp.

Referenced by createPacket(), and rewind().

◆ _dataOffset

size_t Sound::WwRIFFVorbisStream::_dataOffset
private

Definition at line 341 of file wwriffvorbis.cpp.

Referenced by createPacket(), generateHeaderSetup(), init(), and rewind().

◆ _dataSize

size_t Sound::WwRIFFVorbisStream::_dataSize
private

Definition at line 342 of file wwriffvorbis.cpp.

Referenced by createPacket(), and init().

◆ _end

bool Sound::WwRIFFVorbisStream::_end
private

Definition at line 365 of file wwriffvorbis.cpp.

Referenced by endOfData(), readBuffer(), and rewind().

◆ _firstAudioPacketOffset

size_t Sound::WwRIFFVorbisStream::_firstAudioPacketOffset
private

Definition at line 346 of file wwriffvorbis.cpp.

Referenced by generateHeaderSetup(), init(), and rewind().

◆ _fullSetup

bool Sound::WwRIFFVorbisStream::_fullSetup
private

Definition at line 335 of file wwriffvorbis.cpp.

Referenced by generateHeaderSetup().

◆ _headerTriadPresent

bool Sound::WwRIFFVorbisStream::_headerTriadPresent
private

Definition at line 336 of file wwriffvorbis.cpp.

Referenced by init(), and WwRIFFVorbisStream().

◆ _inStream

Common::DisposablePtr<Common::SeekableReadStream> Sound::WwRIFFVorbisStream::_inStream
private

Definition at line 332 of file wwriffvorbis.cpp.

Referenced by createPacket(), generateHeaderSetup(), and init().

◆ _loopCount

uint32 Sound::WwRIFFVorbisStream::_loopCount
private

Definition at line 358 of file wwriffvorbis.cpp.

Referenced by init().

◆ _loopEnd

uint32 Sound::WwRIFFVorbisStream::_loopEnd
private

Definition at line 360 of file wwriffvorbis.cpp.

Referenced by init().

◆ _loopStart

uint32 Sound::WwRIFFVorbisStream::_loopStart
private

Definition at line 359 of file wwriffvorbis.cpp.

Referenced by init().

◆ _modeBits

size_t Sound::WwRIFFVorbisStream::_modeBits
private

Definition at line 363 of file wwriffvorbis.cpp.

Referenced by generateHeaderSetup().

◆ _modeBlockFlags

Common::ScopedArray<bool> Sound::WwRIFFVorbisStream::_modeBlockFlags
private

Definition at line 362 of file wwriffvorbis.cpp.

Referenced by generateHeaderSetup().

◆ _modPackets

bool Sound::WwRIFFVorbisStream::_modPackets
private

Definition at line 339 of file wwriffvorbis.cpp.

Referenced by init(), and WwRIFFVorbisStream().

◆ _noGranule

bool Sound::WwRIFFVorbisStream::_noGranule
private

Definition at line 338 of file wwriffvorbis.cpp.

Referenced by createPacket(), generateHeaderSetup(), and init().

◆ _oldPacketHeaders

bool Sound::WwRIFFVorbisStream::_oldPacketHeaders
private

Definition at line 337 of file wwriffvorbis.cpp.

Referenced by init(), and WwRIFFVorbisStream().

◆ _sampleCount

uint64 Sound::WwRIFFVorbisStream::_sampleCount
private

Definition at line 352 of file wwriffvorbis.cpp.

Referenced by getLength(), and init().

◆ _sampleRate

uint32 Sound::WwRIFFVorbisStream::_sampleRate
private

Definition at line 349 of file wwriffvorbis.cpp.

Referenced by generateHeaderIdentification(), and init().

◆ _setupPacketOffset

size_t Sound::WwRIFFVorbisStream::_setupPacketOffset
private

Definition at line 345 of file wwriffvorbis.cpp.

Referenced by generateHeaderSetup(), and init().

◆ _uid

uint32 Sound::WwRIFFVorbisStream::_uid
private

Definition at line 354 of file wwriffvorbis.cpp.

Referenced by init().

◆ _vorbis

Common::ScopedPtr<Sound::PacketizedAudioStream> Sound::WwRIFFVorbisStream::_vorbis
private

Definition at line 330 of file wwriffvorbis.cpp.

Referenced by getChannels(), getRate(), readBuffer(), and rewind().


The documentation for this class was generated from the following file: