I'm scratching my head...partly because the build and linking process is still a mystery to me 🙂
Here is the shortest I can cut down the problem, and maybe somebody can point me toward the kinds of things I should be doing to get it to work. It might be that I should wrap the code up into a class or something, but this really should work if I have the correct compiler flags:
External file, flange.h:
typedef struct tflanger_t {
.
.
.
} tflanger;
.
.
.
tflanger* tflanger_init (tflanger*, float, float); //provide maximum delay time and the sample rate
void tflanger_tick(tflanger*, int , float*); //main processing routine. Returns output in the same buffer
.
.
.
Then render.cpp:
void render(BelaContext *context, void *userData)
{
format_audio_buffer(context, samples, 0);
tflanger_tick(delayline, nframes, samples);
for(unsigned int n = 0; n < context->audioFrames; n++) {
audioWrite(context, n, 0, samples[n]);
audioWrite(context, n, 1, samples[n]);
}
}
Everything compiles successfully, but linker fails:
/root/Bela/projects/MultiDelay/build/render.o: In function `render(BelaContext*, void*)':
/root/Bela/projects/MultiDelay/render.cpp:(.text+0xd0): undefined reference to `tflanger_tick(tflanger_t*, int, float*)'
In the project build directory are all of the *.o files I would expect to see but perhaps the linker is not looking here?
Any help appreciated. Thanks.