I'm working on an Android application that requires several MATLAB signal processing functions coded in C. The functions are to be run on the data from various WAV files. Over the past few days, I've come to the conclusion it would be much easier to run the signal processing on the rather large arrays by reading the WAV file into C, rather than on the Java side, and then feed Java the processed array via JNI. I have this working perfectly in Ubuntu with GCC by reading in the WAV file with the libsndfile library, and performing the filtering. Now my only obstacle is getting this to work in Android Studio, and that is a sizeable one, as I'm not quite sure if it's possible to get libsndfile to work in Studio.
I included the "sndfile.h" file in my project. While attempting to get some basic information from the WAV file and placing the data into an array:
/* Allocate space for the data to be read, then read it. */
buf = (double *) malloc(num_items*sizeof(double));
num = sf_readf_double(sf,buf,num_items);
sf_close(sf);
I get various undefined reference compile errors to sndfile functions, including undefined reference to 'sf_readf_double'.
Researching the issue, the fix seems to be linking against the libsnfile library. Is this even possible with an Android Studio environment?
I am not terribly experienced with C so this ignorance is probably compounding the issue. If anyone has any experience similarly including libraries in an Android Studio project or maybe can suggest a different approach, I'd sincerely appreciate it.