al_create_audio_recorder - Allegro 5 API
#include <allegro5/allegro_audio.h> ALLEGRO_AUDIO_RECORDER *al_create_audio_recorder(size_t fragment_count,
unsigned int samples, unsigned int frequency,
ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf)
Creates an audio recorder using the system’s default recording device. (So if the returned device does not work, try updating the system’s default recording device.)
Allegro will internally buffer several seconds of captured audio with minimal latency. (XXX: These settings need to be exposed via config or API calls.) Audio will be copied out of that private buffer into a fragment buffer of the size specified by the samples parameter. Whenever a new fragment is ready an event will be generated.
The total size of the fragment buffer is fragment_count * samples * bytes_per_sample. It is treated as a circular, never ending buffer. If you do not process the information fast enough, it will be overrun. Because of that, even if you only ever need to process one small fragment at a time, you should still use a large enough value for fragment_count to hold a few seconds of audio.
frequency is the number of samples per second to record. Common values are:
- 8000 - telephone quality speech
- 44100 - CD quality music (if 16-bit, stereo)
For maximum compatibility, use a depth of ALLEGRO_AUDIO_DEPTH_UINT8 or ALLEGRO_AUDIO_DEPTH_INT16, and a single (mono) channel.
The recorder will not record until you start it with al_start_audio_recorder(3alleg5).
On failure, returns NULL.
[Unstable API]: The API may need a slight redesign.
|Allegro reference manual|