本文整理汇总了C++中Dimensions::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Dimensions::end方法的具体用法?C++ Dimensions::end怎么用?C++ Dimensions::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dimensions
的用法示例。
在下文中一共展示了Dimensions::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: combineInstruments
/** @brief Combine given list of instruments to one instrument.
*
* Takes a list of @a instruments as argument and combines them to one single
* new @a output instrument. For this task, it will create a dimension of type
* given by @a mainDimension in the new instrument and copies the source
* instruments to those dimension zones.
*
* @param instruments - (input) list of instruments that shall be combined,
* they will only be read, so they will be left untouched
* @param gig - (input/output) .gig file where the new combined instrument shall
* be created
* @param output - (output) on success this pointer will be set to the new
* instrument being created
* @param mainDimension - the dimension that shall be used to combine the
* instruments
* @throw RIFF::Exception on any kinds of errors
*/
static void combineInstruments(std::vector<gig::Instrument*>& instruments, gig::File* gig, gig::Instrument*& output, gig::dimension_t mainDimension) {
output = NULL;
// divide the individual regions to (probably even smaller) groups of
// regions, coping with the fact that the source regions of the instruments
// might have quite different range sizes and start and end points
RegionGroups groups = groupByRegionIntersections(instruments);
#if DEBUG_COMBINE_INSTRUMENTS
std::cout << std::endl << "New regions: " << std::flush;
printRanges(groups);
std::cout << std::endl;
#endif
if (groups.empty())
throw gig::Exception(_("No regions found to create a new instrument with."));
// create a new output instrument
gig::Instrument* outInstr = gig->AddInstrument();
outInstr->pInfo->Name = _("NEW COMBINATION");
// Distinguishing in the following code block between 'horizontal' and
// 'vertical' regions. The 'horizontal' ones are meant to be the key ranges
// in the output instrument, while the 'vertical' regions are meant to be
// the set of source regions that shall be layered to that 'horizontal'
// region / key range. It is important to know, that the key ranges defined
// in the 'horizontal' and 'vertical' regions might differ.
// merge the instruments to the new output instrument
for (RegionGroups::iterator itGroup = groups.begin();
itGroup != groups.end(); ++itGroup) // iterate over 'horizontal' / target regions ...
{
gig::Region* outRgn = outInstr->AddRegion();
outRgn->SetKeyRange(itGroup->first.low, itGroup->first.high);
#if DEBUG_COMBINE_INSTRUMENTS
printf("---> Start target region %d..%d\n", itGroup->first.low, itGroup->first.high);
#endif
// detect the total amount of zones required for the given main
// dimension to build up this combi for current key range
int iTotalZones = 0;
for (RegionGroup::iterator itRgn = itGroup->second.begin();
itRgn != itGroup->second.end(); ++itRgn)
{
gig::Region* inRgn = itRgn->second;
gig::dimension_def_t* def = inRgn->GetDimensionDefinition(mainDimension);
iTotalZones += (def) ? def->zones : 1;
}
#if DEBUG_COMBINE_INSTRUMENTS
printf("Required total zones: %d, vertical regions: %d\n", iTotalZones, itGroup->second.size());
#endif
// create all required dimensions for this output region
// (except the main dimension used for separating the individual
// instruments, we create that particular dimension as next step)
Dimensions dims = getDimensionsForRegionGroup(itGroup->second);
// the given main dimension which is used to combine the instruments is
// created separately after the next code block, and the main dimension
// should not be part of dims here, because it also used for iterating
// all dimensions zones, which would lead to this dimensions being
// iterated twice
dims.erase(mainDimension);
{
std::vector<gig::dimension_t> skipTheseDimensions; // used to prevent a misbehavior (i.e. crash) of the combine algorithm in case one of the source instruments has a dimension with only one zone, which is not standard conform
for (Dimensions::iterator itDim = dims.begin();
itDim != dims.end(); ++itDim)
{
gig::dimension_def_t def;
def.dimension = itDim->first; // dimension type
def.zones = itDim->second.size();
def.bits = zoneCountToBits(def.zones);
if (def.zones < 2) {
addWarning(
"Attempt to create dimension with type=0x%x with only "
"ONE zone (because at least one of the source "
"instruments seems to have such a velocity dimension "
"with only ONE zone, which is odd)! Skipping this "
"dimension for now.",
(int)itDim->first
);
skipTheseDimensions.push_back(itDim->first);
continue;
}
//.........这里部分代码省略.........