Minetest  5.4.0
sound_openal.cpp File Reference
#include "sound_openal.h"
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#include <cmath>
#include <vorbis/vorbisfile.h>
#include <cassert>
#include "log.h"
#include "util/numeric.h"
#include "porting.h"
#include <vector>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
+ Include dependency graph for sound_openal.cpp:

Classes

struct  SoundBuffer
 
struct  BufferSource
 
struct  PlayingSound
 
class  SoundManagerSingleton
 
class  OpenALSoundManager
 
struct  OpenALSoundManager::FadeState
 

Macros

#define BUFFER_SIZE   30000
 

Typedefs

typedef std::unique_ptr< ALCdevice, void(*)(ALCdevice *p)> unique_ptr_alcdevice
 
typedef std::unique_ptr< ALCcontext, void(*)(ALCcontext *p)> unique_ptr_alccontext
 

Functions

static void delete_alcdevice (ALCdevice *p)
 
static void delete_alccontext (ALCcontext *p)
 
static const char * alErrorString (ALenum err)
 
static ALenum warn_if_error (ALenum err, const char *desc)
 
void f3_set (ALfloat *f3, v3f v)
 
SoundBufferload_opened_ogg_file (OggVorbis_File *oggFile, const std::string &filename_for_logging)
 
SoundBufferload_ogg_from_file (const std::string &path)
 
size_t buffer_sound_read_func (void *ptr, size_t size, size_t nmemb, void *datasource)
 
int buffer_sound_seek_func (void *datasource, ogg_int64_t offset, int whence)
 
long BufferSourceell_func (void *datasource)
 
SoundBufferload_ogg_from_buffer (const std::string &buf, const std::string &id_for_log)
 
std::shared_ptr< SoundManagerSingletoncreateSoundManagerSingleton ()
 
ISoundManagercreateOpenALSoundManager (SoundManagerSingleton *smg, OnDemandSoundFetcher *fetcher)
 

Variables

std::shared_ptr< SoundManagerSingletong_sound_manager_singleton
 
static ov_callbacks g_buffer_ov_callbacks
 

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   30000

Typedef Documentation

◆ unique_ptr_alccontext

typedef std::unique_ptr<ALCcontext, void(*)(ALCcontext *p)> unique_ptr_alccontext

◆ unique_ptr_alcdevice

typedef std::unique_ptr<ALCdevice, void (*)(ALCdevice *p)> unique_ptr_alcdevice

Function Documentation

◆ alErrorString()

static const char* alErrorString ( ALenum  err)
static

Referenced by load_opened_ogg_file(), and warn_if_error().

+ Here is the caller graph for this function:

◆ buffer_sound_read_func()

size_t buffer_sound_read_func ( void *  ptr,
size_t  size,
size_t  nmemb,
void *  datasource 
)

◆ buffer_sound_seek_func()

int buffer_sound_seek_func ( void *  datasource,
ogg_int64_t  offset,
int  whence 
)

◆ BufferSourceell_func()

long BufferSourceell_func ( void *  datasource)

◆ createOpenALSoundManager()

ISoundManager* createOpenALSoundManager ( SoundManagerSingleton smg,
OnDemandSoundFetcher fetcher 
)

Referenced by GUIEngine::GUIEngine(), and Game::initSound().

+ Here is the caller graph for this function:

◆ createSoundManagerSingleton()

std::shared_ptr<SoundManagerSingleton> createSoundManagerSingleton ( )

Referenced by ClientLauncher::run().

+ Here is the caller graph for this function:

◆ delete_alccontext()

static void delete_alccontext ( ALCcontext *  p)
static

References p().

Referenced by SoundManagerSingleton::init().

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

◆ delete_alcdevice()

static void delete_alcdevice ( ALCdevice *  p)
static

References p().

Referenced by SoundManagerSingleton::init().

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

◆ f3_set()

void f3_set ( ALfloat *  f3,
v3f  v 
)

Referenced by OpenALSoundManager::updateListener().

+ Here is the caller graph for this function:

◆ load_ogg_from_buffer()

SoundBuffer* load_ogg_from_buffer ( const std::string &  buf,
const std::string &  id_for_log 
)

References BufferSource::buf, BufferSource::cur_offset, g_buffer_ov_callbacks, infostream, BufferSource::len, and load_opened_ogg_file().

Referenced by OpenALSoundManager::loadSoundData().

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

◆ load_ogg_from_file()

SoundBuffer* load_ogg_from_file ( const std::string &  path)

References infostream, and load_opened_ogg_file().

Referenced by OpenALSoundManager::loadSoundFile().

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

◆ load_opened_ogg_file()

SoundBuffer* load_opened_ogg_file ( OggVorbis_File *  oggFile,
const std::string &  filename_for_logging 
)

References alErrorString(), SoundBuffer::buffer, SoundBuffer::buffer_id, BUFFER_SIZE, SoundBuffer::format, SoundBuffer::freq, and infostream.

Referenced by load_ogg_from_buffer(), and load_ogg_from_file().

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

◆ warn_if_error()

static ALenum warn_if_error ( ALenum  err,
const char *  desc 
)
static

References alErrorString(), and warningstream.

Referenced by OpenALSoundManager::createPlayingSound(), OpenALSoundManager::createPlayingSoundAt(), and OpenALSoundManager::updateListener().

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

Variable Documentation

◆ g_buffer_ov_callbacks

ov_callbacks g_buffer_ov_callbacks
static
Initial value:
= {
nullptr,
}
int buffer_sound_seek_func(void *datasource, ogg_int64_t offset, int whence)
Definition: sound_openal.cpp:209
size_t buffer_sound_read_func(void *ptr, size_t size, size_t nmemb, void *datasource)
Definition: sound_openal.cpp:200
long BufferSourceell_func(void *datasource)
Definition: sound_openal.cpp:232

Referenced by load_ogg_from_buffer().

◆ g_sound_manager_singleton