Audio output for sound and music. More...
Classes | |
struct | chunk_load_exception |
class | music_thinker |
class | music_track |
Internal representation of music tracks. More... | |
Enumerations | |
enum | channel_group { NULL_CHANNEL = -1, SOUND_SOURCES = 0, SOUND_BELL, SOUND_TIMER, SOUND_UI, SOUND_FX } |
Variables | |
static std::vector< Mix_Chunk * > | channel_chunks |
static std::vector< int > | channel_ids |
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.
enum sound::channel_group |
Definition at line 308 of file sound.cpp.
References channel_chunks, and channel_ids.
Referenced by init_sound().
void sound::close_sound | ( | ) |
Definition at line 362 of file sound.cpp.
References ERR_AUDIO, LOG_AUDIO, stop_bell(), stop_music(), stop_sound(), and stop_UI_sound().
Referenced by reset_sound(), preferences::set_music(), preferences::set_sound(), preferences::set_turn_bell(), preferences::set_UI_sound(), and game_launcher::~game_launcher().
void sound::commit_music_changes | ( | ) |
Definition at line 621 of file sound.cpp.
References choose_track(), and play_music().
Referenced by do_gameloop(), enter_lobby_mode(), intf_set_music(), and playsingle_controller::play_scenario().
void sound::empty_playlist | ( | ) |
Definition at line 480 of file sound.cpp.
Referenced by do_gameloop(), enter_lobby_mode(), and campaign_controller::play_game().
bool sound::init_sound | ( | ) |
Definition at line 314 of file sound.cpp.
References preferences::bell_volume(), channel_chunks, channel_finished_hook(), channel_ids, DBG_AUDIO, ERR_AUDIO, LOG_AUDIO, preferences::music_volume(), play_music(), preferences::sample_rate(), set_bell_volume(), set_music_volume(), set_sound_volume(), set_UI_volume(), SOUND_BELL, preferences::sound_buffer_size(), SOUND_FX, SOUND_SOURCES, SOUND_TIMER, SOUND_UI, preferences::sound_volume(), and preferences::UI_volume().
Referenced by reset_sound(), preferences::set_music(), preferences::set_sound(), preferences::set_turn_bell(), and preferences::set_UI_sound().
bool sound::is_sound_playing | ( | int | id | ) |
Definition at line 678 of file sound.cpp.
References channel_ids, and gui2::event::find().
Referenced by soundsource::positional_source::update(), and soundsource::positional_source::update_positions().
|
static |
Definition at line 698 of file sound.cpp.
References channel_chunks, ERR_AUDIO, gui2::event::find(), filesystem::get_binary_file_location(), filesystem::load_RWops(), LOG_AUDIO, and NULL_CHANNEL.
Referenced by play_sound_internal().
void sound::play_bell | ( | const std::string & | files | ) |
Definition at line 826 of file sound.cpp.
References play_sound_internal(), SOUND_BELL, and preferences::turn_bell().
Referenced by playsingle_controller::before_human_turn(), and mp_ui_alerts::ready_for_start().
void sound::play_music | ( | ) |
Definition at line 485 of file sound.cpp.
Referenced by commit_music_changes(), init_sound(), play_music_config(), play_music_once(), play_music_repeatedly(), and preferences::set_music().
Definition at line 552 of file sound.cpp.
References sound::music_track::append(), ERR_AUDIO, sound::music_track::file_path(), sound::music_track::id(), sound::music_track::immediate(), itor, play_music(), sound::music_track::play_once(), and sound::music_track::valid().
Referenced by do_gameloop(), enter_lobby_mode(), intf_set_music(), and playsingle_controller::play_scenario().
void sound::play_music_once | ( | const std::string & | file | ) |
Definition at line 472 of file sound.cpp.
References play_music().
Referenced by editor::editor_controller::execute_command(), and playsingle_controller::play_scenario().
void sound::play_music_repeatedly | ( | const std::string & | id | ) |
Definition at line 536 of file sound.cpp.
References play_music().
Referenced by do_gameloop(), mp::lobby::lobby(), and storyscreen::part_ui::show().
|
static |
Definition at line 493 of file sound.cpp.
References ERR_AUDIO, itor, filesystem::load_RWops(), LOG_AUDIO, and preferences::music_on().
Referenced by sound::music_thinker::process().
void sound::play_sound | ( | const std::string & | files, |
channel_group | group, | ||
unsigned int | repeats | ||
) |
Definition at line 818 of file sound.cpp.
References play_sound_internal(), and preferences::sound_on().
Referenced by play_controller::init_side_end(), game_lua_kernel::intf_play_sound(), unit_frame::redraw(), storyscreen::part_ui::show(), and unit_display::unit_attack().
|
static |
Definition at line 753 of file sound.cpp.
References channel_chunks, channel_ids, DISTANCE_SILENT, ERR_AUDIO, load_chunk(), LOG_AUDIO, pick_one(), and SOUND_UI.
Referenced by play_bell(), play_sound(), play_sound_positioned(), play_timer(), and play_UI_sound().
void sound::play_sound_positioned | ( | const std::string & | files, |
int | id, | ||
int | repeats, | ||
unsigned int | distance | ||
) |
Definition at line 689 of file sound.cpp.
References play_sound_internal(), preferences::sound_on(), and SOUND_SOURCES.
Referenced by soundsource::positional_source::update().
void sound::play_timer | ( | const std::string & | files, |
int | loop_ticks, | ||
int | fadein_ticks | ||
) |
Definition at line 834 of file sound.cpp.
References play_sound_internal(), preferences::sound_on(), and SOUND_TIMER.
Referenced by countdown_clock::maybe_play_sound().
void sound::play_UI_sound | ( | const std::string & | files | ) |
Definition at line 842 of file sound.cpp.
References play_sound_internal(), SOUND_UI, and preferences::UI_sound_on().
Referenced by gui2::tslider::child_callback_positioner_moved(), help::help_menu::contract(), help::help_menu::expand(), mp_ui_alerts::friend_message(), mp_ui_alerts::game_has_begun(), gui::slider::handle_event(), gui::menu::handle_event(), gui::slider::mouse_down(), gui::button::mouse_down(), gui::slider::mouse_motion(), gui::button::mouse_up(), gui::tristate_button::mouse_up(), gui::slider::mouse_wheel(), mp_ui_alerts::player_joins(), mp_ui_alerts::player_leaves(), mp_ui_alerts::private_message(), gui::dialog::process(), mp_ui_alerts::public_message(), events::mouse_handler::select_hex(), mp_ui_alerts::server_message(), gui::menu::set_selection_pos(), gui2::tbutton::signal_handler_left_button_click(), gui2::ttoggle_button::signal_handler_left_button_click(), gui2::tcombobox::signal_handler_left_button_click(), gui2::ttoggle_panel::signal_handler_left_button_click(), and gui2::trepeating_button::signal_handler_left_button_down().
Definition at line 654 of file sound.cpp.
References channel_ids, and DISTANCE_SILENT.
Referenced by stop_sound(), soundsource::positional_source::update_positions(), and soundsource::positional_source::~positional_source().
void sound::reset_sound | ( | ) |
Definition at line 389 of file sound.cpp.
References close_sound(), ERR_AUDIO, init_sound(), preferences::music_on(), preferences::sound_on(), stop_bell(), stop_music(), stop_sound(), stop_UI_sound(), preferences::turn_bell(), and preferences::UI_sound_on().
Referenced by preferences::save_sample_rate(), and preferences::save_sound_buffer_size().
Definition at line 879 of file sound.cpp.
Referenced by init_sound(), and preferences::set_bell_volume().
Definition at line 849 of file sound.cpp.
Referenced by init_sound(), preferences::set_music_volume(), and game_events::WML_HANDLER_FUNCTION().
Definition at line 859 of file sound.cpp.
References i.
Referenced by init_sound(), preferences::set_sound_volume(), and game_events::WML_HANDLER_FUNCTION().
Definition at line 890 of file sound.cpp.
References i.
Referenced by init_sound(), and preferences::set_UI_volume().
void sound::stop_bell | ( | ) |
Definition at line 441 of file sound.cpp.
References itor, SOUND_BELL, and SOUND_TIMER.
Referenced by close_sound(), reset_sound(), preferences::set_turn_bell(), and countdown_clock::~countdown_clock().
void sound::stop_music | ( | ) |
Definition at line 411 of file sound.cpp.
References i.
Referenced by close_sound(), do_gameloop(), enter_lobby_mode(), reset_sound(), and preferences::set_music().
void sound::stop_sound | ( | ) |
Definition at line 422 of file sound.cpp.
References itor, SOUND_FX, and SOUND_SOURCES.
Referenced by close_sound(), reset_sound(), and preferences::set_sound().
Definition at line 684 of file sound.cpp.
References DISTANCE_SILENT, and reposition_sound().
void sound::stop_UI_sound | ( | ) |
Definition at line 457 of file sound.cpp.
References itor, and SOUND_UI.
Referenced by close_sound(), reset_sound(), and preferences::set_UI_sound().
Definition at line 644 of file sound.cpp.
Referenced by play_controller::to_config().
|
static |
Definition at line 45 of file sound.cpp.
Referenced by channel_finished_hook(), init_sound(), load_chunk(), and play_sound_internal().
|
static |
Definition at line 49 of file sound.cpp.
Referenced by channel_finished_hook(), init_sound(), is_sound_playing(), play_sound_internal(), and reposition_sound().