al_set_sample(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸŽ€ NAME πŸŽ€

al_set_sample β€” Allegro 5 API. She's hanging out in the Library Functions Manual, sourced from the Allegro reference manual, and she's here to change the sample data that a sample instance plays. Lowkey more involved than it sounds, bestie.

✨ SYNOPSIS ✨

#include <allegro5/allegro_audio.h>

bool al_set_sample(ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_SAMPLE *data)

πŸ’– DESCRIPTION πŸ’–

Okay so al_set_sample swaps out the sample data that a sample instance plays. This can be quite an involved process, and here's the whole sequence, no skipped steps:

  1. First, the sample is stopped if it is not already. πŸ›‘
  2. Next, if data is NULL, the sample is detached from its parent (if any). 🫢
  3. If data is not NULL, the sample may be detached and reattached to its parent (if any). This is not necessary if the old sample data and new sample data have the same frequency, depth and channel configuration. Reattaching may not always succeed. πŸ™ˆ

On success, the sample remains stopped. The playback position and loop end points are reset to their default values. The loop mode remains unchanged. ✨

Returns true on success, false on failure. On failure, the sample will be stopped and detached from its parent. πŸ’€

Bestie, keep that failure state in mind: it's stopped and detached from its parent, periodt.

πŸ¦‹ SEE ALSO πŸ¦‹


πŸ’– xoxo, bestie β€” source: Allegro reference manual; footer stamp: al_set_sample(3); no separate date/version line listed, so that's the whole cute sign-off. πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms