#include "global.hpp"
#include "events.hpp"
#include "filesystem.hpp"
#include "game_config.hpp"
#include "game_preferences.hpp"
#include "log.hpp"
#include "random.hpp"
#include "sound.hpp"
#include "SDL.h"
#include "SDL_mixer.h"
#include <cassert>
#include <iostream>
#include <map>
#include <list>
Go to the source code of this file.
Namespaces | |
namespace | sound |
Classes | |
struct | sound::chunk_load_exception |
Defines | |
#define | LOG_AUDIO LOG_STREAM(info, audio) |
#define | ERR_AUDIO LOG_STREAM(err, audio) |
Typedefs | |
typedef std::list < sound_cache_chunk > ::iterator | sound_cache_iterator |
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) |
struct music_track | current_track ("") |
struct music_track | last_track ("") |
static bool | track_ok (const std::string &name) |
static const music_track & | choose_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::play_no_music () |
void | sound::play_music () |
static void | sound::play_new_music () |
void | sound::play_music_repeatedly (const std::string &name) |
void | sound::play_music_config (const config &music) |
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 | |
std::vector< Mix_Chunk * > | sound::channel_chunks |
std::vector< int > | sound::channel_ids |
bool | mix_ok = false |
int | music_start_time = 0 |
unsigned | music_refresh = 0 |
unsigned | music_refresh_rate = 20 |
bool | want_new_music = false |
int | fadingout_time = 5000 |
bool | no_fading = false |
const size_t | n_of_channels = 16 |
const size_t | bell_channel = 0 |
const size_t | timer_channel = 1 |
const size_t | source_channels = n_of_channels - 8 |
const size_t | source_channel_start = timer_channel + 1 |
const size_t | source_channel_last = source_channel_start + source_channels - 1 |
const size_t | UI_sound_channel = source_channel_last + 1 |
const size_t | n_reserved_channels = UI_sound_channel + 1 |
unsigned | max_cached_chunks = 256 |
std::map< Mix_Chunk *, int > | chunk_usage |
std::list< sound_cache_chunk > | sound_cache |
std::map< std::string, Mix_Music * > | music_cache |
std::vector< std::string > | played_before |
std::vector< music_track > | current_track_list |
#define ERR_AUDIO LOG_STREAM(err, audio) |
Definition at line 33 of file sound.cpp.
Referenced by sound::close_sound(), sound::init_sound(), sound::load_chunk(), sound::play_music_config(), sound::play_new_music(), sound::play_sound_internal(), and sound::reset_sound().
#define LOG_AUDIO LOG_STREAM(info, audio) |
Definition at line 32 of file sound.cpp.
Referenced by sound::close_sound(), sound::init_sound(), sound::load_chunk(), sound::play_new_music(), sound::play_sound_internal(), and track_ok().
typedef std::list< sound_cache_chunk >::iterator sound_cache_iterator [static] |
static const music_track& choose_track | ( | ) | [static] |
Definition at line 257 of file sound.cpp.
References current_track_list, name, and track_ok().
Referenced by sound::commit_music_changes(), and sound::music_thinker::process().
struct music_track @187::current_track | ( | "" | ) | [static, read] |
static void decrement_chunk_usage | ( | Mix_Chunk * | mcp | ) | [static] |
static void increment_chunk_usage | ( | Mix_Chunk * | mcp | ) | [static] |
struct music_track @187::last_track | ( | "" | ) | [static, read] |
Referenced by sound::play_new_music().
static std::string pick_one | ( | const std::string & | files | ) | [static] |
Definition at line 275 of file sound.cpp.
References utils::split().
Referenced by sound::play_sound_internal().
static bool track_ok | ( | const std::string & | name | ) | [static] |
Definition at line 199 of file sound.cpp.
References current_track(), current_track_list, lexical_cast(), and LOG_AUDIO.
Referenced by choose_track().
const size_t bell_channel = 0 [static] |
Definition at line 61 of file sound.cpp.
Referenced by sound::init_sound(), sound::set_bell_volume(), and sound::set_sound_volume().
std::map< Mix_Chunk*, int > chunk_usage [static] |
Definition at line 79 of file sound.cpp.
Referenced by decrement_chunk_usage(), and increment_chunk_usage().
std::vector<music_track> current_track_list [static] |
Definition at line 193 of file sound.cpp.
Referenced by choose_track(), sound::commit_music_changes(), sound::play_music_config(), sound::play_music_once(), sound::play_music_repeatedly(), sound::play_no_music(), sound::music_thinker::process(), track_ok(), and sound::write_music_play_list().
int fadingout_time = 5000 [static] |
Definition at line 54 of file sound.cpp.
Referenced by sound::play_music(), and sound::music_thinker::process().
std::string file |
Definition at line 114 of file sound.cpp.
Referenced by preprocessor_streambuf::lineno_string(), sound::play_sound_internal(), save_image(), and write_file().
unsigned max_cached_chunks = 256 [static] |
bool mix_ok = false [static] |
Definition at line 49 of file sound.cpp.
Referenced by sound::close_sound(), sound::init_sound(), sound::play_new_music(), sound::play_no_music(), sound::play_sound_internal(), sound::set_bell_volume(), sound::set_music_volume(), sound::set_sound_volume(), sound::set_UI_volume(), sound::stop_bell(), sound::stop_music(), sound::stop_sound(), and sound::stop_UI_sound().
std::map<std::string,Mix_Music*> music_cache [static] |
unsigned music_refresh = 0 [static] |
unsigned music_refresh_rate = 20 [static] |
int music_start_time = 0 [static] |
Definition at line 50 of file sound.cpp.
Referenced by sound::play_music(), sound::play_new_music(), and sound::music_thinker::process().
const size_t n_of_channels = 16 [static] |
Definition at line 58 of file sound.cpp.
Referenced by sound::init_sound(), and sound::set_sound_volume().
const size_t n_reserved_channels = UI_sound_channel + 1 [static] |
bool no_fading = false [static] |
Definition at line 55 of file sound.cpp.
Referenced by sound::play_music(), sound::play_new_music(), and sound::music_thinker::process().
std::vector<std::string> played_before [static] |
std::list< sound_cache_chunk > sound_cache [static] |
const size_t source_channel_last = source_channel_start + source_channels - 1 [static] |
const size_t source_channel_start = timer_channel + 1 [static] |
const size_t source_channels = n_of_channels - 8 [static] |
const size_t timer_channel = 1 [static] |
Definition at line 62 of file sound.cpp.
Referenced by sound::init_sound(), sound::set_bell_volume(), and sound::set_sound_volume().
const size_t UI_sound_channel = source_channel_last + 1 [static] |
Definition at line 68 of file sound.cpp.
Referenced by sound::init_sound(), sound::set_sound_volume(), and sound::set_UI_volume().
bool want_new_music = false [static] |
Definition at line 53 of file sound.cpp.
Referenced by sound::play_music(), sound::play_new_music(), and sound::music_thinker::process().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |