3 * $Id: ausys-fake.c,v 1.1 2002/02/02 19:16:28 mdw Exp $
5 * Fake not-audio-at-all audio driver
7 * (c) 2002 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Jog: Programming for a jogging machine.
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.
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.
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.
29 /*----- Revision history --------------------------------------------------*
31 * $Log: ausys-fake.c,v $
32 * Revision 1.1 2002/02/02 19:16:28 mdw
33 * New audio subsystem.
37 /*----- Header files ------------------------------------------------------*/
46 #include <mLib/alloc.h>
48 #include <mLib/trace.h>
54 /*----- Global variables --------------------------------------------------*/
56 const char *const ausys_suffix
= "txt";
58 /*----- Main code ---------------------------------------------------------*/
60 /* --- @ausys_init@ --- *
66 * Use: Does any initialization required by the system-specific audio
72 T( trace(T_AUSYS
, "ausys: initalized ok"); )
75 /* --- @ausys_shutdown@ --- *
81 * Use: Does any tidying up required.
84 void ausys_shutdown(void)
86 T( trace(T_AUSYS
, "ausys: shut down ok"); )
89 /* --- @ausys_lock@, @ausys_unlock@ --- *
95 * Use: Locks or unlocks the audio subsystem. This protects the
96 * audio queue from becoming corrupted during all the tedious
100 void ausys_lock(void) { T( trace(T_AUSYS
, "ausys: acquired lock"); ) ; }
101 void ausys_unlock(void) { T( trace(T_AUSYS
, "ausys: released lock"); ) ; }
103 /* --- @ausys_decode@ --- *
105 * Arguments: @au_sample *s@ = pointer to sample block
106 * @const void *p@ = pointer to sample file contents
107 * @size_t sz@ = size of sample file contents
109 * Returns: Pointer to a sample data structure.
111 * Use: Decodes a WAV file into something the system-specific layer
112 * actually wants to deal with.
115 au_data
*ausys_decode(au_sample
*s
, const void *p
, size_t sz
)
117 au_data
*a
= CREATE(au_data
);
119 const octet
*qq
= memchr(pp
, '\n', sz
);
129 T( trace(T_AUSYS
, "ausys: decoded `%s' ok", SYM_NAME(s
)); )
133 /* --- @ausys_queue@ --- *
135 * Arguments: @au_data *a@ = an audio thingy to play
139 * Use: Queues an audio sample to be played. The sample should be
140 * freed (with @au_free@) when it's no longer wanted.
143 void ausys_queue(au_data
*a
)
145 T( trace(T_AUSYS
, "ausys: queuing `%s'", SYM_NAME(a
->s
)); )
146 printf("[%s]\n", a
->p
);
150 /* --- @ausys_free@ --- *
152 * Arguments: @au_data *a@ = an audio thingy to free
156 * Use: Frees a decoded audio sample.
159 void ausys_free(au_data
*a
)
161 T( trace(T_AUSYS
, "ausys: freeing data for `%s' ok", SYM_NAME(a
->s
)); )
166 /*----- That's all, folks -------------------------------------------------*/