MCPcopy Create free account
hub / github.com/cinder/Cinder / InputDeviceNode

Method InputDeviceNode

src/cinder/audio/InputNode.cpp:58–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56// ----------------------------------------------------------------------------------------------------
57
58InputDeviceNode::InputDeviceNode( const DeviceRef &device, const Format &format )
59 : InputNode( format ), mDevice( device ), mLastOverrun( 0 ), mLastUnderrun( 0 )
60{
61 if( ! mDevice ) {
62 string errorMsg = "Empty DeviceRef.";
63 if( ! audio::Device::getDefaultInput() )
64 errorMsg += " Also, no default input Device so perhaps there is no available hardware input.";
65
66 throw AudioDeviceExc( errorMsg );
67 }
68
69 size_t deviceNumChannels = mDevice->getNumInputChannels();
70
71 // If number of channels hasn't been specified, default to 2.
72 if( getChannelMode() != ChannelMode::SPECIFIED ) {
73 setChannelMode( ChannelMode::SPECIFIED );
74 setNumChannels( std::min( deviceNumChannels, (size_t)2 ) );
75 }
76
77 // TODO: this doesn't always mean a failing cause, need Device::supportsNumInputChannels( mNumChannels ) to be sure
78 // - on iOS, the RemoteIO audio unit can have 2 input channels, while the AVAudioSession reports only 1 input channel.
79// if( deviceNumChannels < mNumChannels )
80// throw AudioFormatExc( string( "Device can not accommodate " ) + to_string( deviceNumChannels ) + " output channels." );
81}
82
83InputDeviceNode::~InputDeviceNode()
84{

Callers

nothing calls this directly

Calls 3

getChannelModeFunction · 0.85
minFunction · 0.50
getNumInputChannelsMethod · 0.45

Tested by

no test coverage detected