---
name: "SDL_AudioPostmixCallback"
section: "3type"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_AudioPostmixCallback"
---

# SDL\_AudioPostmixCallback(3type)

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

## NAME

SDL\_AudioPostmixCallback - A callback that fires when data is about to be fed to an audio device.

## HEADER FILE

Defined in SDL3/SDL\_audio.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**typedef void (SDLCALL \*SDL\_AudioPostmixCallback)(void \*userdata, const SDL\_AudioSpec \*spec, float \*buffer, int buflen);**

## DESCRIPTION

This is useful for accessing the final mix, perhaps for writing a visualizer or applying a final effect to the audio data before playback.

This callback should run as quickly as possible and not block for any significant time, as this callback delays submission of data to the audio device, which can cause audio playback problems.

The postmix callback \_must\_ be able to handle any audio data format specified in **spec** , which can change between callbacks if the audio device changed. However, this only covers frequency and channel count; data is always provided here in  **SDL\_AUDIO\_F32**\
  format.

The postmix callback runs \_after\_ logical device gain and audiostream gain have been applied, which is to say you can make the output data louder at this point than the gain settings would suggest.

## FUNCTION PARAMETERS

- *userdata*

  a pointer provided by the app through  **SDL\_SetAudioPostmixCallback** , for its own use.

- *spec*

  the current format of audio that is to be submitted to the audio device.

- *buffer*

  the buffer of audio samples to be submitted. The callback can inspect and/or modify this data.

- *buflen*

  the size of **buffer** in bytes.

## THREAD SAFETY

This will run from a background thread owned by SDL. The application is responsible for locking resources the callback touches that need to be protected.

## AVAILABILITY

This datatype is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_SetAudioPostmixCallback**(3)](/SDL_SetAudioPostmixCallback/3.md)
