11 #include <unordered_map> 14 #include "al_lib_fwd.hpp" 16 using ALCdevice =
struct ALCdevice_struct;
17 using ALCcontext =
struct ALCcontext_struct;
23 struct Vec3f {
float data[3]; };
25 void check_for_al_error();
33 static Sound load_wav(
const char* path);
35 Sound(
Sound&& o) noexcept : _debug_name(o._debug_name), _buffer_id(o._buffer_id), _size_bytes(o._size_bytes) { o._buffer_id = 0; o._size_bytes = 0; }
46 Sound(
const char* debug_name,
unsigned buffer_id,
unsigned size_bytes);
48 const char* _debug_name;
68 static int max_sources();
73 void set_state(State arg);
81 void set_sound(Sound_SP sound);
82 const Sound_SP& sound()
const;
85 void set_gain(
float gain);
89 void set_pitch(
float pitch);
99 void set_direction(
Vec3f);
100 Vec3f direction()
const;
107 void set_max_distance(
float arg);
108 float max_distance()
const;
111 void set_rolloff_factor(
float arg);
112 float rolloff_factor()
const;
119 void set_reference_distance(
float arg);
120 float reference_distance()
const;
122 void set_min_gain(
float arg);
123 float min_gain()
const;
125 void set_max_gain(
float arg);
126 float max_gain()
const;
128 void set_cone_outer_gain(
float arg);
129 float cone_outer_gain()
const;
131 void set_cone_inner_angle(
float arg);
132 float cone_inner_angle()
const;
134 void set_cone_outer_angle(
float arg);
135 float cone_outer_angle()
const;
138 void set_relative_to_listener(
bool arg);
139 bool relative_to_listener()
const;
141 void set_looping(
bool);
142 bool looping()
const;
166 void set_orientation(
const Vec3f& forward,
const Vec3f& up);
168 Vec3f direction()
const;
171 void set_gain(
float);
182 explicit SoundMngr(
const std::string& sfx_dir);
188 void prefetch(
const std::string& sound_name);
191 void prefetch_all(
const std::string& sub_folder =
"");
195 Source_SP play(
const std::string& sound_name);
200 bool is_working()
const;
202 Listener* listener() {
return &_listener; }
208 INVERSE_DISTANCE_CLAMPED,
212 void set_doppler_vel(
float vel);
217 void set_doppler_factor(
float factor);
219 float doppler_factor();
222 void set_distance_model(DistanceModel model);
224 DistanceModel distance_model();
226 const char* vendor();
227 const char* version();
228 const char* renderer();
229 const char* extensions();
233 void print_memory_usage()
const;
236 Sound_SP load_sound(
const std::string& sound_name,
bool is_hot);
237 Source_SP get_source();
239 using SoundMap = std::unordered_map<std::string, Sound_SP>;
240 using SourceList = std::vector<Source_SP>;
242 std::string _sfx_dir;
243 ALCdevice* _device =
nullptr;
244 ALCcontext* _context =
nullptr;
Definition: al_lib.hpp:157
A sound source. Has position, and a sound to play.
Definition: al_lib.hpp:56
Definition: al_lib.hpp:19
Definition: al_lib.hpp:23
A loaded sound. Can be played via Source. Many Source:s can play the same Sound at the same...
Definition: al_lib.hpp:30
You should have only one of these.
Definition: al_lib.hpp:178
unsigned size_bytes() const
Memory usage.
Definition: al_lib.hpp:39