What I want to do:
I’ve found a C library which computes an audio stream’s pitch and want to use it in Android.
I thought instead of porting it I could also use it with the help of the NDK, right?
How does this work? I have to install the NDK, of course, and then? Can I call functions of this C library just as normal in Android?
The library in C that I want to “import”:
#include "second_c_file.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#ifndef max
#define max(x, y) ((x) > (y)) ? (x) : (y)
#endif
#ifndef min
#define min(x, y) ((x) < (y)) ? (x) : (y)
#endif
int _power2p(int value) {
...
}
typedef struct _minmax {
int index;
struct _minmax *next;
} minmax;
double _test_calculate(double * var1, int var2, int var3) {
...
}
The file “second_c_file.h” is another file that I need to import, obviously.
Thanks for your help!
A good tutorial for how to start working with the NDK can be found here. And yes, you should be able to get it to compile and call it from the NDK without many changes (assuming the code doesn’t reference other libraries).