本文整理汇总了C++中Channels::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Channels::size方法的具体用法?C++ Channels::size怎么用?C++ Channels::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channels
的用法示例。
在下文中一共展示了Channels::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unifiedLength
unsigned unifiedLength(Channels &a)
{
unsigned len=0;
for(unsigned c=0;c<a.size();c++)
if(a[c].size()>len)
len=a[c].size();
for(unsigned c=0;c<a.size();c++)
if(a[c].size()<len)
a[c]=a[c].resizeTo(len);
return len;
}
示例2: unifiedSamplerate
unsigned unifiedSamplerate(Channels &a)
{
unsigned samplerate=0;
for(unsigned c=0;c<a.size();c++)
if(a[c].samplerate()>samplerate)
samplerate=a[c].samplerate();
for(unsigned c=0;c<a.size();c++)
if(a[c].samplerate()<samplerate)
a[c]=a[c].resampleTo(samplerate);
return samplerate;
}
示例3: ServosToControls
// Step through list of controls reading the servo channel, calculating new position
// and setting either a surface or engine(s) to the value
void ServosToControls(void)
{
int iIndex = 0;
int iSize = ControlSurfaces.size();
int iServoChannel;
intbb ServoValue;
float ControlSetting;
ChannelSetup* pScanSetup;
for (iIndex = 0; iIndex < iSize; iIndex++)
{
pScanSetup = &ControlSurfaces[iIndex];
iServoChannel = pScanSetup->mServoChannel;
ServoValue._.B1 = SERVO_IN[2*iServoChannel];
ServoValue._.B0 = SERVO_IN[(2*iServoChannel)+1];
ControlSetting = pScanSetup->GetControlDeflection(ServoValue.BB);
if (pScanSetup->mControlType == CONTROL_TYPE_SURFACE)
{
XPLMSetDataf(pScanSetup->mControlSurfaceRef, ControlSetting);
}
else if (pScanSetup->mControlType == CONTROL_TYPE_ENGINE)
{
unsigned int Mask = pScanSetup->mEngineMask;
for (int Engine = 0; Engine < 8; Engine++)
{
if ((Mask & 0x01) != 0)
{
ThrottleSettings[Engine] = ControlSetting;
}
Mask >>= 1;
}
if (ControlSetting > PARKBRAKE_THROTTLE_THRESHOLD) // if engine is throttled-up above threshold..
{
BrakeSetting = PARKBRAKE_OFF; // remove parkbrake
}
else
{
BrakeSetting = PARKBRAKE_ON; // apply parkbrake
}
}
}
示例4: ServosToControls
// Step through list of controls reading the servo channel, calculating new position
// and setting either a surface or engine(s) to the value
void ServosToControls()
{
int iIndex = 0;
int iSize = ControlSurfaces.size();
int iServoChannel;
intbb ServoValue;
int Value;
float ControlSetting;
ChannelSetup* pScanSetup;
for(iIndex = 0; iIndex < iSize; iIndex++)
{
pScanSetup = &ControlSurfaces[iIndex];
iServoChannel = pScanSetup->mServoChannel;
ServoValue._.B1 = SERVO_IN[2*iServoChannel];
ServoValue._.B0 = SERVO_IN[(2*iServoChannel)+1];
ControlSetting = pScanSetup->GetControlDeflection(ServoValue.BB);
if(pScanSetup->mControlType == CONTROL_TYPE_SURFACE)
{
XPLMSetDataf(pScanSetup->mControlSurfaceRef, ControlSetting);
}
else if(pScanSetup->mControlType == CONTROL_TYPE_ENGINE)
{
unsigned int Mask = pScanSetup->mEngineMask;
for (int Engine = 0; Engine < 8; Engine++)
{
if( (Mask & 0x01) != 0 )
{
ThrottleSettings[Engine] = ControlSetting;
}
Mask >>= 1;
}
}
}