New audio subsystem.
[jog] / ausys.h
1 /* -*-c-*-
2 *
3 * $Id: ausys.h,v 1.1 2002/02/02 19:16:28 mdw Exp $
4 *
5 * System-specific audio-handling interface
6 *
7 * (c) 2002 Mark Wooding
8 */
9
10 /*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Jog: Programming for a jogging machine.
13 *
14 * Jog is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * Jog is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Jog; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29 /*----- Revision history --------------------------------------------------*
30 *
31 * $Log: ausys.h,v $
32 * Revision 1.1 2002/02/02 19:16:28 mdw
33 * New audio subsystem.
34 *
35 */
36
37 #ifndef AUSYS_H
38 #define AUSYS_H
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*----- Header files ------------------------------------------------------*/
45
46 #ifndef AU_H
47 # include "au.h"
48 #endif
49
50 /*----- Global variables --------------------------------------------------*/
51
52 extern const char *const ausys_suffix; /* Suffix for audio files */
53
54 /*----- Functions provided ------------------------------------------------*/
55
56 /* --- @ausys_init@ --- *
57 *
58 * Arguments: ---
59 *
60 * Returns: ---
61 *
62 * Use: Does any initialization required by the system-specific audio
63 * handler.
64 */
65
66 extern void ausys_init(void);
67
68 /* --- @ausys_shutdown@ --- *
69 *
70 * Arguments: ---
71 *
72 * Returns: ---
73 *
74 * Use: Does any tidying up required.
75 */
76
77 extern void ausys_shutdown(void);
78
79 /* --- @ausys_lock@, @ausys_unlock@ --- *
80 *
81 * Arguments: ---
82 *
83 * Returns: ---
84 *
85 * Use: Locks or unlocks the audio subsystem. This protects the
86 * audio queue from becoming corrupted during all the tedious
87 * asynchronous stuff.
88 */
89
90 extern void ausys_lock(void);
91 extern void ausys_unlock(void);
92
93 /* --- @ausys_queue@ --- *
94 *
95 * Arguments: @au_data *a@ = an audio thingy to play
96 *
97 * Returns: ---
98 *
99 * Use: Queues an audio sample to be played. The sample should be
100 * freed (with @au_free@) when it's no longer wanted.
101 */
102
103 extern void ausys_queue(au_data */*a*/);
104
105 /* --- @ausys_decode@ --- *
106 *
107 * Arguments: @au_sample *s@ = pointer to sample block
108 * @const void *p@ = pointer to sample file contents
109 * @size_t sz@ = size of sample file contents
110 *
111 * Returns: Pointer to a sample data structure.
112 *
113 * Use: Decodes a WAV file into something the system-specific layer
114 * actually wants to deal with.
115 */
116
117 extern au_data *ausys_decode(au_sample */*s*/,
118 const void */*p*/, size_t /*sz*/);
119
120 /* --- @ausys_free@ --- *
121 *
122 * Arguments: @au_data *a@ = an audio thingy to free
123 *
124 * Returns: ---
125 *
126 * Use: Frees a decoded audio sample.
127 */
128
129 extern void ausys_free(au_data */*a*/);
130
131 /*----- That's all, folks -------------------------------------------------*/
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137 #endif