play_sample(3alleg)

play_sample3alleg

Plays a sample. allegro game programming library.

Usage

#include <allegro.h>

int play_sample(const SAMPLE *spl, int vol, int pan, int freq, int loop);

Overview

Triggers a sample at the specified volume, pan position, and frequency. The parameters `vol' and `pan' range from 0 (min/left) to 255 (max/right). Frequency is relative rather than absolute: 1000 represents the frequency that the sample was recorded at, 2000 is twice this, etc. If `loop' is not zero, the sample will repeat until you call stop_sample(), and can be manipulated while it is playing by calling adjust_sample(). Example:

   /* Scream from the left speaker, twice the freq. */
   int sound = play_sample(scream, 255, 0, 2000, 0);

Return value

Returns the voice number that was allocated for the sample or negative if no voices were available.

Releases

4 releases since Debian 3.1 (Sarge); the text changed 2 times.

  1. 3.1
  2. 4.0
  3. 5.0–6.0

From liballegro-doc 2:4.2.2-2.2 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.