PDA

View Full Version : portaudio


elmick
April 16th, 2008, 07:44 AM
Hi,

Im trying desperatly to get portaudio working so i can write audio programs. Im trying the tutorial from
http://www.portaudio.com/trac/wiki/TutorialDir/Compile/Linux to compile a simple test program. I can write ok programs but dont know a lot about linking, libraries etc. I tried this:

mick@mick-laptop:~/audioprog$ gcc -lrt -lpthread -o testsaw patest_saw.c libportaudio.a
libportaudio.a(pa_unix_util.o): In function `PaUnixThread_New':
/home/mick/portaudio/src/os/unix/pa_unix_util.c:338: undefined reference to `floor'
libportaudio.a(pa_unix_oss.o): In function `PaOssStream_Configure':
/home/mick/portaudio/src/hostapi/oss/pa_unix_oss.c:1151: undefined reference to `ceil'
collect2: ld returned 1 exit status



Then When I try to include alsa:
mick@mick-laptop:~/audioprog$ gcc -lalsa -lrt -lpthread -o testsaw patest_saw.c libportaudio.a

/usr/bin/ld: cannot find -lalsa

I dont know much about alsa or oss either,

Can anyone help?

Thanks,
Mick.

jaddle
April 16th, 2008, 09:16 AM
You'll need -lm (math) first of all, in order to use floor and ceil. A quick 'man floor' will show that it's in that library.

The alsa error is probably just because you don't have the libalsa-dev package installed. But that said, you shouldn't need it to compile portaudio programs. Portaudio itself is linked with alsa, so you don't need to do it yourself (unless you also use some alsa calls directly, but that kind of defeats the purpose of portaudio!)

elmick
April 16th, 2008, 09:40 AM
Hi,

Thanks a lot, thats it working!. ok i get you mean about libalsa aswell

Cheers,
Mick.