![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <fc_config.h>#include <QString>#include <QVector>#include <cstdlib>#include "capability.h"#include "fcintl.h"#include "log.h"#include "rand.h"#include "registry.h"#include "registry_ini.h"#include "shared.h"#include "audio_none.h"#include "client_main.h"#include "options.h"#include "audio.h"
Include dependency graph for audio.cpp:Go to the source code of this file.
Classes | |
| struct | mfcb_data |
Macros | |
| #define | MAX_NUM_PLUGINS 2 |
| #define | SNDSPEC_SUFFIX ".soundspec" |
| #define | MUSICSPEC_SUFFIX ".musicspec" |
| #define | SOUNDSPEC_CAPSTR "+Freeciv-3.0-soundset" |
| #define | MUSICSPEC_CAPSTR "+Freeciv-2.6-musicset" |
Functions | |
| static int | audio_play_tag (struct section_file *sfile, const QString &tag, bool repeat, int exclude, bool keepstyle) |
| INTERNAL. More... | |
| const QVector< QString > * | get_soundplugin_list (const struct option *poption) |
| Returns a static string vector of all sound plugins available on the system. More... | |
| const QVector< QString > * | get_soundset_list (const struct option *poption) |
| Returns a static string vector of soundsets available on the system. More... | |
| const QVector< QString > * | get_musicset_list (const struct option *poption) |
| Returns a static string vector of musicsets available on the system. More... | |
| void | audio_add_plugin (struct audio_plugin *p) |
| Add a plugin. More... | |
| bool | audio_select_plugin (const QString &name) |
| Choose plugin. More... | |
| void | audio_init () |
| Initialize base audio system. More... | |
| static const QString | audiospec_fullname (const QString &audioset_name, bool music) |
| Returns the filename for the given audio set. More... | |
| static bool | check_audiofile_capstr (struct section_file *sfile, const QString *filename, const QString *our_cap, const QString *opt_path) |
| Check capabilities of the audio specfile. More... | |
| void | audio_real_init (const QString &soundset_name, const QString &musicset_name, const QString &preferred_plugin_name) |
| Initialize audio system and autoselect a plugin. More... | |
| void | audio_restart (const QString &soundset_name, const QString &musicset_name) |
| Switch soundset. More... | |
| static void | music_finished_callback () |
| Callback to start new track. More... | |
| static bool | audio_play_sound_tag (const QString &tag, bool repeat) |
| Play tag from sound set. More... | |
| static int | audio_play_music_tag (const QString &tag, bool repeat, bool keepstyle) |
| Play tag from music set. More... | |
| void | audio_play_sound (const QString &tag, const QString &alt_tag) |
| Play an audio sample as suggested by sound tags. More... | |
| static void | real_audio_play_music (const QString &tag, const QString &alt_tag, bool keepstyle) |
| Play music, either in loop or just one track in the middle of the style music. More... | |
| void | audio_play_music (const QString &tag, const QString &alt_tag, enum music_usage usage) |
| Loop music as suggested by sound tags. More... | |
| void | audio_play_track (const QString &tag, const QString &alt_tag) |
| Play single track as suggested by sound tags. More... | |
| void | audio_stop () |
| Stop sound. More... | |
| void | audio_stop_usage () |
| Stop looping sound. More... | |
| double | audio_get_volume () |
| Get sound volume currently in use. More... | |
| void | audio_set_volume (double volume) |
| Set sound volume to use. More... | |
| void | audio_shutdown () |
| Call this at end of program only. More... | |
| const QString | audio_get_all_plugin_names () |
| Returns a string which list all available plugins. More... | |
Variables | |
| static struct section_file * | ss_tagfile = nullptr |
| static struct section_file * | ms_tagfile = nullptr |
| 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 108 of file audio.cpp.
Referenced by audio_none_init(), and audio_sdl_init().
| const QString audio_get_all_plugin_names | ( | ) |
Returns a string which list all available plugins.
You don't have to free the string.
Definition at line 630 of file audio.cpp.
Referenced by audio_select_plugin().
| double audio_get_volume | ( | ) |
Get sound volume currently in use.
Definition at line 586 of file audio.cpp.
Referenced by audio_none_init().
| void audio_init | ( | ) |
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 173 of file audio.cpp.
Referenced by client_main().
| void audio_play_music | ( | const QString & | tag, |
| const QString & | alt_tag, | ||
| enum music_usage | usage | ||
| ) |
Loop music as suggested by sound tags.
Definition at line 544 of file audio.cpp.
Referenced by start_menu_music(), and start_style_music().
|
static |
Play tag from music set.
Definition at line 485 of file audio.cpp.
Referenced by real_audio_play_music().
| void audio_play_sound | ( | const QString & | tag, |
| const QString & | alt_tag | ||
| ) |
Play an audio sample as suggested by sound tags.
Definition at line 494 of file audio.cpp.
Referenced by audio_shutdown(), do_move_unit(), handle_city_info(), handle_unit_bombard_info(), handle_unit_combat_info(), and play_sound_for_event().
|
static |
Play tag from sound set.
Definition at line 477 of file audio.cpp.
Referenced by audio_play_sound().
|
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 391 of file audio.cpp.
Referenced by audio_play_music_tag(), audio_play_sound_tag(), and music_finished_callback().
| void audio_play_track | ( | const QString & | tag, |
| const QString & | alt_tag | ||
| ) |
Play single track as suggested by sound tags.
Definition at line 555 of file audio.cpp.
Referenced by play_single_track().
| void audio_real_init | ( | const QString & | soundset_name, |
| const QString & | musicset_name, | ||
| const QString & | preferred_plugin_name | ||
| ) |
Initialize audio system and autoselect a plugin.
Definition at line 253 of file audio.cpp.
Referenced by audio_restart(), and client_main().
| void audio_restart | ( | const QString & | soundset_name, |
| const QString & | musicset_name | ||
| ) |
Switch soundset.
Definition at line 343 of file audio.cpp.
Referenced by handle_ruleset_control(), musicspec_reread_callback(), popup_musicset_suggestion_dialog(), and popup_soundset_suggestion_dialog().
| bool audio_select_plugin | ( | const QString & | name | ) |
Choose plugin.
Returns TRUE on success, FALSE if not
Definition at line 126 of file audio.cpp.
Referenced by audio_real_init().
| void audio_set_volume | ( | double | volume | ) |
Set sound volume to use.
Definition at line 591 of file audio.cpp.
Referenced by audio_none_init(), and sound_volume_callback().
| void audio_shutdown | ( | ) |
Call this at end of program only.
Definition at line 599 of file audio.cpp.
Referenced by audio_real_init(), and client_exit().
| void audio_stop | ( | ) |
Stop sound.
Music should die down in a few seconds.
Definition at line 572 of file audio.cpp.
Referenced by audio_play_track(), audio_restart(), and audio_shutdown().
| void audio_stop_usage | ( | ) |
Stop looping sound.
Music should die down in a few seconds.
Definition at line 577 of file audio.cpp.
Referenced by stop_menu_music(), and stop_style_music().
|
static |
Returns the filename for the given audio set.
Returns nullptr if set couldn't be found. Caller has to free the return value.
Definition at line 189 of file audio.cpp.
Referenced by audio_real_init().
|
static |
Check capabilities of the audio specfile.
Definition at line 218 of file audio.cpp.
Referenced by audio_real_init().
Returns a static string vector of musicsets available on the system.
Definition at line 96 of file audio.cpp.
Referenced by init_client_options().
Returns a static string vector of all sound plugins available on the system.
This function is unfortunately similar to audio_get_all_plugin_names().
Definition at line 70 of file audio.cpp.
Referenced by init_client_options().
Returns a static string vector of soundsets available on the system.
Definition at line 84 of file audio.cpp.
Referenced by init_client_options().
|
static |
Callback to start new track.
Definition at line 356 of file audio.cpp.
Referenced by audio_play_tag().
|
static |
Play music, either in loop or just one track in the middle of the style music.
Definition at line 518 of file audio.cpp.
Referenced by audio_play_music(), and audio_play_track().
|
static |
Definition at line 50 of file audio.cpp.
Referenced by audio_play_track(), music_finished_callback(), and real_audio_play_music().
|
static |
Definition at line 50 of file audio.cpp.
Referenced by audio_play_music(), and music_finished_callback().
|
static |
Definition at line 53 of file audio.cpp.
Referenced by audio_play_track(), and music_finished_callback().
|
static |
Referenced by audio_play_tag(), and music_finished_callback().
|
static |
Definition at line 45 of file audio.cpp.
Referenced by audio_play_music_tag(), audio_real_init(), and audio_shutdown().
|
static |
Definition at line 48 of file audio.cpp.
Referenced by audio_add_plugin(), audio_get_all_plugin_names(), audio_real_init(), audio_select_plugin(), and get_soundplugin_list().
|
static |
Definition at line 45 of file audio.cpp.
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 49 of file audio.cpp.
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 44 of file audio.cpp.
Referenced by audio_play_sound_tag(), audio_real_init(), and audio_shutdown().
|
static |
Definition at line 52 of file audio.cpp.
Referenced by audio_stop_usage(), and music_finished_callback().