Detect active channel when plugging mono into stereo port


I’m using the getNextAudioBlock() callback from my AudioSource to both output and record my audio. The only issue I have is that when a user plugs a mono device (mike) into a stereo port, one of the channels is (logically) empty, but I don’t know which one beforehand. Is there a way for me to identify which channel is being used, so as to copy the data into the other channel of the buffer?

Thanks for your help.


If I understand you correctly, then I don’t think that’s something that even the audio hardware would be aware of (?)

That’s what I felt as well, but it seems some software manage to always find the channel that is playing.

Well, it’s easy enough to monitor the channels and pick the noisy one!

yes, I tried that, but it’s not very reliable, is it;-)

I think it’s highly unlikely it will change channels. The wiring of your audio input adaptor will determine what channel will be active when you plug a mono connector into it. If, for some reason, it’s a mono mic with a stereo connector (huh?) then it should also be consistent.

I’d guess the left channel (or maybe both) would be active.


Actually there are 2 types: one where there is a single stereo port, and another with 2 mono ports. I think in the case of the single port, the channels are either both fed, or only the 0. For dual mono ports it’s more of an issue, as it depends on which port the user plugs the mike. But then, when I plug a mono device on one of the entries of a stereo port, I can expect one to work and not the other.

I’ll stick to channel 0 for the moment, and will investigate if further when I have more time.

Thanks for your valuable help.