-
The play_file function plays an audio file. It has the following prototype.
int play_file(char *filename);
The play_file outputs the audio file specified by filename to the audio device, assuming that the speaker has already been opened. If successful, play_file returns the total number of bytes output. If unsuccessful , play_file returns 1 and sets errno .
-
The record_file function saves incoming audio data to a disk file. It has the following prototype.
int record_file(char *filename, int seconds);
The record_file function saves audio information for a time interval of seconds in the file given by filename , assuming that the microphone has already been opened. If successful, record_file returns the total number of bytes recorded. If unsuccessful, record_file returns 1 and sets errno .
-
The get_record_sample_rate function determines the sampling rate for recording. It has the following prototype.
int get_record_sample_rate(void);
If successful, get_record_sample_rate returns the sampling rate for recording. If unsuccessful, get_record_sample_rate returns 1 and sets errno .
-
The get_play_buffer_size returns the buffer size that the audio device driver uses to transfer information to the audio output device. It has the following prototype.
int get_play_buffer_size(void);
If successful, get_play_buffer_size returns the buffer size for recording. If unsuccessful, get_play_buffer_size returns 1 and sets errno .
-
The get_play_sample_rate function determines the sampling rate for playing. It has the following prototype.
int get_play_sample_rate(void);
If successful, get_play_sample_rate returns the sampling rate used for playing audio files on the speaker. If unsuccessful, get_play_sample_rate returns 1 and sets errno . A rate of 8000 samples/second is considered voice quality.
-
The set_play_volume function changes the volume at which sound plays on the speaker. It has the following prototype.
int set_play_volume(double volume);
The set_play_volume sets the gain on the speaker. The volume must be between 0.0 and 1.0. If successful, set_play_volume returns 0. If unsuccessful, set_play_volume returns 1 and sets errno .
-
The set_record_volume function changes the volume of incoming sound from the microphone. It has the following prototype.
int set_record_volume(double volume);
The set_record_volume function sets the gain on the microphone. The volume value must be between 0.0 and 1.0. If successful, set_record_volume returns 0. If unsuccessful, it returns 1 and sets errno .