#include "src/audio.h" #include #define CHANNELS 1 #define SAMPLE_RATE 48000 #define FRAMES_PER_BUFFFER 960 #define AUDIO_BUF_SIZE (FRAMES_PER_BUFFFER) #define LEN_SEC 5 int main(int argc, char **argv) { (void)argc; (void)argv; audio_init_soundsystem(); audio_t a; audio_sample_t aud_buf[FRAMES_PER_BUFFFER] = {0}; audio_init_default(&a, CHANNELS, SAMPLE_RATE, FRAMES_PER_BUFFFER); audio_stream_input_toggle(&a); audio_stream_output_toggle(&a); const size_t ii = (LEN_SEC * SAMPLE_RATE)/FRAMES_PER_BUFFFER; for (size_t i = 0; i < ii; ++i) { audio_read(&a, aud_buf, FRAMES_PER_BUFFFER); audio_write(&a, aud_buf, FRAMES_PER_BUFFFER); } audio_stream_input_toggle(&a); audio_stream_output_toggle(&a); audio_terminate_soundsystem(); return 0; }