| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | /** |
| | | * \name Audio flags |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | #define SDL_AUDIO_MASK_BITSIZE (0xFF) |
| | | #define SDL_AUDIO_MASK_DATATYPE (1<<8) |
| | |
| | | * |
| | | * Defaults to LSB byte order. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ |
| | | #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ |
| | | #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ |
| | |
| | | #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_U16 AUDIO_U16LSB |
| | | #define AUDIO_S16 AUDIO_S16LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name int32 support |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ |
| | | #define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_S32 AUDIO_S32LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name float32 support |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ |
| | | #define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_F32 AUDIO_F32LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Native audio byte ordering |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
| | | #define AUDIO_U16SYS AUDIO_U16LSB |
| | | #define AUDIO_S16SYS AUDIO_S16LSB |
| | |
| | | #define AUDIO_S32SYS AUDIO_S32MSB |
| | | #define AUDIO_F32SYS AUDIO_F32MSB |
| | | #endif |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Allow change flags |
| | | * |
| | | * Which audio format changes are allowed when opening a device. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 |
| | | #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 |
| | | #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 |
| | | #define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /*@}*//*Audio flags*/ |
| | | /* @} *//* Audio flags */ |
| | | |
| | | /** |
| | | * This function is called when the audio device needs more data. |
| | |
| | | * These functions return the list of built in audio drivers, in the |
| | | * order that they are normally initialized by default. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); |
| | | extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Initialization and cleanup |
| | |
| | | * you have a specific need to specify the audio driver you want to |
| | | * use. You should normally use SDL_Init() or SDL_InitSubSystem(). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); |
| | | extern DECLSPEC void SDLCALL SDL_AudioQuit(void); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * This function returns the name of the current audio driver, or NULL |
| | |
| | | * |
| | | * Get the current audio state. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | typedef enum |
| | | { |
| | | SDL_AUDIO_STOPPED = 0, |
| | |
| | | |
| | | extern DECLSPEC SDL_AudioStatus SDLCALL |
| | | SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); |
| | | /*@}*//*Audio State*/ |
| | | /* @} *//* Audio State */ |
| | | |
| | | /** |
| | | * \name Pause audio functions |
| | |
| | | * data for your callback function after opening the audio device. |
| | | * Silence will be written to the audio device during the pause. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); |
| | | extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, |
| | | int pause_on); |
| | | /*@}*//*Pause audio functions*/ |
| | | /* @} *//* Pause audio functions */ |
| | | |
| | | /** |
| | | * This function loads a WAVE from the data source, automatically freeing |
| | |
| | | * the callback function is not running. Do not call these from the callback |
| | | * function or you will cause deadlock. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC void SDLCALL SDL_LockAudio(void); |
| | | extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); |
| | | extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); |
| | | extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); |
| | | /*@}*//*Audio lock functions*/ |
| | | /* @} *//* Audio lock functions */ |
| | | |
| | | /** |
| | | * This function shuts down audio processing and closes the audio device. |