本文整理汇总了C++中SignalProperties::ChannelUnit方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalProperties::ChannelUnit方法的具体用法?C++ SignalProperties::ChannelUnit怎么用?C++ SignalProperties::ChannelUnit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalProperties
的用法示例。
在下文中一共展示了SignalProperties::ChannelUnit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
LinearClassifier::Preflight( const SignalProperties& Input,
SignalProperties& Output ) const
{
// Determine the classifier matrix format:
int controlSignalChannels = 0;
const ParamRef& Classifier = Parameter( "Classifier" );
if( Classifier->NumColumns() != 4 )
bcierr << "Classifier parameter must have 4 columns "
<< "(input channel, input element, output channel, weight)"
<< endl;
else
{
for( int row = 0; row < Classifier->NumRows(); ++row )
{
if( Classifier( row, 2 ) < 1 )
bcierr << "Output channels must be positive integers"
<< endl;
float ch = Input.ChannelIndex( Classifier( row, 0 ) );
if( ch < 0 )
bcierr << DescribeEntry( row, 0 )
<< " points to negative input index"
<< endl;
else if( ::floor( ch ) > Input.Channels() )
bcierr << "Channel specification in "
<< DescribeEntry( row, 0 )
<< " exceeds number of input channels"
<< endl;
if( ::fmod( ch, 1.0f ) > 1e-2 )
bciout << "Channel specification in physical units: "
<< DescribeEntry( row, 0 )
<< " does not exactly meet a single channel"
<< endl;
float el = Input.ElementIndex( Classifier( row, 1 ) );
if( el < 0 )
bcierr << DescribeEntry( row, 1 )
<< " points to negative input index"
<< endl;
if( ::floor( el ) > Input.Elements() )
bcierr << "Element (bin) specification in "
<< DescribeEntry( row, 1 )
<< " exceeds number of input elements"
<< endl;
if( ::fmod( el, 1.0f ) > 1e-2 )
bciout << "Element (bin) specification in physical units: "
<< DescribeEntry( row, 1 )
<< " does not exactly meet a single element"
<< endl;
int outputChannel = Classifier( row, 2 );
controlSignalChannels = max( controlSignalChannels, outputChannel );
}
}
// Requested output signal properties.
Output = SignalProperties( controlSignalChannels, 1, Input.Type() );
// Output description.
Output.ChannelUnit() = Input.ChannelUnit();
Output.ValueUnit().SetRawMin( Input.ValueUnit().RawMin() )
.SetRawMax( Input.ValueUnit().RawMax() );
float secsPerBlock = Parameter( "SampleBlockSize" ) / Parameter( "SamplingRate" );
Output.ElementUnit().SetOffset( 0 ).SetGain( secsPerBlock ).SetSymbol( "s" );
int visualizationTime = Output.ElementUnit().PhysicalToRaw( "15s" );
Output.ElementUnit().SetRawMin( 0 ).SetRawMax( visualizationTime - 1 );
}