CPP-TOOLBOX
Loading...
Searching...
No Matches
openal_utils.cpp File Reference
#include "openal_utils.hpp"
#include <iostream>
#include <unordered_map>

Functions

std::string get_attribute_name (ALenum attribute)
 
void display_al_error (const std::string &message, ALenum error)
 
void set_source_float (ALuint source, ALenum attribute, float value)
 
void set_source_float_vector (ALuint source, ALenum attribute, const ALfloat *values)
 
void set_source_int (ALuint source, ALenum attribute, ALint value)
 
void set_source_float3 (ALuint source, ALenum attribute, float x, float y, float z)
 
ALint get_source_int (ALuint source, ALenum attribute)
 
ALfloat get_source_float (ALuint source, ALenum attribute)
 
glm::vec3 get_source_float3 (ALuint source, ALenum attribute)
 
ALfloat get_listener_float (ALenum attribute)
 
glm::vec3 get_listener_float3 (ALenum attribute)
 
ALint get_buffer_int (ALuint buffer, ALenum attribute)
 
ALint get_source_state (ALuint source)
 
void play_source (ALuint source)
 
void stop_source (ALuint source)
 
void pause_source (ALuint source)
 
void rewind_source (ALuint source)
 
void set_listener_attribute_float (ALenum attribute, float value)
 
void set_listener_attribute_float_vector (ALenum attribute, const ALfloat *values)
 
void set_listener_attribute_float3 (ALenum attribute, float x, float y, float z)
 
void set_listener_position (const glm::vec3 &position)
 
void set_listener_velocity (const glm::vec3 &velocity)
 
void set_listener_orientation (const glm::vec3 &at, const glm::vec3 &up)
 
void set_listener_gain (float gain)
 
ALuint create_buffer ()
 
void delete_buffer (ALuint buffer)
 
ALuint create_source ()
 
void delete_source (ALuint source)
 
void set_source_buffer (ALuint source, ALuint buffer)
 
void detach_source_buffer (ALuint source)
 
void set_source_position (ALuint source, const glm::vec3 &position)
 
void set_source_velocity (ALuint source, const glm::vec3 &velocity)
 
void set_source_direction (ALuint source, const glm::vec3 &direction)
 
void set_source_pitch (ALuint source, float pitch)
 
void set_source_gain (ALuint source, float gain)
 
void set_source_looping (ALuint source, bool loop)
 
void initialize_openal ()
 
void shutdown_openal ()
 

Variables

const std::unordered_map< ALenum, std::string > al_attribute_names
 

Function Documentation

◆ create_buffer()

ALuint create_buffer ( )

◆ create_source()

ALuint create_source ( )

◆ delete_buffer()

void delete_buffer ( ALuint buffer)

◆ delete_source()

void delete_source ( ALuint source)

◆ detach_source_buffer()

void detach_source_buffer ( ALuint source)

◆ display_al_error()

void display_al_error ( const std::string & message,
ALenum error )

◆ get_attribute_name()

std::string get_attribute_name ( ALenum attribute)

◆ get_buffer_int()

ALint get_buffer_int ( ALuint buffer,
ALenum attribute )

◆ get_listener_float()

ALfloat get_listener_float ( ALenum attribute)

◆ get_listener_float3()

glm::vec3 get_listener_float3 ( ALenum attribute)

◆ get_source_float()

ALfloat get_source_float ( ALuint source,
ALenum attribute )

◆ get_source_float3()

glm::vec3 get_source_float3 ( ALuint source,
ALenum attribute )

◆ get_source_int()

ALint get_source_int ( ALuint source,
ALenum attribute )

◆ get_source_state()

ALint get_source_state ( ALuint source)

◆ initialize_openal()

void initialize_openal ( )

◆ pause_source()

void pause_source ( ALuint source)

◆ play_source()

void play_source ( ALuint source)

◆ rewind_source()

void rewind_source ( ALuint source)

◆ set_listener_attribute_float()

void set_listener_attribute_float ( ALenum attribute,
float value )

◆ set_listener_attribute_float3()

void set_listener_attribute_float3 ( ALenum attribute,
float x,
float y,
float z )

◆ set_listener_attribute_float_vector()

void set_listener_attribute_float_vector ( ALenum attribute,
const ALfloat * values )

◆ set_listener_gain()

void set_listener_gain ( float gain)

◆ set_listener_orientation()

void set_listener_orientation ( const glm::vec3 & at,
const glm::vec3 & up )

◆ set_listener_position()

void set_listener_position ( const glm::vec3 & position)

◆ set_listener_velocity()

void set_listener_velocity ( const glm::vec3 & velocity)

◆ set_source_buffer()

void set_source_buffer ( ALuint source,
ALuint buffer )

◆ set_source_direction()

void set_source_direction ( ALuint source,
const glm::vec3 & direction )

◆ set_source_float()

void set_source_float ( ALuint source,
ALenum attribute,
float value )

◆ set_source_float3()

void set_source_float3 ( ALuint source,
ALenum attribute,
float x,
float y,
float z )

◆ set_source_float_vector()

void set_source_float_vector ( ALuint source,
ALenum attribute,
const ALfloat * values )

◆ set_source_gain()

void set_source_gain ( ALuint source,
float gain )

◆ set_source_int()

void set_source_int ( ALuint source,
ALenum attribute,
ALint value )

◆ set_source_looping()

void set_source_looping ( ALuint source,
bool loop )

◆ set_source_pitch()

void set_source_pitch ( ALuint source,
float pitch )

◆ set_source_position()

void set_source_position ( ALuint source,
const glm::vec3 & position )

◆ set_source_velocity()

void set_source_velocity ( ALuint source,
const glm::vec3 & velocity )

◆ shutdown_openal()

void shutdown_openal ( )

◆ stop_source()

void stop_source ( ALuint source)

Variable Documentation

◆ al_attribute_names

const std::unordered_map<ALenum, std::string> al_attribute_names
Initial value:
= {
{AL_PITCH, "AL_PITCH"},
{AL_GAIN, "AL_GAIN"},
{AL_POSITION, "AL_POSITION"},
{AL_VELOCITY, "AL_VELOCITY"},
{AL_DIRECTION, "AL_DIRECTION"},
{AL_LOOPING, "AL_LOOPING"},
{AL_BUFFER, "AL_BUFFER"},
{AL_SOURCE_RELATIVE, "AL_SOURCE_RELATIVE"}
}