Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
sound::SoundDataOpenStream Struct Referencefinal

Streaming opened sound data. More...

#include <sound_data.h>

+ Inheritance diagram for sound::SoundDataOpenStream:
+ Collaboration diagram for sound::SoundDataOpenStream:

Classes

struct  ContiguousBuffers
 A sorted non-empty vector of contiguous buffers. More...
 
struct  SoundBufferUntil
 An OpenAL buffer that goes until m_end (exclusive). More...
 

Public Member Functions

 SoundDataOpenStream (std::unique_ptr< RAIIOggFile > oggfile, const OggFileDecodeInfo &decode_info)
 
bool isStreaming () const noexcept override
 Iff the data is streaming, there is more than one buffer.
 
std::tuple< ALuint, ALuint, ALuint > getOrLoadBufferAt (ALuint offset) override
 Load a buffer containing data starting at the given offset.
 
- Public Member Functions inherited from sound::ISoundDataOpen
 ISoundDataOpen (const OggFileDecodeInfo &decode_info)
 
virtual ~ISoundDataOpen ()=default
 

Public Attributes

std::unique_ptr< RAIIOggFilem_oggfile
 
std::vector< ContiguousBuffersm_bufferss
 
- Public Attributes inherited from sound::ISoundDataOpen
OggFileDecodeInfo m_decode_info
 

Private Member Functions

std::tuple< ALuint, ALuint, ALuint > loadBufferAt (ALuint offset, std::vector< ContiguousBuffers >::iterator after_it)
 

Additional Inherited Members

- Static Public Member Functions inherited from sound::ISoundDataOpen
static std::shared_ptr< ISoundDataOpenfromOggFile (std::unique_ptr< RAIIOggFile > oggfile, const std::string &filename_for_logging)
 

Detailed Description

Streaming opened sound data.

Uses a sorted list of contiguous sound data regions (ContiguousBufferss) for efficient seeking.

Constructor & Destructor Documentation

◆ SoundDataOpenStream()

sound::SoundDataOpenStream::SoundDataOpenStream ( std::unique_ptr< RAIIOggFile > oggfile,
const OggFileDecodeInfo & decode_info )

Member Function Documentation

◆ getOrLoadBufferAt()

std::tuple< ALuint, ALuint, ALuint > sound::SoundDataOpenStream::getOrLoadBufferAt ( ALuint offset)
overridevirtual

Load a buffer containing data starting at the given offset.

Or just get it if it was already loaded.

This function returns multiple values:

  • buffer: The OpenAL buffer.
  • buffer_end: The offset (in the file) where buffer ends (exclusive).
  • offset_in_buffer: Offset relative to buffer's start where the requested offset is. offset_in_buffer == 0 is guaranteed if some loaded buffer ends at offset.
Parameters
offsetThe start of the buffer.
Returns
{buffer, buffer_end, offset_in_buffer} or {0, sound_data_end, 0} if offset is invalid.

Implements sound::ISoundDataOpen.

References sound::OggFileDecodeInfo::length_samples, loadBufferAt(), sound::SoundDataOpenStream::ContiguousBuffers::m_buffers, m_bufferss, and sound::ISoundDataOpen::m_decode_info.

+ Here is the call graph for this function:

◆ isStreaming()

bool sound::SoundDataOpenStream::isStreaming ( ) const
inlineoverridevirtualnoexcept

Iff the data is streaming, there is more than one buffer.

Returns
Whether it's streaming data.

Implements sound::ISoundDataOpen.

◆ loadBufferAt()

std::tuple< ALuint, ALuint, ALuint > sound::SoundDataOpenStream::loadBufferAt ( ALuint offset,
std::vector< ContiguousBuffers >::iterator after_it )
private

References sound::OggFileDecodeInfo::freq, sound::OggFileDecodeInfo::length_samples, m_bufferss, sound::ISoundDataOpen::m_decode_info, m_oggfile, and sound::MIN_STREAM_BUFFER_LENGTH.

Referenced by getOrLoadBufferAt().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_bufferss

std::vector<ContiguousBuffers> sound::SoundDataOpenStream::m_bufferss

Referenced by getOrLoadBufferAt(), and loadBufferAt().

◆ m_oggfile

std::unique_ptr<RAIIOggFile> sound::SoundDataOpenStream::m_oggfile

Referenced by loadBufferAt().


The documentation for this struct was generated from the following files: