The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
soundsource::positional_source Class Reference

#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_locationlocations_
 

Static Private Attributes

static unsigned int last_id = 0
 

Detailed Description

Definition at line 35 of file soundsource.hpp.

Constructor & Destructor Documentation

◆ positional_source()

soundsource::positional_source::positional_source ( const sourcespec spec)

Definition at line 110 of file soundsource.cpp.

References faderange_, and range_.

◆ ~positional_source()

soundsource::positional_source::~positional_source ( )

Definition at line 127 of file soundsource.cpp.

References id_, and sound::stop_sound().

Member Function Documentation

◆ calculate_volume()

int soundsource::positional_source::calculate_volume ( const map_location loc,
const display disp 
)

◆ is_global()

bool soundsource::positional_source::is_global ( ) const

Definition at line 132 of file soundsource.cpp.

References locations_.

Referenced by update_positions().

◆ update()

void soundsource::positional_source::update ( const std::chrono::steady_clock::time_point &  time,
const display disp 
)

◆ update_positions()

void soundsource::positional_source::update_positions ( const std::chrono::steady_clock::time_point &  time,
const display disp 
)

◆ write_config()

void soundsource::positional_source::write_config ( config cfg) const

Serializes attributes as WML config.

Parameters
cfgA 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().

Member Data Documentation

◆ chance_

int soundsource::positional_source::chance_
private

Definition at line 38 of file soundsource.hpp.

Referenced by update(), and write_config().

◆ check_fogged_

bool soundsource::positional_source::check_fogged_
private

Definition at line 43 of file soundsource.hpp.

Referenced by calculate_volume(), and write_config().

◆ check_shrouded_

bool soundsource::positional_source::check_shrouded_
private

Definition at line 44 of file soundsource.hpp.

Referenced by calculate_volume(), and write_config().

◆ faderange_

int soundsource::positional_source::faderange_
private

Definition at line 42 of file soundsource.hpp.

Referenced by calculate_volume(), positional_source(), and write_config().

◆ files_

std::string soundsource::positional_source::files_
private

Definition at line 45 of file soundsource.hpp.

Referenced by update(), and write_config().

◆ id_

const unsigned int soundsource::positional_source::id_
private

Definition at line 40 of file soundsource.hpp.

Referenced by update(), update_positions(), and ~positional_source().

◆ last_id

unsigned int soundsource::positional_source::last_id = 0
staticprivate

Definition at line 50 of file soundsource.hpp.

◆ last_played_

std::chrono::steady_clock::time_point soundsource::positional_source::last_played_
private

Definition at line 36 of file soundsource.hpp.

Referenced by update().

◆ locations_

std::vector<map_location> soundsource::positional_source::locations_
private

Definition at line 46 of file soundsource.hpp.

Referenced by is_global(), update(), update_positions(), and write_config().

◆ loops_

int soundsource::positional_source::loops_
private

Definition at line 39 of file soundsource.hpp.

Referenced by update(), and write_config().

◆ min_delay_

std::chrono::milliseconds soundsource::positional_source::min_delay_
private

Definition at line 37 of file soundsource.hpp.

Referenced by update(), and write_config().

◆ range_

int soundsource::positional_source::range_
private

Definition at line 41 of file soundsource.hpp.

Referenced by calculate_volume(), positional_source(), and write_config().


The documentation for this class was generated from the following files: