e9060e7e |
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 | |
e9060e7e |
29 | #ifndef AUSYS_H |
30 | #define AUSYS_H |
31 | |
32 | #ifdef __cplusplus |
33 | extern "C" { |
34 | #endif |
35 | |
36 | /*----- Header files ------------------------------------------------------*/ |
37 | |
38 | #ifndef AU_H |
39 | # include "au.h" |
40 | #endif |
41 | |
42 | /*----- Global variables --------------------------------------------------*/ |
43 | |
44 | extern const char *const ausys_suffix; /* Suffix for audio files */ |
45 | |
46 | /*----- Functions provided ------------------------------------------------*/ |
47 | |
48 | /* --- @ausys_init@ --- * |
49 | * |
50 | * Arguments: --- |
51 | * |
52 | * Returns: --- |
53 | * |
54 | * Use: Does any initialization required by the system-specific audio |
55 | * handler. |
56 | */ |
57 | |
58 | extern void ausys_init(void); |
59 | |
60 | /* --- @ausys_shutdown@ --- * |
61 | * |
62 | * Arguments: --- |
63 | * |
64 | * Returns: --- |
65 | * |
66 | * Use: Does any tidying up required. |
67 | */ |
68 | |
69 | extern void ausys_shutdown(void); |
70 | |
71 | /* --- @ausys_lock@, @ausys_unlock@ --- * |
72 | * |
73 | * Arguments: --- |
74 | * |
75 | * Returns: --- |
76 | * |
77 | * Use: Locks or unlocks the audio subsystem. This protects the |
78 | * audio queue from becoming corrupted during all the tedious |
79 | * asynchronous stuff. |
80 | */ |
81 | |
82 | extern void ausys_lock(void); |
83 | extern void ausys_unlock(void); |
84 | |
85 | /* --- @ausys_queue@ --- * |
86 | * |
87 | * Arguments: @au_data *a@ = an audio thingy to play |
88 | * |
89 | * Returns: --- |
90 | * |
91 | * Use: Queues an audio sample to be played. The sample should be |
92 | * freed (with @au_free@) when it's no longer wanted. |
93 | */ |
94 | |
95 | extern void ausys_queue(au_data */*a*/); |
96 | |
97 | /* --- @ausys_decode@ --- * |
98 | * |
99 | * Arguments: @au_sample *s@ = pointer to sample block |
100 | * @const void *p@ = pointer to sample file contents |
101 | * @size_t sz@ = size of sample file contents |
102 | * |
103 | * Returns: Pointer to a sample data structure. |
104 | * |
105 | * Use: Decodes a WAV file into something the system-specific layer |
106 | * actually wants to deal with. |
107 | */ |
108 | |
109 | extern au_data *ausys_decode(au_sample */*s*/, |
110 | const void */*p*/, size_t /*sz*/); |
111 | |
112 | /* --- @ausys_free@ --- * |
113 | * |
114 | * Arguments: @au_data *a@ = an audio thingy to free |
115 | * |
116 | * Returns: --- |
117 | * |
118 | * Use: Frees a decoded audio sample. |
119 | */ |
120 | |
121 | extern void ausys_free(au_data */*a*/); |
122 | |
123 | /*----- That's all, folks -------------------------------------------------*/ |
124 | |
125 | #ifdef __cplusplus |
126 | } |
127 | #endif |
128 | |
129 | #endif |