reactor-c
C Runtime for Lingua Franca
|
Utility function for reading WAV audio files. More...
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "wave_file_reader.h"
Data Structures | |
struct | lf_wav_riff_t |
struct | lf_wav_format_t |
struct | lf_wav_data_t |
struct | lf_wav_t |
Macros | |
#define | FILE_PATH_SEPARATOR '/'; |
Functions | |
lf_waveform_t * | read_wave_file (const char *path) |
Utility function for reading WAV audio files.
See wave_file_reader.h for instructions.
#define FILE_PATH_SEPARATOR '/'; |
lf_waveform_t * read_wave_file | ( | const char * | path | ) |
Open a wave file, check that the format is supported, allocate memory for the sample data, and fill the memory with the sample data. It is up to the caller to free the memory when done with it. That code should first free the waveform element of the returned struct, then the struct itself. This implementation supports only 16-bit linear PCM files. On a Mac, you can convert audio files into this format using the afconvert utility.
path | The path to the file. |