Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/audio.h Source File

Freeciv-3.1

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#include "support.h" /* bool type */
21
22#define MAX_AUDIO_NAME_LEN 20
23#define MAX_AUDIO_DESCR_LEN 200
24
25#define MAX_ALT_AUDIO_FILES 25
26
27 typedef void (*audio_finished_callback)(void);
28
29 struct audio_plugin {
30 char name[MAX_AUDIO_NAME_LEN];
31 char descr[MAX_AUDIO_DESCR_LEN];
32 bool initialized;
33 bool (*init) (struct audio_plugin *self);
34 void (*shutdown) (struct audio_plugin *self);
35 void (*stop) (void);
36 void (*wait) (void);
37 double (*get_volume) (void);
38 void (*set_volume) (double volume);
39 bool (*play) (const char *const tag, const char *const path, bool repeat,
40 audio_finished_callback cb);
41};
42
43 enum music_usage { MU_MENU, MU_INGAME };
44
45struct strvec;
46struct option;
47const struct strvec *get_soundplugin_list(const struct option *poption);
48const struct strvec *get_soundset_list(const struct option *poption);
49const struct strvec *get_musicset_list(const struct option *poption);
50
51void audio_init(void);
52void audio_real_init(const char *const soundspec_name,
53 const char *const musicset_name,
54 const char *const preferred_plugin_name);
55void audio_add_plugin(struct audio_plugin *p);
56void audio_shutdown(bool play_quit_tag);
57void audio_stop(void);
58void audio_stop_usage(void);
59void audio_restart(const char *soundset_name, const char *musicset_name);
60
61void audio_play_sound(const char *const tag, const char *const alt_tag);
62void audio_play_music(const char *const tag, char *const alt_tag,
63 enum music_usage usage);
64void audio_play_track(const char *const tag, char *const alt_tag);
65
66double audio_get_volume(void);
67void audio_set_volume(double volume);
68
69bool audio_select_plugin(const char *const name);
70const char *audio_get_all_plugin_names(void);
71
72#ifdef __cplusplus
73}
74#endif /* __cplusplus */
75
76#endif /* FC__AUDIO_H */
audio_restart
void audio_restart(const char *soundset_name, const char *musicset_name)
Definition audio.c:369
audio_play_track
void audio_play_track(const char *const tag, char *const alt_tag)
Definition audio.c:577
audio_play_music
void audio_play_music(const char *const tag, char *const alt_tag, enum music_usage usage)
Definition audio.c:566
audio_shutdown
void audio_shutdown(bool play_quit_tag)
Definition audio.c:629
audio_get_all_plugin_names
const char * audio_get_all_plugin_names(void)
Definition audio.c:666
audio_stop
void audio_stop(void)
Definition audio.c:594
audio_stop_usage
void audio_stop_usage(void)
Definition audio.c:602
audio_init
void audio_init(void)
Definition audio.c:187
audio_play_sound
void audio_play_sound(const char *const tag, const char *const alt_tag)
Definition audio.c:521
music_usage
music_usage
Definition audio.h:43
MU_INGAME
@ MU_INGAME
Definition audio.h:43
MU_MENU
@ MU_MENU
Definition audio.h:43
audio_select_plugin
bool audio_select_plugin(const char *const name)
Definition audio.c:145
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:273
audio_set_volume
void audio_set_volume(double volume)
Definition audio.c:619
get_musicset_list
const struct strvec * get_musicset_list(const struct option *poption)
Definition audio.c:125
MAX_AUDIO_NAME_LEN
#define MAX_AUDIO_NAME_LEN
Definition audio.h:22
audio_get_volume
double audio_get_volume(void)
Definition audio.c:611
audio_finished_callback
void(* audio_finished_callback)(void)
Definition audio.h:27
audio_add_plugin
void audio_add_plugin(struct audio_plugin *p)
Definition audio.c:135
get_soundset_list
const struct strvec * get_soundset_list(const struct option *poption)
Definition audio.c:115
MAX_AUDIO_DESCR_LEN
#define MAX_AUDIO_DESCR_LEN
Definition audio.h:23
get_soundplugin_list
const struct strvec * get_soundplugin_list(const struct option *poption)
Definition audio.c:79
self
static struct ai_type * self
Definition classicai.c:46
name
const char * name
Definition inputfile.c:127
audio_plugin
Definition audio.h:29
audio_plugin::descr
char descr[MAX_AUDIO_DESCR_LEN]
Definition audio.h:31
audio_plugin::init
bool(* init)(struct audio_plugin *self)
Definition audio.h:33
audio_plugin::stop
void(* stop)(void)
Definition audio.h:35
audio_plugin::wait
void(* wait)(void)
Definition audio.h:36
audio_plugin::initialized
bool initialized
Definition audio.h:32
audio_plugin::set_volume
void(* set_volume)(double volume)
Definition audio.h:38
audio_plugin::get_volume
double(* get_volume)(void)
Definition audio.h:37
audio_plugin::shutdown
void(* shutdown)(struct audio_plugin *self)
Definition audio.h:34
audio_plugin::play
bool(* play)(const char *const tag, const char *const path, bool repeat, audio_finished_callback cb)
Definition audio.h:39
audio_plugin::name
char name[MAX_AUDIO_NAME_LEN]
Definition audio.h:30
option
Definition options.c:454
strvec
Definition string_vector.c:29
support.h
bool
#define bool
Definition support.h:61