Audio output for sound and music. More...
Classes | |
| struct | driver_status |
| class | music_thinker |
| class | music_muter |
| class | music_track |
| Internal representation of music tracks. More... | |
Functions | |
| utils::optional< unsigned int > | get_current_track_index () |
| std::shared_ptr< music_track > | get_current_track () |
| std::shared_ptr< music_track > | get_previous_music_track () |
| void | set_previous_track (std::shared_ptr< music_track > track) |
| unsigned int | get_num_tracks () |
| std::shared_ptr< music_track > | get_track (unsigned int i) |
| void | set_track (unsigned int i, const std::shared_ptr< music_track > &to) |
| void | remove_track (unsigned int i) |
| std::string | current_driver () |
| std::vector< std::string > | enumerate_drivers () |
| bool | init_sound () |
| void | close_sound () |
| void | reset_sound () |
| void | stop_music () |
| void | stop_sound () |
| void | stop_bell () |
| void | stop_UI_sound () |
| void | play_music_once (const std::string &file) |
| void | empty_playlist () |
| void | play_music () |
| void | play_track (unsigned int i) |
| void | play_music_config (const config &music_node, bool allow_interrupt_current_track, int i) |
| void | commit_music_changes () |
| void | write_music_play_list (config &snapshot) |
| void | reposition_sound (unsigned id, unsigned int distance) |
| bool | is_sound_playing (int id) |
| void | stop_sound (unsigned id) |
| void | play_sound (const std::string &files, sound_tracks::type group, unsigned int repeats) |
| void | play_sound_positioned (const std::string &files, int repeats, unsigned int distance, unsigned int id) |
| void | play_bell (const std::string &files) |
| void | play_timer (const std::string &files, const std::chrono::milliseconds &loop_ticks, const std::chrono::milliseconds &fadein_ticks) |
| void | play_UI_sound (const std::string &files) |
| int | get_music_volume () |
| void | set_music_volume (int vol) |
| int | get_sound_volume () |
| void | set_sound_volume (int vol) |
| void | set_bell_volume (int vol) |
| void | set_UI_volume (int vol) |
| void | flush_cache () |
Audio output for sound and music.
This module provides the ability to play music and sounds. Setting music volume to 0 will stop the music.
| void sound::close_sound | ( | ) |
Definition at line 413 of file sound.cpp.
References i, LOG_AUDIO, stop_bell(), stop_music(), stop_sound(), and stop_UI_sound().
Referenced by reset_sound(), prefs::set_music(), prefs::set_sound(), prefs::set_turn_bell(), prefs::set_ui_sound(), and game_launcher::~game_launcher().
| void sound::commit_music_changes | ( | ) |
Definition at line 726 of file sound.cpp.
References play_music(), and set_previous_track().
Referenced by game_events::event_handler::handle_event(), intf_music_commit(), playsingle_controller::play_scenario(), and actions::undo_event::undo().
| void sound::empty_playlist | ( | ) |
Definition at line 518 of file sound.cpp.
Referenced by playsingle_controller::do_end_level(), do_gameloop(), intf_music_clear(), and campaign_controller::play_game().
| std::vector< std::string > sound::enumerate_drivers | ( | ) |
| void sound::flush_cache | ( | ) |
Definition at line 1044 of file sound.cpp.
Referenced by game_launcher::change_language(), events::console_handler::do_refresh(), and game_config_manager::reload_changed_game_config().
| std::shared_ptr< sound::music_track > sound::get_current_track | ( | ) |
Definition at line 130 of file sound.cpp.
Referenced by impl_music_get().
| utils::optional< unsigned int > sound::get_current_track_index | ( | ) |
Definition at line 123 of file sound.cpp.
Referenced by impl_music_get().
| int sound::get_music_volume | ( | ) |
Definition at line 968 of file sound.cpp.
Referenced by impl_music_get().
| unsigned int sound::get_num_tracks | ( | ) |
Definition at line 143 of file sound.cpp.
Referenced by impl_music_len(), impl_music_set(), and intf_music_next().
| std::shared_ptr< sound::music_track > sound::get_previous_music_track | ( | ) |
Definition at line 134 of file sound.cpp.
Referenced by impl_music_get().
| int sound::get_sound_volume | ( | ) |
Definition at line 988 of file sound.cpp.
Referenced by impl_audio_get().
| std::shared_ptr< music_track > sound::get_track | ( | unsigned int | i | ) |
| bool sound::init_sound | ( | ) |
Definition at line 346 of file sound.cpp.
References ERR_AUDIO, prefs::get(), LOG_AUDIO, play_music(), prefs::sample_rate(), set_bell_volume(), set_music_volume(), set_sound_volume(), set_UI_volume(), and t.
Referenced by game_launcher::game_launcher(), reset_sound(), prefs::set_music(), prefs::set_sound(), prefs::set_turn_bell(), and prefs::set_ui_sound().
| bool sound::is_sound_playing | ( | int | id | ) |
Definition at line 780 of file sound.cpp.
Referenced by soundsource::positional_source::update(), and soundsource::positional_source::update_positions().
| void sound::play_bell | ( | const std::string & | files | ) |
Definition at line 945 of file sound.cpp.
References prefs::get(), and game_config::sounds::turn_bell.
Referenced by playsingle_controller::before_human_turn(), and mp::ui_alerts::ready_for_start().
| void sound::play_music | ( | ) |
Definition at line 523 of file sound.cpp.
Referenced by commit_music_changes(), init_sound(), play_music_config(), play_music_once(), play_track(), and prefs::set_music().
| void sound::play_music_config | ( | const config & | music_node, |
| bool | allow_interrupt_current_track, | ||
| int | i | ||
| ) |
Definition at line 610 of file sound.cpp.
References sound::music_track::create(), ERR_AUDIO, i, play_music(), and set_previous_track().
Referenced by gui2::dialogs::story_viewer::display_part(), do_gameloop(), impl_music_set(), intf_music_add(), and playsingle_controller::play_scenario().
| void sound::play_music_once | ( | const std::string & | file | ) |
Definition at line 507 of file sound.cpp.
References sound::music_track::create(), play_music(), and set_previous_track().
Referenced by playsingle_controller::do_end_level(), editor::editor_controller::do_execute_command(), and intf_music_play().
| void sound::play_sound | ( | const std::string & | files, |
| sound_tracks::type | group, | ||
| unsigned int | repeats | ||
| ) |
Definition at line 930 of file sound.cpp.
References prefs::get().
Referenced by gui2::dialogs::story_viewer::display_part(), play_controller::init_side_end(), game_lua_kernel::intf_play_sound(), game_lua_kernel::intf_set_achievement(), gui2::dialogs::custom_tod::play_sound(), unit_frame::redraw(), and unit_display::unit_attack().
| void sound::play_sound_positioned | ( | const std::string & | files, |
| int | repeats, | ||
| unsigned int | distance, | ||
| unsigned int | id | ||
| ) |
Definition at line 937 of file sound.cpp.
References prefs::get().
Referenced by soundsource::positional_source::update().
| void sound::play_timer | ( | const std::string & | files, |
| const std::chrono::milliseconds & | loop_ticks, | ||
| const std::chrono::milliseconds & | fadein_ticks | ||
| ) |
Definition at line 953 of file sound.cpp.
References DISTANCE_NONE, and prefs::get().
Referenced by countdown_clock::maybe_play_sound().
| void sound::play_track | ( | unsigned int | i | ) |
Definition at line 535 of file sound.cpp.
References i, play_music(), and set_previous_track().
Referenced by impl_music_set(), and intf_music_next().
| void sound::play_UI_sound | ( | const std::string & | files | ) |
Definition at line 961 of file sound.cpp.
References prefs::get().
Referenced by gui2::slider::child_callback_positioner_moved(), mp::ui_alerts::friend_message(), mp::ui_alerts::game_created(), mp::ui_alerts::game_has_begun(), gui::button::mouse_down(), gui::tristate_button::mouse_up(), gui::button::mouse_up(), mp::ui_alerts::player_joins(), mp::ui_alerts::player_leaves(), mp::ui_alerts::private_message(), mp::ui_alerts::public_message(), events::mouse_handler::select_hex(), mp::ui_alerts::server_message(), gui2::rich_label::signal_handler_left_button_click(), gui2::button::signal_handler_left_button_click(), gui2::menu_button::signal_handler_left_button_click(), gui2::multimenu_button::signal_handler_left_button_click(), gui2::toggle_button::signal_handler_left_button_click(), gui2::toggle_panel::signal_handler_left_button_click(), and gui2::repeating_button::signal_handler_left_button_down().
| void sound::remove_track | ( | unsigned int | i | ) |
Definition at line 168 of file sound.cpp.
References i.
Referenced by impl_music_set(), and intf_music_remove().
| void sound::reposition_sound | ( | unsigned | id, |
| unsigned int | distance | ||
| ) |
Definition at line 765 of file sound.cpp.
References DISTANCE_SILENT.
Referenced by stop_sound(), and soundsource::positional_source::update_positions().
| void sound::reset_sound | ( | ) |
Definition at line 443 of file sound.cpp.
References close_sound(), prefs::get(), init_sound(), prefs::music_on(), prefs::sound(), stop_bell(), stop_music(), stop_sound(), stop_UI_sound(), prefs::turn_bell(), and prefs::ui_sound_on().
Referenced by prefs::save_sample_rate(), and prefs::save_sound_buffer_size().
| void sound::set_bell_volume | ( | int | vol | ) |
Definition at line 1019 of file sound.cpp.
Referenced by init_sound(), and prefs::set_bell_volume().
| void sound::set_music_volume | ( | int | vol | ) |
Definition at line 977 of file sound.cpp.
Referenced by impl_music_set(), init_sound(), and prefs::set_music_volume().
| void sound::set_previous_track | ( | std::shared_ptr< music_track > | track | ) |
Definition at line 138 of file sound.cpp.
Referenced by commit_music_changes(), play_music_config(), play_music_once(), play_track(), and sound::music_thinker::process().
| void sound::set_sound_volume | ( | int | vol | ) |
Definition at line 998 of file sound.cpp.
References t.
Referenced by impl_audio_set(), init_sound(), and prefs::set_sound_volume().
| void sound::set_track | ( | unsigned int | i, |
| const std::shared_ptr< music_track > & | to | ||
| ) |
| void sound::set_UI_volume | ( | int | vol | ) |
Definition at line 1031 of file sound.cpp.
References t.
Referenced by init_sound(), and prefs::set_ui_volume().
| void sound::stop_bell | ( | ) |
Definition at line 492 of file sound.cpp.
Referenced by close_sound(), reset_sound(), prefs::set_turn_bell(), and countdown_clock::~countdown_clock().
| void sound::stop_music | ( | ) |
Definition at line 472 of file sound.cpp.
References t.
Referenced by close_sound(), do_gameloop(), reset_sound(), and prefs::set_music().
| void sound::stop_sound | ( | ) |
Definition at line 481 of file sound.cpp.
Referenced by close_sound(), gui2::dialogs::story_viewer::display_part(), reset_sound(), prefs::set_sound(), and soundsource::positional_source::~positional_source().
| void sound::stop_sound | ( | unsigned | id | ) |
Definition at line 785 of file sound.cpp.
References DISTANCE_SILENT, and reposition_sound().
| void sound::stop_UI_sound | ( | ) |
Definition at line 500 of file sound.cpp.
Referenced by close_sound(), reset_sound(), and prefs::set_ui_sound().
| void sound::write_music_play_list | ( | config & | snapshot | ) |
Definition at line 755 of file sound.cpp.
Referenced by impl_music_get(), and play_controller::to_config().