#include <soundsource.hpp>
Public Member Functions | |
positional_source (const sourcespec &spec) | |
~positional_source () | |
bool | is_global () const |
void | update (const std::chrono::steady_clock::time_point &time, const display &disp) |
void | update_positions (const std::chrono::steady_clock::time_point &time, const display &disp) |
int | calculate_volume (const map_location &loc, const display &disp) |
void | write_config (config &cfg) const |
Serializes attributes as WML config. More... | |
Private Attributes | |
std::chrono::steady_clock::time_point | last_played_ |
std::chrono::milliseconds | min_delay_ |
int | chance_ |
int | loops_ |
const unsigned int | id_ |
int | range_ |
int | faderange_ |
bool | check_fogged_ |
bool | check_shrouded_ |
std::string | files_ |
std::vector< map_location > | locations_ |
Static Private Attributes | |
static unsigned int | last_id = 0 |
Definition at line 35 of file soundsource.hpp.
soundsource::positional_source::positional_source | ( | const sourcespec & | spec | ) |
Definition at line 110 of file soundsource.cpp.
References faderange_, and range_.
soundsource::positional_source::~positional_source | ( | ) |
Definition at line 127 of file soundsource.cpp.
References id_, and sound::stop_sound().
int soundsource::positional_source::calculate_volume | ( | const map_location & | loc, |
const display & | disp | ||
) |
Definition at line 190 of file soundsource.cpp.
References check_fogged_, check_shrouded_, distance_between(), DISTANCE_SILENT, faderange_, display::fogged(), display::hex_clicked_on(), display::map_area(), range_, and display::shrouded().
Referenced by update(), and update_positions().
bool soundsource::positional_source::is_global | ( | ) | const |
Definition at line 132 of file soundsource.cpp.
References locations_.
Referenced by update_positions().
void soundsource::positional_source::update | ( | const std::chrono::steady_clock::time_point & | time, |
const display & | disp | ||
) |
Definition at line 137 of file soundsource.cpp.
References calculate_volume(), chance_, randomness::rng::default_instance(), DISTANCE_SILENT, files_, randomness::rng::get_random_int(), i, id_, sound::is_sound_playing(), last_played_, locations_, loops_, min_delay_, and sound::play_sound_positioned().
Referenced by update_positions().
void soundsource::positional_source::update_positions | ( | const std::chrono::steady_clock::time_point & | time, |
const display & | disp | ||
) |
Definition at line 169 of file soundsource.cpp.
References calculate_volume(), DISTANCE_SILENT, i, id_, is_global(), sound::is_sound_playing(), locations_, sound::reposition_sound(), and update().
void soundsource::positional_source::write_config | ( | config & | cfg | ) | const |
Serializes attributes as WML config.
cfg | A reference to a [sound_source] tag object. |
Definition at line 214 of file soundsource.cpp.
References chance_, check_fogged_, check_shrouded_, faderange_, files_, locations_, loops_, min_delay_, range_, and write_locations().
|
private |
Definition at line 38 of file soundsource.hpp.
Referenced by update(), and write_config().
|
private |
Definition at line 43 of file soundsource.hpp.
Referenced by calculate_volume(), and write_config().
|
private |
Definition at line 44 of file soundsource.hpp.
Referenced by calculate_volume(), and write_config().
|
private |
Definition at line 42 of file soundsource.hpp.
Referenced by calculate_volume(), positional_source(), and write_config().
|
private |
Definition at line 45 of file soundsource.hpp.
Referenced by update(), and write_config().
|
private |
Definition at line 40 of file soundsource.hpp.
Referenced by update(), update_positions(), and ~positional_source().
|
staticprivate |
Definition at line 50 of file soundsource.hpp.
|
private |
Definition at line 36 of file soundsource.hpp.
Referenced by update().
|
private |
Definition at line 46 of file soundsource.hpp.
Referenced by is_global(), update(), update_positions(), and write_config().
|
private |
Definition at line 39 of file soundsource.hpp.
Referenced by update(), and write_config().
|
private |
Definition at line 37 of file soundsource.hpp.
Referenced by update(), and write_config().
|
private |
Definition at line 41 of file soundsource.hpp.
Referenced by calculate_volume(), positional_source(), and write_config().