---
name: "al_get_audio_stream_fragment"
section: "3"
platform: "linux"
package: "allegro"
version: "5.2.11.3-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/al_get_audio_stream_fragment"
---

# al\_get\_audio\_stream\_fragment(3)

Allegro 5 API

## NAME

al\_get\_audio\_stream\_fragment - Allegro 5 API

## SYNOPSIS

-

  ```
  #include <allegro5/allegro_audio.h>
  void *al_get_audio_stream_fragment(const ALLEGRO_AUDIO_STREAM *stream)
  ```

## DESCRIPTION

When using Allegro’s audio streaming, you will use this function to continuously provide new sample data to a stream.

If the stream is ready for new data, the function will return the address of an internal buffer to be filled with audio data. The length and format of the buffer are specified with [al\_create\_audio\_stream(3)](/al_create_audio_stream/3.md) or can be queried with the various functions described here. Once the buffer is filled, you must signal this to Allegro by passing the buffer to [al\_set\_audio\_stream\_fragment(3)](/al_set_audio_stream_fragment/3.md).

If the stream is not ready for new data, the function will return NULL.

*Note:* If you listen to events from the stream, an ALLEGRO\_EVENT\_AUDIO\_STREAM\_FRAGMENT(3) event will be generated whenever a new fragment is ready. However, getting an event is *not* a guarantee that [al\_get\_audio\_stream\_fragment(3)](/al_get_audio_stream_fragment/3.md) will not return NULL, so you still must check for it.

## SEE ALSO

[al\_set\_audio\_stream\_fragment(3)](/al_set_audio_stream_fragment/3.md), [al\_get\_audio\_stream\_event\_source(3)](/al_get_audio_stream_event_source/3.md), [al\_get\_audio\_stream\_frequency(3)](/al_get_audio_stream_frequency/3.md), [al\_get\_audio\_stream\_channels(3)](/al_get_audio_stream_channels/3.md), [al\_get\_audio\_stream\_depth(3)](/al_get_audio_stream_depth/3.md), [al\_get\_audio\_stream\_length(3)](/al_get_audio_stream_length/3.md)
