C headers
alex-tee opened this issue ยท 23 comments
I will most likely start sending some C headers (I need to write some to use this in my project anyway), but just opening this issue so you're aware
Okay, waiting for pull requests.
Reviewing your changes: maybe add possibility to build plugins in C mode without namespaces? There are many global variables which actually are pointing to the right function after calling dsp::init().
not sure exactly what you mean. you mean make separate plugins for pmath, resampling, search, etc? I'm not very good with C++/Makefiles, so if you could lay the foundation i can work on just converting the API to C and adding it wherever you want me to
I mean, I can provide C-compatible header <cdsp.h> and lsp_dsp_lib_ prefixed functions and variables (function pointers) for the C application. But this requires to do a bit.
I don't think it's necessary. If you could do that somehow automatically then yeah, but if it involves a lot of manual work then I think my current way of doing things is good enough. I've seen other libraries do it similarly (like RtAudio https://github.com/thestk/rtaudio/blob/master/rtaudio_c.h )
I am using the lsp_dsp_
prefix now (corresponding to lsp::dsp::
. I think the lib
part is not really adding anything
I almost completed porting
There are just couple of things to do
oh sweet! ok, i'll be on standby
Pushed set of changes to github-issue-2 branch. Please check.
Now binaries export both lsp::dsp:: and lsp_dsp_ symbols and headers are corrected to support C compiler.
something seems wrong:
starting phase `install'
make lsp-common-lib.o
ld [lsp-dsp-lib] lsp-dsp-lib.o
g++ [lsp-dsp-lib] lsp-dsp-lib-0.5.5.so
Installing lsp-dsp-lib
mkdir: cannot create directory โ/usrโ: Permission denied
make[1]: *** [Makefile:156: install] Error 1
make: *** [Makefile:27: install] Error 2
command "make" "install" "PREFIX=/gnu/store/5vvifhjbzmq239w0kfx39zjr8m99p6kh-lsp-dsp-lib-zrythm-0.5.4-1" "CC=gcc" failed with status 2
I am passing PREFIX but it still tries to install something under /usr
? I didn't have this problem on 0.5.4
nevermind, I'm supposed to pass it when I do make config PREFIX=....
not on make install
the C API seems to work! great!
Architecture: x86_64
Processor: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Model: vendor=Intel, family=0x6, model=0x3c
Features: FPU CMOV MMX FXSAVE SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 XSAVE FMA3 AVX AVX2
No, you need to specify prefix when running config:
make config PREFIX=<bla-bla-bla>
so far it seems to work great. I think the structs should be prefixed too since info_t
for example is a common name and can clash with other symbols easily.
Also wondering, am I supposed to do lsp_dsp_start() and lsp_dsp_finish() on every invocation? or do I just do that when my program (DAW) starts and ends?
lsp_dsp_start() should be called in each thread before audio processing starts. After audio processing ends, lsp_dsp_finish() should be called. It's not heavy call, it just tunes MXCSR register settings for x86 and FPCR register for ARM.
Yes, I will add prefixes to data types today
ah ok, thanks. so I'll call it when i initialize my DSP threads and call finish() before they exit.
@alex-tee it seems that there are no more changes required to do with C interface?
I suppose the branch can be merged into devel now.
Removed github-issue-2 branch, merged changes into master. Released lsp-dsp-lib-0.5.5 tag.
thanks!