Freeciv-3.1
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "capability.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "rand.h"
#include "registry.h"
#include "shared.h"
#include "string_vector.h"
#include "support.h"
#include "audio_none.h"
#include "client_main.h"
#include "options.h"
#include "audio.h"
Go to the source code of this file.
Data Structures | |
struct | mfcb_data |
Macros | |
#define | MAX_NUM_PLUGINS 2 |
#define | SNDSPEC_SUFFIX ".soundspec" |
#define | MUSICSPEC_SUFFIX ".musicspec" |
#define | SOUNDSPEC_CAPSTR "+Freeciv-3.1-soundset" |
#define | MUSICSPEC_CAPSTR "+Freeciv-2.6-musicset" |
Functions | |
static int | audio_play_tag (struct section_file *sfile, const char *tag, bool repeat, int exclude, bool keep_old_style) |
static void | audio_shutdown_atexit (void) |
const struct strvec * | get_soundplugin_list (const struct option *poption) |
static const struct strvec * | get_audio_speclist (const char *suffix, struct strvec **audio_list) |
const struct strvec * | get_soundset_list (const struct option *poption) |
const struct strvec * | get_musicset_list (const struct option *poption) |
void | audio_add_plugin (struct audio_plugin *p) |
bool | audio_select_plugin (const char *const name) |
void | audio_init (void) |
static const char * | audiospec_fullname (const char *audioset_name, bool music) |
static bool | check_audiofile_capstr (struct section_file *sfile, const char *filename, const char *our_cap, const char *opt_path) |
void | audio_real_init (const char *const soundset_name, const char *const musicset_name, const char *const preferred_plugin_name) |
void | audio_restart (const char *soundset_name, const char *musicset_name) |
static void | music_finished_callback (void) |
static bool | audio_play_sound_tag (const char *tag, bool repeat) |
static int | audio_play_music_tag (const char *tag, bool repeat, bool keep_old_style) |
void | audio_play_sound (const char *const tag, const char *const alt_tag) |
static void | real_audio_play_music (const char *const tag, char *const alt_tag, bool keep_old_style) |
void | audio_play_music (const char *const tag, char *const alt_tag, enum music_usage usage) |
void | audio_play_track (const char *const tag, char *const alt_tag) |
void | audio_stop (void) |
void | audio_stop_usage (void) |
double | audio_get_volume (void) |
void | audio_set_volume (double volume) |
void | audio_shutdown (bool play_quit_tag) |
const char * | audio_get_all_plugin_names (void) |
Variables | |
static struct section_file * | ss_tagfile = NULL |
static struct section_file * | ms_tagfile = NULL |
static struct audio_plugin | plugins [MAX_NUM_PLUGINS] |
static int | num_plugins_used = 0 |
static int | selected_plugin = -1 |
static int | current_track = -1 |
static enum music_usage | current_usage |
static bool | switching_usage = FALSE |
static bool | let_single_track_play = FALSE |
static struct mfcb_data | mfcb |
void audio_add_plugin | ( | struct audio_plugin * | p | ) |
Add a plugin.
Definition at line 135 of file audio.c.
Referenced by audio_none_init(), and audio_sdl_init().
const char * audio_get_all_plugin_names | ( | void | ) |
Returns a string which list all available plugins. You don't have to free the string.
Definition at line 666 of file audio.c.
Referenced by audio_select_plugin(), and client_main().
double audio_get_volume | ( | void | ) |
void audio_init | ( | void | ) |
Initialize base audio system. Note that this function is called very early at the client startup. So for example logging isn't available.
Definition at line 187 of file audio.c.
Referenced by client_main().
void audio_play_music | ( | const char *const | tag, |
char *const | alt_tag, | ||
enum music_usage | usage | ||
) |
Loop music as suggested by sound tags
Definition at line 566 of file audio.c.
Referenced by start_menu_music(), and start_style_music().
Play tag from music set
Definition at line 512 of file audio.c.
Referenced by real_audio_play_music().
void audio_play_sound | ( | const char *const | tag, |
const char *const | alt_tag | ||
) |
Play an audio sample as suggested by sound tags
Definition at line 521 of file audio.c.
Referenced by audio_shutdown(), do_move_unit(), handle_city_info(), handle_unit_combat_info(), play_sound_for_event(), and qtg_real_output_window_append().
|
static |
INTERNAL. Returns id (>= 0) of the tag selected for playing, 0 when there's no alternative tags, or negative value in case of error.
Definition at line 419 of file audio.c.
Referenced by audio_play_music_tag(), audio_play_sound_tag(), and music_finished_callback().
void audio_play_track | ( | const char *const | tag, |
char *const | alt_tag | ||
) |
Play single track as suggested by sound tags
Definition at line 577 of file audio.c.
Referenced by play_single_track().
void audio_real_init | ( | const char *const | soundset_name, |
const char *const | musicset_name, | ||
const char *const | preferred_plugin_name | ||
) |
Initialize audio system and autoselect a plugin
Definition at line 273 of file audio.c.
Referenced by audio_restart(), and client_main().
void audio_restart | ( | const char * | soundset_name, |
const char * | musicset_name | ||
) |
Switch soundset
Definition at line 369 of file audio.c.
Referenced by handle_ruleset_control(), musicset_suggestion_callback(), musicset_suggestion_response(), musicspec_reread_callback(), popup_musicset_suggestion_dialog(), popup_soundset_suggestion_dialog(), soundset_suggestion_callback(), and soundset_suggestion_response().
bool audio_select_plugin | ( | const char *const | name | ) |
Choose plugin. Returns TRUE on success, FALSE if not
Definition at line 145 of file audio.c.
Referenced by audio_real_init().
void audio_set_volume | ( | double | volume | ) |
void audio_shutdown | ( | bool | play_quit_tag | ) |
Call this at end of program only.
play_quit_tag | Play exit sound |
Definition at line 629 of file audio.c.
Referenced by audio_shutdown_atexit(), and client_exit().
|
static |
void audio_stop | ( | void | ) |
Stop sound. Music should die down in a few seconds.
Definition at line 594 of file audio.c.
Referenced by audio_play_track(), audio_restart(), and audio_shutdown().
void audio_stop_usage | ( | void | ) |
Stop looping sound. Music should die down in a few seconds.
Definition at line 602 of file audio.c.
Referenced by stop_menu_music(), and stop_style_music().
|
static |
Returns the filename for the given audio set. Returns NULL if set couldn't be found. Caller has to free the return value.
Definition at line 203 of file audio.c.
Referenced by audio_real_init(), and audiospec_fullname().
|
static |
Check capabilities of the audio specfile
Definition at line 238 of file audio.c.
Referenced by audio_real_init().
|
static |
Returns a static string vector of audiosets of given type available on the system by searching all data directories for files matching suffix. The list is NULL-terminated.
Definition at line 102 of file audio.c.
Referenced by get_musicset_list(), and get_soundset_list().
Returns a static string vector of all sound plugins available on the system. This function is unfortunately similar to audio_get_all_plugin_names().
|
static |
|
static |
Play music, either in loop or just one track in the middle of the style music.
Definition at line 542 of file audio.c.
Referenced by audio_play_music(), and audio_play_track().
|
static |
Definition at line 57 of file audio.c.
Referenced by audio_play_track(), music_finished_callback(), and real_audio_play_music().
|
static |
Definition at line 58 of file audio.c.
Referenced by audio_play_music(), and music_finished_callback().
Definition at line 60 of file audio.c.
Referenced by audio_play_track(), and music_finished_callback().
|
static |
Referenced by audio_play_tag(), and music_finished_callback().
|
static |
Definition at line 52 of file audio.c.
Referenced by audio_play_music_tag(), audio_real_init(), and audio_shutdown().
|
static |
Definition at line 55 of file audio.c.
Referenced by audio_add_plugin(), audio_get_all_plugin_names(), audio_real_init(), audio_select_plugin(), and get_soundplugin_list().
|
static |
Definition at line 54 of file audio.c.
Referenced by audio_add_plugin(), audio_get_all_plugin_names(), audio_get_volume(), audio_play_tag(), audio_select_plugin(), audio_set_volume(), audio_shutdown(), audio_stop(), audio_stop_usage(), and get_soundplugin_list().
|
static |
Definition at line 56 of file audio.c.
Referenced by audio_get_volume(), audio_init(), audio_play_tag(), audio_select_plugin(), audio_set_volume(), audio_shutdown(), audio_stop(), and audio_stop_usage().
|
static |
Definition at line 51 of file audio.c.
Referenced by audio_play_sound_tag(), audio_real_init(), and audio_shutdown().
Definition at line 59 of file audio.c.
Referenced by audio_stop_usage(), and music_finished_callback().