Audio device input channels

Hi,

I’m working with a virtual sound card that supports up to 64 channels and I’m trying to figure out how to list(print channel name) and process(pcm/fft) specific channels, in the code below the input node goes straight into the monitor, but I’d like to pass a specific channel instead. I’m also a bit confused about which channel the monitor uses by default.

dev = audio::Device::findDeviceByName( "Soundflower (2ch)" );
mInputDeviceNode = ctx->createInputDeviceNode( dev );    

auto monitorFormat = audio::MonitorNode::Format().windowSize( CinderEssentia::PcmSize );
mMonitorNode = ctx->makeNode( new audio::MonitorNode( monitorFormat ) );

mInputDeviceNode >> mMonitorNode;

mInputDeviceNode->enable();
ctx->enable();

console() << "DEVICE channels: " << dev->getNumInputChannels() << endl; // this works fine
console() << "inputs num: " << mInputDeviceNode->getInputs().size() << endl; // returns 0?
console() << "outputs num: " << mInputDeviceNode->getOutputs().size() << endl; // returns 0?

Hey Andrea, do a search for ChannelRouterNode on either the forum or the audio guide. There’s lots of good info on how to do this out there.

Cheers,
Rich

Hi Rich,

thanks for that, it makes sense.

When I just pipe a node without routing, does it process all channels by default?

I was also wondering whether the channel is only identified by the index or can also have a label?
I’m using virtual sound cards and I thought I could label the channels and so get the label in cinder.

When I just pipe a node without routing, does it process all channels by default?

It depends, some Nodes can only handle a single channel so they down-mix (like MonitorNodes although that may eventually change), but most adapt to their input. They actually follow the Node::ChannelMode setting and mixing happens automatically between inputs, so you have the ability to tell the Node how it should handle mismatched channel counts with its inputs. I’ve tried to document what the default is for all the Nodes in ci::audio.

I was also wondering whether the channel is only identified by the index or can also have a label?
I’m using virtual sound cards and I thought I could label the channels and so get the label in cinder.

No per-channel labels. I’m not sure if I would want to use strings as an alternative way to look up channels. Maybe this is something you could keep in a vector alongside your Node?