The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Macros | Functions | Variables
sound.cpp File Reference
#include "global.hpp"
#include "config.hpp"
#include "filesystem.hpp"
#include "game_preferences.hpp"
#include "log.hpp"
#include "serialization/string_utils.hpp"
#include "sound.hpp"
#include "sound_music_track.hpp"
#include "util.hpp"
#include <SDL_mixer.h>
#include <SDL.h>
#include <list>
#include <string>
#include <sstream>
Include dependency graph for sound.cpp:

Go to the source code of this file.

Classes

struct  sound::chunk_load_exception
 

Namespaces

 sound
 Audio output for sound and music.
 

Macros

#define DBG_AUDIO   LOG_STREAM(debug, log_audio)
 
#define LOG_AUDIO   LOG_STREAM(info, log_audio)
 
#define ERR_AUDIO   LOG_STREAM(err, log_audio)
 

Functions

static void sound::play_sound_internal (const std::string &files, channel_group group, unsigned int repeats=0, unsigned int distance=0, int id=-1, int loop_ticks=0, int fadein_ticks=0)
 
static void increment_chunk_usage (Mix_Chunk *mcp)
 
static void decrement_chunk_usage (Mix_Chunk *mcp)
 
static bool track_ok (const std::string &id)
 
static const sound::music_trackchoose_track ()
 
static std::string pick_one (const std::string &files)
 
static void sound::channel_finished_hook (int channel)
 
bool sound::init_sound ()
 
void sound::close_sound ()
 
void sound::reset_sound ()
 
void sound::stop_music ()
 
void sound::stop_sound ()
 
void sound::stop_bell ()
 
void sound::stop_UI_sound ()
 
void sound::play_music_once (const std::string &file)
 
void sound::empty_playlist ()
 
void sound::play_music ()
 
static void sound::play_new_music ()
 
void sound::play_music_repeatedly (const std::string &id)
 
void sound::play_music_config (const config &music_node)
 
void sound::commit_music_changes ()
 
void sound::write_music_play_list (config &snapshot)
 
void sound::reposition_sound (int id, unsigned int distance)
 
bool sound::is_sound_playing (int id)
 
void sound::stop_sound (int id)
 
void sound::play_sound_positioned (const std::string &files, int id, int repeats, unsigned int distance)
 
static Mix_Chunk * sound::load_chunk (const std::string &file, channel_group group)
 
void sound::play_sound (const std::string &files, channel_group group, unsigned int repeats)
 
void sound::play_bell (const std::string &files)
 
void sound::play_timer (const std::string &files, int loop_ticks, int fadein_ticks)
 
void sound::play_UI_sound (const std::string &files)
 
void sound::set_music_volume (int vol)
 
void sound::set_sound_volume (int vol)
 
void sound::set_bell_volume (int vol)
 
void sound::set_UI_volume (int vol)
 

Variables

static lg::log_domain log_audio ("audio")
 
static std::vector< Mix_Chunk * > sound::channel_chunks
 
static std::vector< intsound::channel_ids
 

Macro Definition Documentation

#define DBG_AUDIO   LOG_STREAM(debug, log_audio)

Definition at line 34 of file sound.cpp.

Referenced by sound::init_sound().

#define ERR_AUDIO   LOG_STREAM(err, log_audio)
#define LOG_AUDIO   LOG_STREAM(info, log_audio)

Function Documentation

static const sound::music_track& choose_track ( )
static

Definition at line 231 of file sound.cpp.

References gui2::tips::shuffle(), and track_ok().

Referenced by sound::commit_music_changes(), and sound::music_thinker::process().

static void decrement_chunk_usage ( Mix_Chunk *  mcp)
static

Definition at line 97 of file sound.cpp.

static void increment_chunk_usage ( Mix_Chunk *  mcp)
static

Definition at line 93 of file sound.cpp.

static std::string pick_one ( const std::string files)
static

Definition at line 256 of file sound.cpp.

References utils::square_parenthetical_split().

Referenced by sound::play_sound_internal().

static bool track_ok ( const std::string id)
static

Definition at line 174 of file sound.cpp.

References i, and LOG_AUDIO.

Referenced by choose_track().

Variable Documentation

lg::log_domain log_audio("audio")
static