sdl.audio

SDL Audio

Members

Aliases

SDL_AudioDeviceID
alias SDL_AudioDeviceID = Uint32

SDL Audio Device instance IDs.

SDL_AudioPostmixCallback
alias SDL_AudioPostmixCallback = void function(void* userdata, const(SDL_AudioSpec)* spec, float* buffer, int buflen)

A callback that fires when data is about to be fed to an audio device.

SDL_AudioStreamCallback
alias SDL_AudioStreamCallback = void function(void* userdata, SDL_AudioStream* stream, int additional_amount, int total_amount)

A callback that fires when data passes through an SDL_AudioStream.

Enums

SDL_AUDIO_BITSIZE
eponymoustemplate SDL_AUDIO_BITSIZE(x)

Retrieve the size, in bits, from an SDL_AudioFormat.

SDL_AUDIO_BYTESIZE
eponymoustemplate SDL_AUDIO_BYTESIZE(x)

Retrieve the size, in bytes, from an SDL_AudioFormat.

SDL_AUDIO_FRAMESIZE
eponymoustemplate SDL_AUDIO_FRAMESIZE(x)

Calculate the size of each audio frame (in bytes) from an SDL_AudioSpec.

SDL_AUDIO_ISBIGENDIAN
eponymoustemplate SDL_AUDIO_ISBIGENDIAN(x)

Determine if an SDL_AudioFormat represents bigendian data.

SDL_AUDIO_ISFLOAT
eponymoustemplate SDL_AUDIO_ISFLOAT(x)

Determine if an SDL_AudioFormat represents floating point data.

SDL_AUDIO_ISINT
eponymoustemplate SDL_AUDIO_ISINT(x)

Determine if an SDL_AudioFormat represents integer data.

SDL_AUDIO_ISLITTLEENDIAN
eponymoustemplate SDL_AUDIO_ISLITTLEENDIAN(x)

Determine if an SDL_AudioFormat represents littleendian data.

SDL_AUDIO_ISSIGNED
eponymoustemplate SDL_AUDIO_ISSIGNED(x)

Determine if an SDL_AudioFormat represents signed data.

SDL_AUDIO_ISUNSIGNED
eponymoustemplate SDL_AUDIO_ISUNSIGNED(x)

Determine if an SDL_AudioFormat represents unsigned data.

SDL_AudioFormat
enum SDL_AudioFormat

Audio format.

Functions

SDL_AudioDevicePaused
bool SDL_AudioDevicePaused(SDL_AudioDeviceID devid)

Use this function to query if an audio device is paused.

SDL_AudioStreamDevicePaused
bool SDL_AudioStreamDevicePaused(SDL_AudioStream* stream)

Use this function to query if an audio device associated with a stream is paused.

SDL_BindAudioStream
bool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream* stream)

Bind a single audio stream to an audio device.

SDL_BindAudioStreams
bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, const(SDL_AudioStream*)* streams, int num_streams)

Bind a list of audio streams to an audio device.

SDL_ClearAudioStream
bool SDL_ClearAudioStream(SDL_AudioStream* stream)

Clear any pending data in the stream.

SDL_CloseAudioDevice
void SDL_CloseAudioDevice(SDL_AudioDeviceID devid)

Close a previously-opened audio device.

SDL_ConvertAudioSamples
bool SDL_ConvertAudioSamples(const(SDL_AudioSpec)* src_spec, const(Uint8)* src_data, int src_len, const(SDL_AudioSpec)* dst_spec, Uint8** dst_data, int* dst_len)

Convert some audio data of one format to another format.

SDL_CreateAudioStream
SDL_AudioStream* SDL_CreateAudioStream(const(SDL_AudioSpec)* src_spec, const(SDL_AudioSpec)* dst_spec)

Create a new audio stream.

SDL_DestroyAudioStream
void SDL_DestroyAudioStream(SDL_AudioStream* stream)

Free an audio stream.

SDL_FlushAudioStream
bool SDL_FlushAudioStream(SDL_AudioStream* stream)

Tell the stream that you're done sending data, and anything being buffered should be converted/resampled and made available immediately.

SDL_GetAudioDeviceChannelMap
int* SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int* count)

Get the current channel map of an audio device.

SDL_GetAudioDeviceFormat
bool SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec* spec, int* sample_frames)

Get the current audio format of a specific audio device.

SDL_GetAudioDeviceGain
float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid)

Get the gain of an audio device.

SDL_GetAudioDeviceName
const(char)* SDL_GetAudioDeviceName(SDL_AudioDeviceID devid)

Get the human-readable name of a specific audio device.

SDL_GetAudioDriver
const(char)* SDL_GetAudioDriver(int index)

Use this function to get the name of a built in audio driver.

SDL_GetAudioFormatName
const(char)* SDL_GetAudioFormatName(SDL_AudioFormat format)

Get the human readable name of an audio format.

SDL_GetAudioPlaybackDevices
SDL_AudioDeviceID* SDL_GetAudioPlaybackDevices(int* count)

Get a list of currently-connected audio playback devices.

SDL_GetAudioRecordingDevices
SDL_AudioDeviceID* SDL_GetAudioRecordingDevices(int* count)

Get a list of currently-connected audio recording devices.

SDL_GetAudioStreamAvailable
int SDL_GetAudioStreamAvailable(SDL_AudioStream* stream)

Get the number of converted/resampled bytes available.

SDL_GetAudioStreamData
int SDL_GetAudioStreamData(SDL_AudioStream* stream, void* buf, int len)

Get converted/resampled data from the stream.

SDL_GetAudioStreamDevice
SDL_AudioDeviceID SDL_GetAudioStreamDevice(SDL_AudioStream* stream)

Query an audio stream for its currently-bound device.

SDL_GetAudioStreamFormat
bool SDL_GetAudioStreamFormat(SDL_AudioStream* stream, SDL_AudioSpec* src_spec, SDL_AudioSpec* dst_spec)

Query the current format of an audio stream.

SDL_GetAudioStreamFrequencyRatio
float SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream* stream)

Get the frequency ratio of an audio stream.

SDL_GetAudioStreamGain
float SDL_GetAudioStreamGain(SDL_AudioStream* stream)

Get the gain of an audio stream.

SDL_GetAudioStreamInputChannelMap
int* SDL_GetAudioStreamInputChannelMap(SDL_AudioStream* stream, int* count)

Get the current input channel map of an audio stream.

SDL_GetAudioStreamOutputChannelMap
int* SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream* stream, int* count)

Get the current output channel map of an audio stream.

SDL_GetAudioStreamProperties
SDL_PropertiesID SDL_GetAudioStreamProperties(SDL_AudioStream* stream)

Get the properties associated with an audio stream.

SDL_GetAudioStreamQueued
int SDL_GetAudioStreamQueued(SDL_AudioStream* stream)

Get the number of bytes currently queued.

SDL_GetCurrentAudioDriver
const(char)* SDL_GetCurrentAudioDriver()

Get the name of the current audio driver.

SDL_GetNumAudioDrivers
int SDL_GetNumAudioDrivers()

Use this function to get the number of built-in audio drivers.

SDL_GetSilenceValueForFormat
int SDL_GetSilenceValueForFormat(SDL_AudioFormat format)

Get the appropriate memset value for silencing an audio format.

SDL_IsAudioDevicePhysical
bool SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid)

Determine if an audio device is physical (instead of logical).

SDL_IsAudioDevicePlayback
bool SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid)

Determine if an audio device is a playback device (instead of recording).

SDL_LoadWAV
bool SDL_LoadWAV(const(char)* path, SDL_AudioSpec* spec, Uint8** audio_buf, Uint32* audio_len)

Loads a WAV from a file path.

SDL_LoadWAV_IO
bool SDL_LoadWAV_IO(SDL_IOStream* src, bool closeio, SDL_AudioSpec* spec, Uint8** audio_buf, Uint32* audio_len)

Load the audio data of a WAVE file into memory.

SDL_LockAudioStream
bool SDL_LockAudioStream(SDL_AudioStream* stream)

Lock an audio stream for serialized access.

SDL_MixAudio
bool SDL_MixAudio(Uint8* dst, const(Uint8)* src, SDL_AudioFormat format, Uint32 len, float volume)

Mix audio data in a specified format.

SDL_OpenAudioDevice
SDL_AudioDeviceID SDL_OpenAudioDevice(SDL_AudioDeviceID devid, const(SDL_AudioSpec)* spec)

Open a specific audio device.

SDL_OpenAudioDeviceStream
SDL_AudioStream* SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const(SDL_AudioSpec)* spec, SDL_AudioStreamCallback callback, void* userdata)

Convenience function for straightforward audio init for the common case.

SDL_PauseAudioDevice
bool SDL_PauseAudioDevice(SDL_AudioDeviceID devid)

Use this function to pause audio playback on a specified device.

SDL_PauseAudioStreamDevice
bool SDL_PauseAudioStreamDevice(SDL_AudioStream* stream)

Use this function to pause audio playback on the audio device associated with an audio stream.

SDL_PutAudioStreamData
bool SDL_PutAudioStreamData(SDL_AudioStream* stream, const(void)* buf, int len)

Add data to the stream.

SDL_ResumeAudioDevice
bool SDL_ResumeAudioDevice(SDL_AudioDeviceID devid)

Use this function to unpause audio playback on a specified device.

SDL_ResumeAudioStreamDevice
bool SDL_ResumeAudioStreamDevice(SDL_AudioStream* stream)

Use this function to unpause audio playback on the audio device associated with an audio stream.

SDL_SetAudioDeviceGain
bool SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain)

Change the gain of an audio device.

SDL_SetAudioPostmixCallback
bool SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void* userdata)

Set a callback that fires when data is about to be fed to an audio device.

SDL_SetAudioStreamFormat
bool SDL_SetAudioStreamFormat(SDL_AudioStream* stream, const(SDL_AudioSpec)* src_spec, const(SDL_AudioSpec)* dst_spec)

Change the input and output formats of an audio stream.

SDL_SetAudioStreamFrequencyRatio
bool SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream* stream, float ratio)

Change the frequency ratio of an audio stream.

SDL_SetAudioStreamGain
bool SDL_SetAudioStreamGain(SDL_AudioStream* stream, float gain)

Change the gain of an audio stream.

SDL_SetAudioStreamGetCallback
bool SDL_SetAudioStreamGetCallback(SDL_AudioStream* stream, SDL_AudioStreamCallback callback, void* userdata)

Set a callback that runs when data is requested from an audio stream.

SDL_SetAudioStreamInputChannelMap
bool SDL_SetAudioStreamInputChannelMap(SDL_AudioStream* stream, const(int)* chmap, int count)

Set the current input channel map of an audio stream.

SDL_SetAudioStreamOutputChannelMap
bool SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream* stream, const(int)* chmap, int count)

Set the current output channel map of an audio stream.

SDL_SetAudioStreamPutCallback
bool SDL_SetAudioStreamPutCallback(SDL_AudioStream* stream, SDL_AudioStreamCallback callback, void* userdata)

Set a callback that runs when data is added to an audio stream.

SDL_UnbindAudioStream
void SDL_UnbindAudioStream(SDL_AudioStream* stream)

Unbind a single audio stream from its audio device.

SDL_UnbindAudioStreams
void SDL_UnbindAudioStreams(const(SDL_AudioStream*)* streams, int num_streams)

Unbind a list of audio streams from their audio devices.

SDL_UnlockAudioStream
bool SDL_UnlockAudioStream(SDL_AudioStream* stream)

Unlock an audio stream for serialized access.

Manifest constants

SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK
enum SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK;

A value used to request a default playback audio device.

SDL_AUDIO_DEVICE_DEFAULT_RECORDING
enum SDL_AUDIO_DEVICE_DEFAULT_RECORDING;

A value used to request a default recording audio device.

SDL_AUDIO_MASK_BIG_ENDIAN
enum SDL_AUDIO_MASK_BIG_ENDIAN;

Mask of bits in an SDL_AudioFormat that contain the bigendian flag.

SDL_AUDIO_MASK_BITSIZE
enum SDL_AUDIO_MASK_BITSIZE;

Mask of bits in an SDL_AudioFormat that contains the format bit size.

SDL_AUDIO_MASK_FLOAT
enum SDL_AUDIO_MASK_FLOAT;

Mask of bits in an SDL_AudioFormat that contain the floating point flag.

SDL_AUDIO_MASK_SIGNED
enum SDL_AUDIO_MASK_SIGNED;

Mask of bits in an SDL_AudioFormat that contain the signed data flag.

Structs

SDL_AudioSpec
struct SDL_AudioSpec

Format specifier for audio data.

SDL_AudioStream
struct SDL_AudioStream

The opaque handle that represents an audio stream.

Variables

SDL_AUDIO_F32
enum SDL_AudioFormat SDL_AUDIO_F32;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_AUDIO_F32
enum SDL_AudioFormat SDL_AUDIO_F32;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_AUDIO_S16
enum SDL_AudioFormat SDL_AUDIO_S16;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_AUDIO_S16
enum SDL_AudioFormat SDL_AUDIO_S16;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_AUDIO_S32
enum SDL_AudioFormat SDL_AUDIO_S32;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_AUDIO_S32
enum SDL_AudioFormat SDL_AUDIO_S32;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

See Also

Meta

License

Subject to the terms of the Zlib License, as written in the LICENSE file.

Authors

Luna Nielsen