Openframeworks with linux/jack

hallo together,

has someone managed to manage audioconection from of via jack audio conection kit?
i read that the new rtaudio version uses jack instead of alsa, but my of apps dont get visible in jack. what am i doing wrong? any ideas?

You can use rtAudio with Jack. You just need to be able to select an audio device by ID, because OF just selects the default sound card. There’s some code floating around the forum that does this…or its pretty easy to do ti yourself if you look at the rtAudio code.

So then you just start up Jack, then run your OF app and list the audio devices available. Choose the device ID that corresponds to Jack (it should be pretty obvious), then use that ID in your code to setup the Jack audio device. There should be a more elegant way to do this in the future, but this should work for the moment.

Indeed the version of rtaudio in OF is compiled without jack support to make the distribution lighter. To use jack you need to compile rtaudio with jack support and add this setting to the compiler in your projects

-D UNIX_JACK

thanks for your replies,

i am wondering that ofSoundStreamEnumerateDevices() dont works.
i will try to compile with jack. maybe i am successfull :slight_smile:

i can define jack in rtaudio.h but changes nothing! any ideas?

download rtAudio and in the console type:

./configure --help

it will tell you all the options. i think by default it compiles with jack support if jack is installed in the system if not it should be something like:

./configure --with-jack

to install jack development files:

sudo apt-get install libjack-dev

and to compile rtAudio, inside the downloaded directory:

make

sorry for my silly question yesterday. some hours ago i did exactly what you wrote above. i was realy tired. thanks for that. everything is fine but when i use the flagg -D UNIX_JACK i get a bunch of errors. and it tries to compile asio drivers???

i copied the files from rtaudio wich i had compiled to the of libs folder and told my codeblocks project where to find and aslo i old the linker and compiler. is this the right way?

sorry, the correct flag is:

  
-D__UNIX_JACK__  

hey,

thanks this flag worked now.
i compiled and packed rtAudio and put it should be, but then i get new compilibng errors.
seems that i am missing some libraries???

here is an excerpt:

  
  
||=== audioOutputExample, Debug ===|  
../../../libs/rtAudio/lib/linux/libRtAudio.a(RtAudio.o)||In function `RtApiJack::getDeviceCount()':|  
RtAudio.cpp|| undefined reference to `jack_client_open'|  
RtAudio.cpp|| undefined reference to `jack_get_ports'|  
RtAudio.cpp|| undefined reference to `jack_client_close'|  
../../../libs/rtAudio/lib/linux/libRtAudio.a(RtAudio.o)||In function `RtApiJack::RtApiJack()':|  
RtAudio.cpp|| undefined reference to `jack_set_error_function'|  
  

and so on.
do you have an idea what the problem could solve?

jack dev files are installed.

yes, in the linker settings of your project you need to add the jack library. in codeblocks, project > properties > project build options > linker settings

and there in link libraries press add, and add jack

oh yes thanks. i never before used installed libs from my linux. nice way to do that.
now everything compiles good. but the ofsoundstream example quits with a segmentation fault

is this a known issue? any ideas?

jack outputs the folloeing after i start the of programm.

  
13:58:03.361 XRUN callback (3).  
subgraph starting at qjackctl timed out (subgraph_wait_fd=16, status = 0, state = Running, pollret = 0 revents = 0x0)  
bad status (1) for client RtApiJack handling event (type = 8)  
**** alsa_pcm: xrun of at least 1.142 msecs  

i tried to switch between different options in jack but nothing changed.
maybe this is a ubuntu 10.04 problem.

don’t know for sure, haven’t used jack that much, but it seems your getting buffer underruns, try using higher buffer sizes or setting real time priority.

Yes try as arturo suggested using higher buffer sizes. To run at real-time priority, follow the suggestions here:
https://help.ubuntu.com/community/Ubunt-…-035084534a
Look under ‘Configuring the real-time access for “audio” group users and applications’

hey together,

thanks for the infos. i needed some time to realize all the real time changes to my system.
but now it is done. i am in the audio group installed severel packes but still get this error

  
  
Segmentation fault  
Process returned 139 (0x8B) execution time:............a.s.o.  
  

i can run rtaudio or the stk examples without any problems.
i also tried to increase the buffer sice via ofSoundStreamSetup(…) but this also has no effects.
i dont know how to solve.

is that with the plain audioOutputExample? can you debug your application to see in what line is it crashing

it is the normal audioOutputExample, if jack isnt running i get no error but no sound. if jack runs i get the error. i am in holliday for a time now. when i am back i will try it with a fresh mind. thanks for your help.

i tried all stuff with a new unpacked of version on an other machine. but i got the same errors. i am not good in debugging. but if i uncomment ofSoundStramSetup i get no error but also no sound. du you guys work with codeblocks? where do you add the compiler command -D__UNIX_JACK__ ? i added it under settings - compiler and debugger settings - other settings - advanced options. i added it to the end of the variables.
i realized that it dont changes anything if i dont add the command. maybe i try the wrong command at the wrong place?

Can you upload your project and the library that you compiled with jack support so i can take a look

hey arturo sure i can,

here are the files:
http://www.m4307.de/audioOutputExample.tar.gz
http://www.m4307.de/rtAudio.tar.gz

i hope i only have a problem with the rtAudioLib file, maybe you can test mine to see if you get same errors. thanks a lot.