src/audio/SDL_sysaudio.h
author Patrice Mandin
Mon, 07 Jul 2003 19:16:03 +0000
changeset 644 594422ab8f9f
parent 630 550bccdf04bd
child 654 e92bcf2573cb
permissions -rw-r--r--
Atari MiNT: added more audio drivers
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@297
     3
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@0
     6
    modify it under the terms of the GNU Library General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@0
     8
    version 2 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    13
    Library General Public License for more details.
slouken@0
    14
slouken@0
    15
    You should have received a copy of the GNU Library General Public
slouken@0
    16
    License along with this library; if not, write to the Free
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
#ifdef SAVE_RCSID
slouken@0
    24
static char rcsid =
slouken@0
    25
 "@(#) $Id$";
slouken@0
    26
#endif
slouken@0
    27
slouken@0
    28
#ifndef _SDL_sysaudio_h
slouken@0
    29
#define _SDL_sysaudio_h
slouken@0
    30
slouken@0
    31
#include "SDL_mutex.h"
slouken@0
    32
#include "SDL_thread.h"
slouken@0
    33
slouken@0
    34
/* The SDL audio driver */
slouken@0
    35
typedef struct SDL_AudioDevice SDL_AudioDevice;
slouken@0
    36
slouken@0
    37
/* Define the SDL audio driver structure */
slouken@0
    38
#define _THIS	SDL_AudioDevice *_this
slouken@0
    39
#ifndef _STATUS
slouken@0
    40
#define _STATUS	SDL_status *status
slouken@0
    41
#endif
slouken@0
    42
struct SDL_AudioDevice {
slouken@0
    43
	/* * * */
slouken@0
    44
	/* The name of this audio driver */
slouken@0
    45
	const char *name;
slouken@0
    46
slouken@0
    47
	/* * * */
slouken@0
    48
	/* The description of this audio driver */
slouken@0
    49
	const char *desc;
slouken@0
    50
slouken@0
    51
	/* * * */
slouken@0
    52
	/* Public driver functions */
slouken@0
    53
	int  (*OpenAudio)(_THIS, SDL_AudioSpec *spec);
slouken@0
    54
	void (*ThreadInit)(_THIS);	/* Called by audio thread at start */
slouken@0
    55
	void (*WaitAudio)(_THIS);
slouken@0
    56
	void (*PlayAudio)(_THIS);
slouken@0
    57
	Uint8 *(*GetAudioBuf)(_THIS);
slouken@0
    58
	void (*WaitDone)(_THIS);
slouken@0
    59
	void (*CloseAudio)(_THIS);
slouken@0
    60
slouken@0
    61
	/* * * */
slouken@322
    62
	/* Lock / Unlock functions added for the Mac port */
slouken@322
    63
	void (*LockAudio)(_THIS);
slouken@322
    64
	void (*UnlockAudio)(_THIS);
slouken@322
    65
slouken@322
    66
	/* * * */
slouken@0
    67
	/* Data common to all devices */
slouken@0
    68
slouken@0
    69
	/* The current audio specification (shared with audio thread) */
slouken@0
    70
	SDL_AudioSpec spec;
slouken@0
    71
slouken@0
    72
	/* An audio conversion block for audio format emulation */
slouken@0
    73
	SDL_AudioCVT convert;
slouken@0
    74
slouken@0
    75
	/* Current state flags */
slouken@0
    76
	int enabled;
slouken@0
    77
	int paused;
slouken@0
    78
	int opened;
slouken@0
    79
slouken@0
    80
	/* Fake audio buffer for when the audio hardware is busy */
slouken@0
    81
	Uint8 *fake_stream;
slouken@0
    82
slouken@0
    83
	/* A semaphore for locking the mixing buffers */
slouken@0
    84
	SDL_mutex *mixer_lock;
slouken@0
    85
slouken@0
    86
	/* A thread to feed the audio device */
slouken@0
    87
	SDL_Thread *thread;
slouken@0
    88
	Uint32 threadid;
slouken@0
    89
slouken@0
    90
	/* * * */
slouken@0
    91
	/* Data private to this driver */
slouken@0
    92
	struct SDL_PrivateAudioData *hidden;
slouken@0
    93
slouken@0
    94
	/* * * */
slouken@0
    95
	/* The function used to dispose of this structure */
slouken@0
    96
	void (*free)(_THIS);
slouken@0
    97
};
slouken@0
    98
#undef _THIS
slouken@0
    99
slouken@0
   100
typedef struct AudioBootStrap {
slouken@0
   101
	const char *name;
slouken@0
   102
	const char *desc;
slouken@0
   103
	int (*available)(void);
slouken@0
   104
	SDL_AudioDevice *(*create)(int devindex);
slouken@0
   105
} AudioBootStrap;
slouken@0
   106
slouken@121
   107
#ifdef OPENBSD_AUDIO_SUPPORT
slouken@121
   108
extern AudioBootStrap OPENBSD_AUDIO_bootstrap;
slouken@94
   109
#endif
slouken@0
   110
#ifdef OSS_SUPPORT
slouken@0
   111
extern AudioBootStrap DSP_bootstrap;
slouken@0
   112
extern AudioBootStrap DMA_bootstrap;
slouken@0
   113
#endif
slouken@0
   114
#ifdef ALSA_SUPPORT
slouken@0
   115
extern AudioBootStrap ALSA_bootstrap;
slouken@0
   116
#endif
slouken@148
   117
#ifdef SUNAUDIO_SUPPORT
slouken@148
   118
extern AudioBootStrap SUNAUDIO_bootstrap;
slouken@148
   119
#endif
slouken@148
   120
#ifdef DMEDIA_SUPPORT
slouken@148
   121
extern AudioBootStrap DMEDIA_bootstrap;
slouken@35
   122
#endif
slouken@0
   123
#ifdef ARTSC_SUPPORT
slouken@0
   124
extern AudioBootStrap ARTSC_bootstrap;
slouken@0
   125
#endif
slouken@0
   126
#ifdef ESD_SUPPORT
slouken@0
   127
extern AudioBootStrap ESD_bootstrap;
slouken@0
   128
#endif
slouken@0
   129
#ifdef NAS_SUPPORT
slouken@0
   130
extern AudioBootStrap NAS_bootstrap;
slouken@0
   131
#endif
slouken@0
   132
#ifdef ENABLE_DIRECTX
slouken@0
   133
extern AudioBootStrap DSOUND_bootstrap;
slouken@0
   134
#endif
slouken@0
   135
#ifdef ENABLE_WINDIB
slouken@0
   136
extern AudioBootStrap WAVEOUT_bootstrap;
slouken@0
   137
#endif
slouken@21
   138
#ifdef _AIX
slouken@21
   139
extern AudioBootStrap Paud_bootstrap;
slouken@21
   140
#endif
slouken@0
   141
#ifdef __BEOS__
slouken@0
   142
extern AudioBootStrap BAUDIO_bootstrap;
slouken@0
   143
#endif
slouken@0
   144
#if defined(macintosh) || TARGET_API_MAC_CARBON
slouken@0
   145
extern AudioBootStrap SNDMGR_bootstrap;
slouken@0
   146
#endif
slouken@21
   147
#ifdef ENABLE_AHI
slouken@21
   148
extern AudioBootStrap AHI_bootstrap;
slouken@0
   149
#endif
slouken@398
   150
#ifdef MINTAUDIO_SUPPORT
patmandin@644
   151
extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
patmandin@644
   152
extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
patmandin@644
   153
extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
patmandin@644
   154
extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
patmandin@644
   155
extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
slouken@398
   156
#endif
slouken@68
   157
#ifdef DISKAUD_SUPPORT
slouken@68
   158
extern AudioBootStrap DISKAUD_bootstrap;
slouken@68
   159
#endif
slouken@509
   160
#ifdef ENABLE_DC
slouken@509
   161
extern AudioBootStrap DCAUD_bootstrap;
slouken@509
   162
#endif
slouken@630
   163
#ifdef DRENDERER_SUPPORT
slouken@630
   164
extern AudioBootStrap DRENDERER_bootstrap;
slouken@630
   165
#endif
slouken@0
   166
slouken@0
   167
/* This is the current audio device */
slouken@0
   168
extern SDL_AudioDevice *current_audio;
slouken@0
   169
slouken@0
   170
#endif /* _SDL_sysaudio_h */