Line in (audio thru)

Hello I’m wondering how to open a different audio input and audio output to make a line thru in my software.
So I can listen to the line in in speakers.

Hi, it’s really simple.
Check this


unless you are on iOS both in and out callbacks happen in the same thread so you shouldn’t even need the mutex

Thank you @roymacdonald and @arturo for the quick answer.
It runs but no audio out.
Often a warning is shown:

[warning] ofRtAudioSoundStream: stream over/underflow detected

I suppose I have to setup a different device for input (line in) and output (audio out)
but I’m not sure how to do that.

you shouldn’t need different devices for audio in/out, it’s actually better if it’s the same as everything will happen in the same thread and you don’t need to sync between them. try to plot the input buffer to see if it actually contains anything.

Thanks @arturo. nice tip about plotting, it is actually working but it is getting the microphone instead of line in. Is there a way of selecting line (other than through system preferences) ?