#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>
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) |
SoundBuffer * | load_opened_ogg_file (OggVorbis_File *oggFile, const std::string &filename_for_logging) |
SoundBuffer * | load_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) |
SoundBuffer * | load_ogg_from_buffer (const std::string &buf, const std::string &id_for_log) |
std::shared_ptr< SoundManagerSingleton > | createSoundManagerSingleton () |
ISoundManager * | createOpenALSoundManager (SoundManagerSingleton *smg, OnDemandSoundFetcher *fetcher) |
Variables | |
std::shared_ptr< SoundManagerSingleton > | g_sound_manager_singleton |
static ov_callbacks | g_buffer_ov_callbacks |
#define BUFFER_SIZE 30000 |
typedef std::unique_ptr<ALCcontext, void(*)(ALCcontext *p)> unique_ptr_alccontext |
typedef std::unique_ptr<ALCdevice, void (*)(ALCdevice *p)> unique_ptr_alcdevice |
|
static |
Referenced by load_opened_ogg_file(), and warn_if_error().
size_t buffer_sound_read_func | ( | void * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
void * | datasource | ||
) |
References BufferSource::buf, BufferSource::cur_offset, BufferSource::len, and MYMIN.
int buffer_sound_seek_func | ( | void * | datasource, |
ogg_int64_t | offset, | ||
int | whence | ||
) |
References BufferSource::cur_offset, BufferSource::len, MYMAX, and MYMIN.
long BufferSourceell_func | ( | void * | datasource | ) |
References BufferSource::cur_offset.
ISoundManager* createOpenALSoundManager | ( | SoundManagerSingleton * | smg, |
OnDemandSoundFetcher * | fetcher | ||
) |
Referenced by GUIEngine::GUIEngine(), and Game::initSound().
std::shared_ptr<SoundManagerSingleton> createSoundManagerSingleton | ( | ) |
|
static |
References p().
Referenced by SoundManagerSingleton::init().
|
static |
References p().
Referenced by SoundManagerSingleton::init().
void f3_set | ( | ALfloat * | f3, |
v3f | v | ||
) |
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().
SoundBuffer* load_ogg_from_file | ( | const std::string & | path | ) |
References infostream, and load_opened_ogg_file().
Referenced by OpenALSoundManager::loadSoundFile().
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().
|
static |
References alErrorString(), and warningstream.
Referenced by OpenALSoundManager::createPlayingSound(), OpenALSoundManager::createPlayingSoundAt(), and OpenALSoundManager::updateListener().
|
static |
Referenced by load_ogg_from_buffer().
std::shared_ptr<SoundManagerSingleton> g_sound_manager_singleton |
Referenced by GUIEngine::GUIEngine(), ClientLauncher::~ClientLauncher(), Game::initSound(), and ClientLauncher::run().