Freeciv-3.2: /fast/freeciv/nightly/S3_2/client/audio.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
audio.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__AUDIO_H
14#define FC__AUDIO_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "support.h" /* bool type */
22
23#define MAX_AUDIO_NAME_LEN 20
24#define MAX_AUDIO_DESCR_LEN 200
25
26#define MAX_ALT_AUDIO_FILES 25
27
28 typedef void (*audio_finished_callback)(void);
29
30 struct audio_plugin {
31 char name[MAX_AUDIO_NAME_LEN];
32 char descr[MAX_AUDIO_DESCR_LEN];
33 bool initialized;
34 bool (*init) (struct audio_plugin *self);
35 void (*shutdown) (struct audio_plugin *self);
36 void (*stop) (void);
37 void (*wait) (void);
38 double (*get_volume) (void);
39 void (*set_volume) (double volume);
40 bool (*play) (const char *const tag, const char *const path, bool repeat,
41 audio_finished_callback cb);
42 void (*pause)(void);
43 void (*resume)(void);
44};
45
46 enum music_usage { MU_MENU, MU_INGAME };
47
48struct strvec;
49struct option;
50const struct strvec *get_soundplugin_list(const struct option *poption);
51const struct strvec *get_soundset_list(const struct option *poption);
52const struct strvec *get_musicset_list(const struct option *poption);
53
54void audio_init(void);
55void audio_real_init(const char *const soundspec_name,
56 const char *const musicset_name,
57 const char *const preferred_plugin_name);
58void audio_add_plugin(struct audio_plugin *p);
59void audio_shutdown(bool play_quit_tag);
60void audio_stop(void);
61void audio_stop_usage(void);
62void audio_restart(const char *soundset_name, const char *musicset_name);
63
64void audio_pause(void);
65void audio_resume(void);
66
67void audio_play_sound(const char *const tag, const char *const alt_tag,
68 const char *const alt_tag2);
69void audio_play_music(const char *const tag, char *const alt_tag,
70 enum music_usage usage);
71void audio_play_track(const char *const tag, char *const alt_tag);
72
73double audio_get_volume(void);
74void audio_set_volume(double volume);
75
76bool audio_select_plugin(const char *const name);
77const char *audio_get_all_plugin_names(void);
78
79#ifdef __cplusplus
80}
81#endif /* __cplusplus */
82
83#endif /* FC__AUDIO_H */
audio_restart
void audio_restart(const char *soundset_name, const char *musicset_name)
Definition audio.c:376
audio_pause
void audio_pause(void)
Definition audio.c:606
audio_play_track
void audio_play_track(const char *const tag, char *const alt_tag)
Definition audio.c:589
audio_resume
void audio_resume(void)
Definition audio.c:614
audio_play_music
void audio_play_music(const char *const tag, char *const alt_tag, enum music_usage usage)
Definition audio.c:578
audio_shutdown
void audio_shutdown(bool play_quit_tag)
Definition audio.c:657
audio_get_all_plugin_names
const char * audio_get_all_plugin_names(void)
Definition audio.c:694
audio_stop
void audio_stop(void)
Definition audio.c:622
audio_stop_usage
void audio_stop_usage(void)
Definition audio.c:630
audio_init
void audio_init(void)
Definition audio.c:188
music_usage
music_usage
Definition audio.h:46
MU_INGAME
@ MU_INGAME
Definition audio.h:46
MU_MENU
@ MU_MENU
Definition audio.h:46
audio_select_plugin
bool audio_select_plugin(const char *const name)
Definition audio.c:146
audio_real_init
void audio_real_init(const char *const soundspec_name, const char *const musicset_name, const char *const preferred_plugin_name)
Definition audio.c:274
audio_set_volume
void audio_set_volume(double volume)
Definition audio.c:647
get_musicset_list
const struct strvec * get_musicset_list(const struct option *poption)
Definition audio.c:126
MAX_AUDIO_NAME_LEN
#define MAX_AUDIO_NAME_LEN
Definition audio.h:23
audio_play_sound
void audio_play_sound(const char *const tag, const char *const alt_tag, const char *const alt_tag2)
Definition audio.c:528
audio_get_volume
double audio_get_volume(void)
Definition audio.c:639
audio_finished_callback
void(* audio_finished_callback)(void)
Definition audio.h:28
audio_add_plugin
void audio_add_plugin(struct audio_plugin *p)
Definition audio.c:136
get_soundset_list
const struct strvec * get_soundset_list(const struct option *poption)
Definition audio.c:116
MAX_AUDIO_DESCR_LEN
#define MAX_AUDIO_DESCR_LEN
Definition audio.h:24
get_soundplugin_list
const struct strvec * get_soundplugin_list(const struct option *poption)
Definition audio.c:80
self
static struct ai_type * self
Definition classicai.c:45
incite_cost
char * incite_cost
Definition comments.c:74
name
const char * name
Definition inputfile.c:127
audio_plugin
Definition audio.h:30
audio_plugin::descr
char descr[MAX_AUDIO_DESCR_LEN]
Definition audio.h:32
audio_plugin::resume
void(* resume)(void)
Definition audio.h:43
audio_plugin::init
bool(* init)(struct audio_plugin *self)
Definition audio.h:34
audio_plugin::stop
void(* stop)(void)
Definition audio.h:36
audio_plugin::wait
void(* wait)(void)
Definition audio.h:37
audio_plugin::initialized
bool initialized
Definition audio.h:33
audio_plugin::set_volume
void(* set_volume)(double volume)
Definition audio.h:39
audio_plugin::get_volume
double(* get_volume)(void)
Definition audio.h:38
audio_plugin::shutdown
void(* shutdown)(struct audio_plugin *self)
Definition audio.h:35
audio_plugin::play
bool(* play)(const char *const tag, const char *const path, bool repeat, audio_finished_callback cb)
Definition audio.h:40
audio_plugin::pause
void(* pause)(void)
Definition audio.h:42
audio_plugin::name
char name[MAX_AUDIO_NAME_LEN]
Definition audio.h:31
option
Definition options.c:478
strvec
Definition string_vector.c:29
support.h
bool
#define bool
Definition support.h:71