1al_create_audio_recorder(3) al_create_audio_recorder(3)
2
3
4
6 al_create_audio_recorder - Allegro 5 API
7
9 #include <allegro5/allegro_audio.h>
10
11 ALLEGRO_AUDIO_RECORDER *al_create_audio_recorder(size_t fragment_count,
12 unsigned int samples, unsigned int frequency,
13 ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf)
14
16 Creates an audio recorder using the system's default recording device.
17 (So if the returned device does not work, try updating the system's de‐
18 fault recording device.)
19
20 Allegro will internally buffer several seconds of captured audio with
21 minimal latency. (XXX: These settings need to be exposed via config or
22 API calls.) Audio will be copied out of that private buffer into a
23 fragment buffer of the size specified by the samples parameter. When‐
24 ever a new fragment is ready an event will be generated.
25
26 The total size of the fragment buffer is fragment_count * samples *
27 bytes_per_sample. It is treated as a circular, never ending buffer.
28 If you do not process the information fast enough, it will be overrun.
29 Because of that, even if you only ever need to process one small frag‐
30 ment at a time, you should still use a large enough value for frag‐
31 ment_count to hold a few seconds of audio.
32
33 frequency is the number of samples per second to record. Common values
34 are:
35
36 · 8000 - telephone quality speech
37
38 · 11025
39
40 · 22050
41
42 · 44100 - CD quality music (if 16-bit, stereo)
43
44 For maximum compatibility, use a depth of ALLEGRO_AUDIO_DEPTH_UINT8 or
45 ALLEGRO_AUDIO_DEPTH_INT16, and a single (mono) channel.
46
47 The recorder will not record until you start it with al_start_au‐
48 dio_recorder(3).
49
50 On failure, returns NULL.
51
53 5.1.1
54
55 [Unstable API]: The API may need a slight redesign.
56
57
58
59Allegro reference manual al_create_audio_recorder(3)