The Battle for Wesnoth  1.19.15+dev
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
sound::music_track Class Reference

Internal representation of music tracks. More...

#include <sound_music_track.hpp>

Public Member Functions

 music_track (const std::string &file_path, const config &node)
 
 music_track (const std::string &file_path, const std::string &file)
 
void write (config &parent_node, bool append) const
 
bool append () const
 
bool immediate () const
 
bool shuffle () const
 
bool play_once () const
 
auto ms_before () const
 
auto ms_after () const
 
const std::string & file_path () const
 
const std::string & id () const
 
const std::string & title () const
 
void set_play_once (bool v)
 
void set_shuffle (bool v)
 
void set_ms_before (const std::chrono::milliseconds &v)
 
void set_ms_after (const std::chrono::milliseconds &v)
 
void set_title (const std::string &v)
 

Static Public Member Functions

static std::shared_ptr< music_trackcreate (const config &cfg)
 
static std::shared_ptr< music_trackcreate (const std::string &file)
 

Private Attributes

std::string id_
 
std::string file_path_
 
std::string title_
 
std::chrono::milliseconds ms_before_ {0}
 
std::chrono::milliseconds ms_after_ {0}
 
bool once_ = false
 
bool append_ = false
 
bool immediate_ = false
 
bool shuffle_ = true
 

Detailed Description

Internal representation of music tracks.

Definition at line 29 of file sound_music_track.hpp.

Constructor & Destructor Documentation

◆ music_track() [1/2]

sound::music_track::music_track ( const std::string &  file_path,
const config node 
)

Definition at line 90 of file sound_music_track.cpp.

References file_path_, and title_.

◆ music_track() [2/2]

sound::music_track::music_track ( const std::string &  file_path,
const std::string &  file 
)

Definition at line 106 of file sound_music_track.cpp.

Member Function Documentation

◆ append()

bool sound::music_track::append ( ) const
inline

Definition at line 40 of file sound_music_track.hpp.

References append_.

Referenced by sound::play_music_config(), and write().

◆ create() [1/2]

std::shared_ptr< music_track > sound::music_track::create ( const config cfg)
static

◆ create() [2/2]

std::shared_ptr< music_track > sound::music_track::create ( const std::string &  file)
static

Definition at line 80 of file sound_music_track.cpp.

References LOG_AUDIO, and game_config::path.

◆ file_path()

const std::string& sound::music_track::file_path ( ) const
inline

Definition at line 47 of file sound_music_track.hpp.

References file_path_.

Referenced by operator==(), and sound::play_music_config().

◆ id()

const std::string& sound::music_track::id ( ) const
inline

Definition at line 48 of file sound_music_track.hpp.

References id_.

◆ immediate()

bool sound::music_track::immediate ( ) const
inline

Definition at line 41 of file sound_music_track.hpp.

References immediate_.

Referenced by sound::play_music_config().

◆ ms_after()

auto sound::music_track::ms_after ( ) const
inline

Definition at line 45 of file sound_music_track.hpp.

References ms_after_.

◆ ms_before()

auto sound::music_track::ms_before ( ) const
inline

Definition at line 44 of file sound_music_track.hpp.

References ms_before_.

◆ play_once()

bool sound::music_track::play_once ( ) const
inline

Definition at line 43 of file sound_music_track.hpp.

References once_.

Referenced by sound::play_music_config().

◆ set_ms_after()

void sound::music_track::set_ms_after ( const std::chrono::milliseconds &  v)
inline

Definition at line 54 of file sound_music_track.hpp.

References ms_after_.

◆ set_ms_before()

void sound::music_track::set_ms_before ( const std::chrono::milliseconds &  v)
inline

Definition at line 53 of file sound_music_track.hpp.

References ms_before_.

◆ set_play_once()

void sound::music_track::set_play_once ( bool  v)
inline

Definition at line 51 of file sound_music_track.hpp.

References once_.

◆ set_shuffle()

void sound::music_track::set_shuffle ( bool  v)
inline

Definition at line 52 of file sound_music_track.hpp.

References shuffle_.

◆ set_title()

void sound::music_track::set_title ( const std::string &  v)
inline

Definition at line 55 of file sound_music_track.hpp.

References title_.

◆ shuffle()

bool sound::music_track::shuffle ( ) const
inline

Definition at line 42 of file sound_music_track.hpp.

References shuffle_.

◆ title()

const std::string& sound::music_track::title ( ) const
inline

Definition at line 49 of file sound_music_track.hpp.

References title_.

◆ write()

void sound::music_track::write ( config parent_node,
bool  append 
) const

Definition at line 113 of file sound_music_track.cpp.

References config::add_child(), append(), id_, ms_after_, ms_before_, and shuffle_.

Member Data Documentation

◆ append_

bool sound::music_track::append_ = false
private

Definition at line 66 of file sound_music_track.hpp.

Referenced by append().

◆ file_path_

std::string sound::music_track::file_path_
private

Definition at line 59 of file sound_music_track.hpp.

Referenced by file_path(), and music_track().

◆ id_

std::string sound::music_track::id_
private

Definition at line 58 of file sound_music_track.hpp.

Referenced by id(), and write().

◆ immediate_

bool sound::music_track::immediate_ = false
private

Definition at line 67 of file sound_music_track.hpp.

Referenced by immediate().

◆ ms_after_

std::chrono::milliseconds sound::music_track::ms_after_ {0}
private

Definition at line 63 of file sound_music_track.hpp.

Referenced by ms_after(), set_ms_after(), and write().

◆ ms_before_

std::chrono::milliseconds sound::music_track::ms_before_ {0}
private

Definition at line 62 of file sound_music_track.hpp.

Referenced by ms_before(), set_ms_before(), and write().

◆ once_

bool sound::music_track::once_ = false
private

Definition at line 65 of file sound_music_track.hpp.

Referenced by play_once(), and set_play_once().

◆ shuffle_

bool sound::music_track::shuffle_ = true
private

Definition at line 68 of file sound_music_track.hpp.

Referenced by set_shuffle(), shuffle(), and write().

◆ title_

std::string sound::music_track::title_
private

Definition at line 60 of file sound_music_track.hpp.

Referenced by music_track(), set_title(), and title().


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