X-Git-Url: https://git.distorted.org.uk/~mdw/jog/blobdiff_plain/b1ffb19d137241e62b4eea0e6db834bd624bdda2..e9060e7e4c0de71ef6d4b7d7b05c3167790073e3:/ausys.h diff --git a/ausys.h b/ausys.h new file mode 100644 index 0000000..d228bbc --- /dev/null +++ b/ausys.h @@ -0,0 +1,137 @@ +/* -*-c-*- + * + * $Id: ausys.h,v 1.1 2002/02/02 19:16:28 mdw Exp $ + * + * System-specific audio-handling interface + * + * (c) 2002 Mark Wooding + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This file is part of Jog: Programming for a jogging machine. + * + * Jog is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Jog is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jog; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/*----- Revision history --------------------------------------------------* + * + * $Log: ausys.h,v $ + * Revision 1.1 2002/02/02 19:16:28 mdw + * New audio subsystem. + * + */ + +#ifndef AUSYS_H +#define AUSYS_H + +#ifdef __cplusplus + extern "C" { +#endif + +/*----- Header files ------------------------------------------------------*/ + +#ifndef AU_H +# include "au.h" +#endif + +/*----- Global variables --------------------------------------------------*/ + +extern const char *const ausys_suffix; /* Suffix for audio files */ + +/*----- Functions provided ------------------------------------------------*/ + +/* --- @ausys_init@ --- * + * + * Arguments: --- + * + * Returns: --- + * + * Use: Does any initialization required by the system-specific audio + * handler. + */ + +extern void ausys_init(void); + +/* --- @ausys_shutdown@ --- * + * + * Arguments: --- + * + * Returns: --- + * + * Use: Does any tidying up required. + */ + +extern void ausys_shutdown(void); + +/* --- @ausys_lock@, @ausys_unlock@ --- * + * + * Arguments: --- + * + * Returns: --- + * + * Use: Locks or unlocks the audio subsystem. This protects the + * audio queue from becoming corrupted during all the tedious + * asynchronous stuff. + */ + +extern void ausys_lock(void); +extern void ausys_unlock(void); + +/* --- @ausys_queue@ --- * + * + * Arguments: @au_data *a@ = an audio thingy to play + * + * Returns: --- + * + * Use: Queues an audio sample to be played. The sample should be + * freed (with @au_free@) when it's no longer wanted. + */ + +extern void ausys_queue(au_data */*a*/); + +/* --- @ausys_decode@ --- * + * + * Arguments: @au_sample *s@ = pointer to sample block + * @const void *p@ = pointer to sample file contents + * @size_t sz@ = size of sample file contents + * + * Returns: Pointer to a sample data structure. + * + * Use: Decodes a WAV file into something the system-specific layer + * actually wants to deal with. + */ + +extern au_data *ausys_decode(au_sample */*s*/, + const void */*p*/, size_t /*sz*/); + +/* --- @ausys_free@ --- * + * + * Arguments: @au_data *a@ = an audio thingy to free + * + * Returns: --- + * + * Use: Frees a decoded audio sample. + */ + +extern void ausys_free(au_data */*a*/); + +/*----- That's all, folks -------------------------------------------------*/ + +#ifdef __cplusplus + } +#endif + +#endif