Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
sound::RAIIOggFile Struct Reference

RAII wrapper for OggVorbis_File. More...

#include <ogg_file.h>

Public Member Functions

 RAIIOggFile ()=default
 
 ~RAIIOggFile () noexcept
 
OggVorbis_File * get ()
 
std::optional< OggFileDecodeInfogetDecodeInfo (const std::string &filename_for_logging)
 
RAIIALSoundBuffer loadBuffer (const OggFileDecodeInfo &decode_info, ALuint pcm_start, ALuint pcm_end)
 Main function for loading ogg vorbis sounds.
 

Public Attributes

bool m_needs_clear = false
 
OggVorbis_File m_file
 

Detailed Description

RAII wrapper for OggVorbis_File.

Constructor & Destructor Documentation

◆ RAIIOggFile()

sound::RAIIOggFile::RAIIOggFile ( )
default

◆ ~RAIIOggFile()

sound::RAIIOggFile::~RAIIOggFile ( )
inlinenoexcept

References m_file, and m_needs_clear.

Member Function Documentation

◆ get()

OggVorbis_File * sound::RAIIOggFile::get ( )
inline

References m_file.

◆ getDecodeInfo()

◆ loadBuffer()

RAIIALSoundBuffer sound::RAIIOggFile::loadBuffer ( const OggFileDecodeInfo & decode_info,
ALuint pcm_start,
ALuint pcm_end )

Main function for loading ogg vorbis sounds.

Loads exactly the specified interval of PCM-data, and creates an OpenAL buffer with it.

Parameters
decode_infoCached meta information of the file.
pcm_startFirst sample in the interval.
pcm_endOne after last sample of the interval (=> exclusive).
Returns
An AL sound buffer, or a 0-buffer on failure.

References sound::OggFileDecodeInfo::bytes_per_sample, sound::OggFileDecodeInfo::format, sound::OggFileDecodeInfo::freq, sound::RAIIALSoundBuffer::generate(), sound::RAIIALSoundBuffer::get(), sound::getAlErrorString(), infostream, sound::OggFileDecodeInfo::length_samples, m_file, sound::OggFileDecodeInfo::name_for_logging, and warningstream.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_file

OggVorbis_File sound::RAIIOggFile::m_file

◆ m_needs_clear

bool sound::RAIIOggFile::m_needs_clear = false

Referenced by ~RAIIOggFile().


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