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
27typedef void (*audio_finished_callback)(void);
28
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,
41};
42
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 */
void audio_restart(const char *soundset_name, const char *musicset_name)
Definition audio.c:369
void audio_play_track(const char *const tag, char *const alt_tag)
Definition audio.c:577
void audio_play_music(const char *const tag, char *const alt_tag, enum music_usage usage)
Definition audio.c:566
void audio_shutdown(bool play_quit_tag)
Definition audio.c:629
const char * audio_get_all_plugin_names(void)
Definition audio.c:666
void audio_stop(void)
Definition audio.c:594
void audio_stop_usage(void)
Definition audio.c:602
void audio_init(void)
Definition audio.c:187
void audio_play_sound(const char *const tag, const char *const alt_tag)
Definition audio.c:521
music_usage
Definition audio.h:43
@ MU_INGAME
Definition audio.h:43
@ MU_MENU
Definition audio.h:43
bool audio_select_plugin(const char *const name)
Definition audio.c:145
void audio_real_init(const char *const soundspec_name, const char *const musicset_name, const char *const preferred_plugin_name)
Definition audio.c:273
void audio_set_volume(double volume)
Definition audio.c:619
const struct strvec * get_musicset_list(const struct option *poption)
Definition audio.c:125
#define MAX_AUDIO_NAME_LEN
Definition audio.h:22
double audio_get_volume(void)
Definition audio.c:611
void(* audio_finished_callback)(void)
Definition audio.h:27
void audio_add_plugin(struct audio_plugin *p)
Definition audio.c:135
const struct strvec * get_soundset_list(const struct option *poption)
Definition audio.c:115
#define MAX_AUDIO_DESCR_LEN
Definition audio.h:23
const struct strvec * get_soundplugin_list(const struct option *poption)
Definition audio.c:79
static struct ai_type * self
Definition classicai.c:46
const char * name
Definition inputfile.c:127
char descr[MAX_AUDIO_DESCR_LEN]
Definition audio.h:31
bool(* init)(struct audio_plugin *self)
Definition audio.h:33
void(* stop)(void)
Definition audio.h:35
void(* wait)(void)
Definition audio.h:36
bool initialized
Definition audio.h:32
void(* set_volume)(double volume)
Definition audio.h:38
double(* get_volume)(void)
Definition audio.h:37
void(* shutdown)(struct audio_plugin *self)
Definition audio.h:34
bool(* play)(const char *const tag, const char *const path, bool repeat, audio_finished_callback cb)
Definition audio.h:39
char name[MAX_AUDIO_NAME_LEN]
Definition audio.h:30
#define bool
Definition support.h:61