1SAMPLE(3) Allegro manual SAMPLE(3)
2
3
4
6 SAMPLE - Stores sound data. Allegro game programming library.
7
9 #include <allegro.h>
10
11
12 typedef struct SAMPLE
13
15 int bits; - 8 or 16
16 int stereo; - sample type flag
17 int freq; - sample frequency
18 int priority; - 0-255
19 unsigned long len; - length (in samples)
20 unsigned long loop_start; - loop start position
21 unsigned long loop_end; - loop finish position
22 void *data; - raw sample data
23
24 A sample structure, which holds sound data, used by the digital sample
25 routines. You can consider all of these fields as read only except pri‐
26 ority, loop_start and loop_end, which you can change them for example
27 after loading a sample from disk.
28
29 The priority is a value from 0 to 255 (by default set to 128) and con‐
30 trols how hardware voices on the sound card are allocated if you
31 attempt to play more than the driver can handle. This may be used to
32 ensure that the less important sounds are cut off while the important
33 ones are preserved.
34
35 The variables loop_start and loop_end specify the loop position in sam‐
36 ple units, and are set by default to the start and end of the sample.
37
38 If you are creating your own samples on the fly, you might also want to
39 modify the raw data of the sample pointed by the data field. The sample
40 data are always in unsigned format. This means that if you are loading
41 a PCM encoded sound file with signed 16-bit samples, you would have to
42 XOR every two bytes (i.e. every sample value) with 0x8000 to change the
43 signedness.
44
45
47 load_sample(3), exsample(3)
48
49
50
51Allegro version 4.2.2 SAMPLE(3)