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

Sound source info class. More...

#include <soundsource.hpp>

Public Member Functions

 sourcespec (const std::string &id, const std::string &files, const std::chrono::milliseconds &min_delay, int chance)
 Parameter-list constructor. More...
 
 sourcespec (const config &cfg)
 WML constructor. More...
 
void write (config &cfg) const
 Serializes information into cfg as a new (appended) child of key "sound_source". More...
 
int loops () const
 
void set_loops (int value)
 
bool check_fogged () const
 
bool check_shrouded () const
 
void set_check_fogged (bool value)
 
void set_check_shrouded (bool value)
 
const std::vector< map_location > & get_locations () const
 
void set_locations (const std::vector< map_location > &locs)
 
int full_range () const
 
void set_full_range (int value)
 
int fade_range () const
 
void set_fade_range (int value)
 
auto minimum_delay () const
 
void set_minimum_delay (const std::chrono::milliseconds &value)
 
int chance () const
 
void set_chance (int value)
 
const std::string & id () const
 
const std::string & files () const
 
void set_files (const std::string &f)
 

Private Attributes

const std::string id_
 
std::string files_
 
std::chrono::milliseconds min_delay_
 
int chance_
 
int loops_
 
int range_
 
int faderange_
 
bool check_fogged_
 
bool check_shrouded_
 
std::vector< map_locationlocations_
 

Detailed Description

Sound source info class.

Encapsulates sound source parameters, so that they're easier to pass around/extend/read.

Definition at line 115 of file soundsource.hpp.

Constructor & Destructor Documentation

◆ sourcespec() [1/2]

soundsource::sourcespec::sourcespec ( const std::string &  id,
const std::string &  files,
const std::chrono::milliseconds &  min_delay,
int  chance 
)
inline

Parameter-list constructor.

Definition at line 133 of file soundsource.hpp.

◆ sourcespec() [2/2]

soundsource::sourcespec::sourcespec ( const config cfg)

WML constructor.

Definition at line 241 of file soundsource.cpp.

References locations_, and read_locations().

Member Function Documentation

◆ chance()

int soundsource::sourcespec::chance ( ) const
inline

Definition at line 198 of file soundsource.hpp.

References chance_.

Referenced by impl_source_eq().

◆ check_fogged()

bool soundsource::sourcespec::check_fogged ( ) const
inline

Definition at line 161 of file soundsource.hpp.

References check_fogged_.

Referenced by impl_source_eq().

◆ check_shrouded()

bool soundsource::sourcespec::check_shrouded ( ) const
inline

Definition at line 162 of file soundsource.hpp.

References check_shrouded_.

Referenced by impl_source_eq().

◆ fade_range()

int soundsource::sourcespec::fade_range ( ) const
inline

Definition at line 186 of file soundsource.hpp.

References faderange_.

Referenced by impl_source_eq().

◆ files()

const std::string& soundsource::sourcespec::files ( ) const
inline

Definition at line 206 of file soundsource.hpp.

References files_.

Referenced by impl_source_eq().

◆ full_range()

int soundsource::sourcespec::full_range ( ) const
inline

Definition at line 180 of file soundsource.hpp.

References range_.

Referenced by impl_source_eq().

◆ get_locations()

const std::vector<map_location>& soundsource::sourcespec::get_locations ( ) const
inline

Definition at line 172 of file soundsource.hpp.

References locations_.

Referenced by impl_source_eq().

◆ id()

const std::string& soundsource::sourcespec::id ( ) const
inline

Definition at line 204 of file soundsource.hpp.

References id_.

Referenced by soundsource::manager::add(), and impl_source_eq().

◆ loops()

int soundsource::sourcespec::loops ( ) const
inline

Definition at line 155 of file soundsource.hpp.

References loops_.

Referenced by impl_source_eq().

◆ minimum_delay()

auto soundsource::sourcespec::minimum_delay ( ) const
inline

Definition at line 192 of file soundsource.hpp.

References min_delay_.

Referenced by impl_source_eq().

◆ set_chance()

void soundsource::sourcespec::set_chance ( int  value)
inline

Definition at line 200 of file soundsource.hpp.

References chance_.

◆ set_check_fogged()

void soundsource::sourcespec::set_check_fogged ( bool  value)
inline

Definition at line 164 of file soundsource.hpp.

References check_fogged_.

◆ set_check_shrouded()

void soundsource::sourcespec::set_check_shrouded ( bool  value)
inline

Definition at line 168 of file soundsource.hpp.

References check_shrouded_.

◆ set_fade_range()

void soundsource::sourcespec::set_fade_range ( int  value)
inline

Definition at line 188 of file soundsource.hpp.

References faderange_.

◆ set_files()

void soundsource::sourcespec::set_files ( const std::string &  f)
inline

Definition at line 208 of file soundsource.hpp.

References f, and files_.

◆ set_full_range()

void soundsource::sourcespec::set_full_range ( int  value)
inline

Definition at line 182 of file soundsource.hpp.

References range_.

◆ set_locations()

void soundsource::sourcespec::set_locations ( const std::vector< map_location > &  locs)
inline

Definition at line 176 of file soundsource.hpp.

References locations_.

◆ set_loops()

void soundsource::sourcespec::set_loops ( int  value)
inline

Definition at line 157 of file soundsource.hpp.

References loops_.

◆ set_minimum_delay()

void soundsource::sourcespec::set_minimum_delay ( const std::chrono::milliseconds &  value)
inline

Definition at line 194 of file soundsource.hpp.

References min_delay_.

◆ write()

void soundsource::sourcespec::write ( config cfg) const

Serializes information into cfg as a new (appended) child of key "sound_source".

Definition at line 227 of file soundsource.cpp.

References chance_, check_fogged_, check_shrouded_, faderange_, files_, id_, locations_, loops_, min_delay_, range_, and write_locations().

Member Data Documentation

◆ chance_

int soundsource::sourcespec::chance_
private

Definition at line 121 of file soundsource.hpp.

Referenced by chance(), set_chance(), and write().

◆ check_fogged_

bool soundsource::sourcespec::check_fogged_
private

Definition at line 126 of file soundsource.hpp.

Referenced by check_fogged(), set_check_fogged(), and write().

◆ check_shrouded_

bool soundsource::sourcespec::check_shrouded_
private

Definition at line 127 of file soundsource.hpp.

Referenced by check_shrouded(), set_check_shrouded(), and write().

◆ faderange_

int soundsource::sourcespec::faderange_
private

Definition at line 125 of file soundsource.hpp.

Referenced by fade_range(), set_fade_range(), and write().

◆ files_

std::string soundsource::sourcespec::files_
private

Definition at line 118 of file soundsource.hpp.

Referenced by files(), set_files(), and write().

◆ id_

const std::string soundsource::sourcespec::id_
private

Definition at line 117 of file soundsource.hpp.

Referenced by id(), and write().

◆ locations_

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

Definition at line 129 of file soundsource.hpp.

Referenced by get_locations(), set_locations(), sourcespec(), and write().

◆ loops_

int soundsource::sourcespec::loops_
private

Definition at line 123 of file soundsource.hpp.

Referenced by loops(), set_loops(), and write().

◆ min_delay_

std::chrono::milliseconds soundsource::sourcespec::min_delay_
private

Definition at line 120 of file soundsource.hpp.

Referenced by minimum_delay(), set_minimum_delay(), and write().

◆ range_

int soundsource::sourcespec::range_
private

Definition at line 124 of file soundsource.hpp.

Referenced by full_range(), set_full_range(), and write().


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