src/audio/SDL_sysaudio.h
author Ryan C. Gordon
Sun, 29 Oct 2006 04:08:50 +0000
branchSDL-1.2
changeset 3889 67d518069d9a
parent 1567 12b6d331d82a
child 3939 42e83d81224b
permissions -rw-r--r--
A few more AmigaOS things.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@0
     4
slouken@1336
     5
    This library is SDL_free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 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@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@0
    23
slouken@0
    24
#ifndef _SDL_sysaudio_h
slouken@0
    25
#define _SDL_sysaudio_h
slouken@0
    26
slouken@0
    27
#include "SDL_mutex.h"
slouken@0
    28
#include "SDL_thread.h"
slouken@0
    29
slouken@0
    30
/* The SDL audio driver */
slouken@0
    31
typedef struct SDL_AudioDevice SDL_AudioDevice;
slouken@0
    32
slouken@0
    33
/* Define the SDL audio driver structure */
slouken@0
    34
#define _THIS	SDL_AudioDevice *_this
slouken@0
    35
#ifndef _STATUS
slouken@0
    36
#define _STATUS	SDL_status *status
slouken@0
    37
#endif
slouken@0
    38
struct SDL_AudioDevice {
slouken@0
    39
	/* * * */
slouken@0
    40
	/* The name of this audio driver */
slouken@0
    41
	const char *name;
slouken@0
    42
slouken@0
    43
	/* * * */
slouken@0
    44
	/* The description of this audio driver */
slouken@0
    45
	const char *desc;
slouken@0
    46
slouken@0
    47
	/* * * */
slouken@0
    48
	/* Public driver functions */
slouken@0
    49
	int  (*OpenAudio)(_THIS, SDL_AudioSpec *spec);
slouken@0
    50
	void (*ThreadInit)(_THIS);	/* Called by audio thread at start */
slouken@0
    51
	void (*WaitAudio)(_THIS);
slouken@0
    52
	void (*PlayAudio)(_THIS);
slouken@0
    53
	Uint8 *(*GetAudioBuf)(_THIS);
slouken@0
    54
	void (*WaitDone)(_THIS);
slouken@0
    55
	void (*CloseAudio)(_THIS);
slouken@0
    56
slouken@0
    57
	/* * * */
slouken@322
    58
	/* Lock / Unlock functions added for the Mac port */
slouken@322
    59
	void (*LockAudio)(_THIS);
slouken@322
    60
	void (*UnlockAudio)(_THIS);
slouken@322
    61
slouken@322
    62
	/* * * */
slouken@0
    63
	/* Data common to all devices */
slouken@0
    64
slouken@0
    65
	/* The current audio specification (shared with audio thread) */
slouken@0
    66
	SDL_AudioSpec spec;
slouken@0
    67
slouken@0
    68
	/* An audio conversion block for audio format emulation */
slouken@0
    69
	SDL_AudioCVT convert;
slouken@0
    70
slouken@0
    71
	/* Current state flags */
slouken@0
    72
	int enabled;
slouken@0
    73
	int paused;
slouken@0
    74
	int opened;
slouken@0
    75
slouken@0
    76
	/* Fake audio buffer for when the audio hardware is busy */
slouken@0
    77
	Uint8 *fake_stream;
slouken@0
    78
slouken@0
    79
	/* A semaphore for locking the mixing buffers */
slouken@0
    80
	SDL_mutex *mixer_lock;
slouken@0
    81
slouken@0
    82
	/* A thread to feed the audio device */
slouken@0
    83
	SDL_Thread *thread;
slouken@0
    84
	Uint32 threadid;
slouken@0
    85
slouken@0
    86
	/* * * */
slouken@0
    87
	/* Data private to this driver */
slouken@0
    88
	struct SDL_PrivateAudioData *hidden;
slouken@0
    89
slouken@0
    90
	/* * * */
slouken@0
    91
	/* The function used to dispose of this structure */
slouken@0
    92
	void (*free)(_THIS);
slouken@0
    93
};
slouken@0
    94
#undef _THIS
slouken@0
    95
slouken@0
    96
typedef struct AudioBootStrap {
slouken@0
    97
	const char *name;
slouken@0
    98
	const char *desc;
slouken@0
    99
	int (*available)(void);
slouken@0
   100
	SDL_AudioDevice *(*create)(int devindex);
slouken@0
   101
} AudioBootStrap;
slouken@0
   102
slouken@1567
   103
#if SDL_AUDIO_DRIVER_BSD
slouken@1567
   104
extern AudioBootStrap BSD_AUDIO_bootstrap;
slouken@94
   105
#endif
slouken@1361
   106
#if SDL_AUDIO_DRIVER_OSS
slouken@0
   107
extern AudioBootStrap DSP_bootstrap;
slouken@0
   108
extern AudioBootStrap DMA_bootstrap;
slouken@0
   109
#endif
slouken@1361
   110
#if SDL_AUDIO_DRIVER_ALSA
slouken@0
   111
extern AudioBootStrap ALSA_bootstrap;
slouken@0
   112
#endif
slouken@1361
   113
#if SDL_AUDIO_DRIVER_QNXNTO
slouken@663
   114
extern AudioBootStrap QNXNTOAUDIO_bootstrap;
slouken@663
   115
#endif
slouken@1361
   116
#if SDL_AUDIO_DRIVER_SUNAUDIO
slouken@148
   117
extern AudioBootStrap SUNAUDIO_bootstrap;
slouken@148
   118
#endif
slouken@1361
   119
#if SDL_AUDIO_DRIVER_DMEDIA
slouken@148
   120
extern AudioBootStrap DMEDIA_bootstrap;
slouken@35
   121
#endif
slouken@1361
   122
#if SDL_AUDIO_DRIVER_ARTS
slouken@1361
   123
extern AudioBootStrap ARTS_bootstrap;
slouken@0
   124
#endif
slouken@1361
   125
#if SDL_AUDIO_DRIVER_ESD
slouken@0
   126
extern AudioBootStrap ESD_bootstrap;
slouken@0
   127
#endif
slouken@1361
   128
#if SDL_AUDIO_DRIVER_NAS
slouken@0
   129
extern AudioBootStrap NAS_bootstrap;
slouken@0
   130
#endif
slouken@1361
   131
#if SDL_AUDIO_DRIVER_DSOUND
slouken@0
   132
extern AudioBootStrap DSOUND_bootstrap;
slouken@0
   133
#endif
slouken@1361
   134
#if SDL_AUDIO_DRIVER_WAVEOUT
slouken@0
   135
extern AudioBootStrap WAVEOUT_bootstrap;
slouken@0
   136
#endif
slouken@1361
   137
#if SDL_AUDIO_DRIVER_PAUD
slouken@21
   138
extern AudioBootStrap Paud_bootstrap;
slouken@21
   139
#endif
slouken@1361
   140
#if SDL_AUDIO_DRIVER_BAUDIO
slouken@0
   141
extern AudioBootStrap BAUDIO_bootstrap;
slouken@0
   142
#endif
slouken@1361
   143
#if SDL_AUDIO_DRIVER_COREAUDIO
slouken@935
   144
extern AudioBootStrap COREAUDIO_bootstrap;
slouken@935
   145
#endif
slouken@1361
   146
#if SDL_AUDIO_DRIVER_SNDMGR
slouken@0
   147
extern AudioBootStrap SNDMGR_bootstrap;
slouken@0
   148
#endif
slouken@1361
   149
#if SDL_AUDIO_DRIVER_MINT
patmandin@644
   150
extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
patmandin@644
   151
extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
patmandin@644
   152
extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
patmandin@644
   153
extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
patmandin@644
   154
extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
slouken@398
   155
#endif
slouken@1361
   156
#if SDL_AUDIO_DRIVER_DISK
slouken@68
   157
extern AudioBootStrap DISKAUD_bootstrap;
slouken@68
   158
#endif
icculus@1532
   159
#if SDL_AUDIO_DRIVER_DUMMY
icculus@1532
   160
extern AudioBootStrap DUMMYAUD_bootstrap;
icculus@1532
   161
#endif
slouken@1361
   162
#if SDL_AUDIO_DRIVER_DC
slouken@509
   163
extern AudioBootStrap DCAUD_bootstrap;
slouken@509
   164
#endif
slouken@1361
   165
#if SDL_AUDIO_DRIVER_MMEAUDIO
slouken@654
   166
extern AudioBootStrap MMEAUDIO_bootstrap;
slouken@654
   167
#endif
slouken@1361
   168
#if SDL_AUDIO_DRIVER_DART
icculus@1190
   169
extern AudioBootStrap DART_bootstrap;
icculus@1190
   170
#endif
slouken@0
   171
slouken@0
   172
/* This is the current audio device */
slouken@0
   173
extern SDL_AudioDevice *current_audio;
slouken@0
   174
slouken@0
   175
#endif /* _SDL_sysaudio_h */