src/audio/SDL_sysaudio.h
author Ryan C. Gordon <icculus@icculus.org>
Thu, 31 Aug 2006 21:00:10 +0000
changeset 1994 6abc7e6f9817
parent 1895 c121d94672cb
child 2049 5f6550e5184f
child 3784 37c9c4590689
permissions -rw-r--r--
Added int32 adn float32 support to SDL_LoadWAV_RW().
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@1895
    38
struct SDL_AudioDevice
slouken@1895
    39
{
slouken@1895
    40
    /* * * */
slouken@1895
    41
    /* The name of this audio driver */
slouken@1895
    42
    const char *name;
slouken@0
    43
slouken@1895
    44
    /* * * */
slouken@1895
    45
    /* The description of this audio driver */
slouken@1895
    46
    const char *desc;
slouken@0
    47
slouken@1895
    48
    /* * * */
slouken@1895
    49
    /* Public driver functions */
slouken@1895
    50
    int (*OpenAudio) (_THIS, SDL_AudioSpec * spec);
slouken@1895
    51
    void (*ThreadInit) (_THIS); /* Called by audio thread at start */
slouken@1895
    52
    void (*WaitAudio) (_THIS);
slouken@1895
    53
    void (*PlayAudio) (_THIS);
slouken@1895
    54
    Uint8 *(*GetAudioBuf) (_THIS);
slouken@1895
    55
    void (*WaitDone) (_THIS);
slouken@1895
    56
    void (*CloseAudio) (_THIS);
slouken@0
    57
slouken@1895
    58
    /* * * */
slouken@1895
    59
    /* Lock / Unlock functions added for the Mac port */
slouken@1895
    60
    void (*LockAudio) (_THIS);
slouken@1895
    61
    void (*UnlockAudio) (_THIS);
slouken@322
    62
slouken@1895
    63
    /* * * */
slouken@1895
    64
    /* Data common to all devices */
slouken@0
    65
slouken@1895
    66
    /* The current audio specification (shared with audio thread) */
slouken@1895
    67
    SDL_AudioSpec spec;
slouken@0
    68
slouken@1895
    69
    /* An audio conversion block for audio format emulation */
slouken@1895
    70
    SDL_AudioCVT convert;
slouken@0
    71
slouken@1895
    72
    /* Current state flags */
slouken@1895
    73
    int enabled;
slouken@1895
    74
    int paused;
slouken@1895
    75
    int opened;
slouken@0
    76
slouken@1895
    77
    /* Fake audio buffer for when the audio hardware is busy */
slouken@1895
    78
    Uint8 *fake_stream;
slouken@0
    79
slouken@1895
    80
    /* A semaphore for locking the mixing buffers */
slouken@1895
    81
    SDL_mutex *mixer_lock;
slouken@0
    82
slouken@1895
    83
    /* A thread to feed the audio device */
slouken@1895
    84
    SDL_Thread *thread;
slouken@1895
    85
    Uint32 threadid;
slouken@0
    86
slouken@1895
    87
    /* * * */
slouken@1895
    88
    /* Data private to this driver */
slouken@1895
    89
    struct SDL_PrivateAudioData *hidden;
slouken@0
    90
slouken@1895
    91
    /* * * */
slouken@1895
    92
    /* The function used to dispose of this structure */
slouken@1895
    93
    void (*free) (_THIS);
slouken@0
    94
};
slouken@0
    95
#undef _THIS
slouken@0
    96
slouken@1895
    97
typedef struct AudioBootStrap
slouken@1895
    98
{
slouken@1895
    99
    const char *name;
slouken@1895
   100
    const char *desc;
slouken@1895
   101
    int (*available) (void);
slouken@1895
   102
    SDL_AudioDevice *(*create) (int devindex);
slouken@0
   103
} AudioBootStrap;
slouken@0
   104
slouken@1567
   105
#if SDL_AUDIO_DRIVER_BSD
slouken@1567
   106
extern AudioBootStrap BSD_AUDIO_bootstrap;
slouken@94
   107
#endif
slouken@1361
   108
#if SDL_AUDIO_DRIVER_OSS
slouken@0
   109
extern AudioBootStrap DSP_bootstrap;
slouken@0
   110
extern AudioBootStrap DMA_bootstrap;
slouken@0
   111
#endif
slouken@1361
   112
#if SDL_AUDIO_DRIVER_ALSA
slouken@0
   113
extern AudioBootStrap ALSA_bootstrap;
slouken@0
   114
#endif
slouken@1361
   115
#if SDL_AUDIO_DRIVER_QNXNTO
slouken@663
   116
extern AudioBootStrap QNXNTOAUDIO_bootstrap;
slouken@663
   117
#endif
slouken@1361
   118
#if SDL_AUDIO_DRIVER_SUNAUDIO
slouken@148
   119
extern AudioBootStrap SUNAUDIO_bootstrap;
slouken@148
   120
#endif
slouken@1361
   121
#if SDL_AUDIO_DRIVER_DMEDIA
slouken@148
   122
extern AudioBootStrap DMEDIA_bootstrap;
slouken@35
   123
#endif
slouken@1361
   124
#if SDL_AUDIO_DRIVER_ARTS
slouken@1361
   125
extern AudioBootStrap ARTS_bootstrap;
slouken@0
   126
#endif
slouken@1361
   127
#if SDL_AUDIO_DRIVER_ESD
slouken@0
   128
extern AudioBootStrap ESD_bootstrap;
slouken@0
   129
#endif
slouken@1361
   130
#if SDL_AUDIO_DRIVER_NAS
slouken@0
   131
extern AudioBootStrap NAS_bootstrap;
slouken@0
   132
#endif
slouken@1361
   133
#if SDL_AUDIO_DRIVER_DSOUND
slouken@0
   134
extern AudioBootStrap DSOUND_bootstrap;
slouken@0
   135
#endif
slouken@1361
   136
#if SDL_AUDIO_DRIVER_WAVEOUT
slouken@0
   137
extern AudioBootStrap WAVEOUT_bootstrap;
slouken@0
   138
#endif
slouken@1361
   139
#if SDL_AUDIO_DRIVER_PAUD
slouken@21
   140
extern AudioBootStrap Paud_bootstrap;
slouken@21
   141
#endif
slouken@1361
   142
#if SDL_AUDIO_DRIVER_BAUDIO
slouken@0
   143
extern AudioBootStrap BAUDIO_bootstrap;
slouken@0
   144
#endif
slouken@1361
   145
#if SDL_AUDIO_DRIVER_COREAUDIO
slouken@935
   146
extern AudioBootStrap COREAUDIO_bootstrap;
slouken@935
   147
#endif
slouken@1361
   148
#if SDL_AUDIO_DRIVER_SNDMGR
slouken@0
   149
extern AudioBootStrap SNDMGR_bootstrap;
slouken@0
   150
#endif
slouken@1361
   151
#if SDL_AUDIO_DRIVER_AHI
slouken@21
   152
extern AudioBootStrap AHI_bootstrap;
slouken@0
   153
#endif
slouken@1361
   154
#if SDL_AUDIO_DRIVER_MINT
patmandin@644
   155
extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
patmandin@644
   156
extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
patmandin@644
   157
extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
patmandin@644
   158
extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
patmandin@644
   159
extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
slouken@398
   160
#endif
slouken@1361
   161
#if SDL_AUDIO_DRIVER_DISK
slouken@68
   162
extern AudioBootStrap DISKAUD_bootstrap;
slouken@68
   163
#endif
icculus@1532
   164
#if SDL_AUDIO_DRIVER_DUMMY
icculus@1532
   165
extern AudioBootStrap DUMMYAUD_bootstrap;
icculus@1532
   166
#endif
slouken@1361
   167
#if SDL_AUDIO_DRIVER_DC
slouken@509
   168
extern AudioBootStrap DCAUD_bootstrap;
slouken@509
   169
#endif
slouken@1361
   170
#if SDL_AUDIO_DRIVER_MMEAUDIO
slouken@654
   171
extern AudioBootStrap MMEAUDIO_bootstrap;
slouken@654
   172
#endif
slouken@1361
   173
#if SDL_AUDIO_DRIVER_DART
icculus@1190
   174
extern AudioBootStrap DART_bootstrap;
icculus@1190
   175
#endif
slouken@0
   176
slouken@0
   177
/* This is the current audio device */
slouken@0
   178
extern SDL_AudioDevice *current_audio;
slouken@0
   179
slouken@0
   180
#endif /* _SDL_sysaudio_h */
slouken@1895
   181
/* vi: set ts=4 sw=4 expandtab: */