DEADSOFTWARE

streams: new method: getlen
[flatwaifu.git] / src / sound.h
1 /* Copyright (C) 2020 SovietPony
2 *
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, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 */
16 #ifndef SOUND_H_INCLUDED
17 #define SOUND_H_INCLUDED
19 #include "menu.h"
20 #include "system.h"
22 typedef struct {
23 int tag;
24 } snd_t;
26 const cfg_t *S_args (void);
27 const cfg_t *S_conf (void);
28 const menu_t *S_menu (void);
30 // Get sound handle for resource <id>
31 snd_t *S_get (int id);
33 // Get sound handle for resource with name
34 snd_t *S_load (const char name[8]);
36 // Stop sound and free handle
37 void S_free (snd_t *s);
39 // Initialize sound subsystem
40 void S_init (void);
42 // Deinitialize sound subsystem
43 void S_done (void);
45 // Play sound <s> on channel <c> with volume <v>.
46 // <s> = sound handle (NULL is ignored)
47 // <c> = 1..8 or 0 for any free
48 // <v> = 0..255
49 // return used channel or zero on error
50 short S_play (snd_t *s, short c, short v);
52 // Stop sound on channel <c>
53 // <c> = 0..8 (0 ignored)
54 void S_stop (short c);
56 // Set sound volume to <v>, also affects variable snd_vol
57 // <v> = 0..128
58 void S_volume (int v);
60 // Wait before all sounds end playing
61 void S_wait (void);
63 #endif /* SOUND_H_INCLUDED */