1 |
/* |
/* |
2 |
Copyright (c) 2014 Christian Schoenebeck |
Copyright (c) 2014-2015 Christian Schoenebeck |
3 |
|
|
4 |
This file is part of "gigedit" and released under the terms of the |
This file is part of "gigedit" and released under the terms of the |
5 |
GNU General Public License version 2. |
GNU General Public License version 2. |
97 |
* found with a range member point >= iStart |
* found with a range member point >= iStart |
98 |
*/ |
*/ |
99 |
static int findLowestRegionPoint(std::vector<gig::Instrument*>& instruments, int iStart) { |
static int findLowestRegionPoint(std::vector<gig::Instrument*>& instruments, int iStart) { |
100 |
DLS::range_t searchRange = { iStart, 127 }; |
DLS::range_t searchRange = { uint16_t(iStart), 127 }; |
101 |
int result = -1; |
int result = -1; |
102 |
for (uint i = 0; i < instruments.size(); ++i) { |
for (uint i = 0; i < instruments.size(); ++i) { |
103 |
gig::Instrument* instr = instruments[i]; |
gig::Instrument* instr = instruments[i]; |
119 |
* with a range end >= iStart |
* with a range end >= iStart |
120 |
*/ |
*/ |
121 |
static int findFirstRegionEnd(std::vector<gig::Instrument*>& instruments, int iStart) { |
static int findFirstRegionEnd(std::vector<gig::Instrument*>& instruments, int iStart) { |
122 |
DLS::range_t searchRange = { iStart, 127 }; |
DLS::range_t searchRange = { uint16_t(iStart), 127 }; |
123 |
int result = -1; |
int result = -1; |
124 |
for (uint i = 0; i < instruments.size(); ++i) { |
for (uint i = 0; i < instruments.size(); ++i) { |
125 |
gig::Instrument* instr = instruments[i]; |
gig::Instrument* instr = instruments[i]; |
195 |
iStart = findLowestRegionPoint(instruments, iStart); |
iStart = findLowestRegionPoint(instruments, iStart); |
196 |
if (iStart < 0) break; |
if (iStart < 0) break; |
197 |
const int iEnd = findFirstRegionEnd(instruments, iStart); |
const int iEnd = findFirstRegionEnd(instruments, iStart); |
198 |
DLS::range_t range = { iStart, iEnd }; |
DLS::range_t range = { uint16_t(iStart), uint16_t(iEnd) }; |
199 |
intersections.push_back(range); |
intersections.push_back(range); |
200 |
iStart = iEnd + 1; |
iStart = iEnd + 1; |
201 |
} |
} |
266 |
itNums != it->second.end(); ++itNums) |
itNums != it->second.end(); ++itNums) |
267 |
{ |
{ |
268 |
const int iUpperLimit = *itNums; |
const int iUpperLimit = *itNums; |
269 |
DLS::range_t range = { iLow, iUpperLimit }; |
DLS::range_t range = { uint16_t(iLow), uint16_t(iUpperLimit) }; |
270 |
dims[type].push_back(range); |
dims[type].push_back(range); |
271 |
iLow = iUpperLimit + 1; |
iLow = iUpperLimit + 1; |
272 |
} |
} |
383 |
gig::DimensionRegion* dimRgn2 = |
gig::DimensionRegion* dimRgn2 = |
384 |
rgn->pDimensionRegions[ (iDimRgn & mask) | ( z << iBaseBits) ]; |
rgn->pDimensionRegions[ (iDimRgn & mask) | ( z << iBaseBits) ]; |
385 |
int iHigh = dimRgn2->DimensionUpperLimits[iDimension]; |
int iHigh = dimRgn2->DimensionUpperLimits[iDimension]; |
386 |
DLS::range_t range = { iLow, iHigh}; |
DLS::range_t range = { uint16_t(iLow), uint16_t(iHigh) }; |
387 |
#if DEBUG_COMBINE_INSTRUMENTS |
#if DEBUG_COMBINE_INSTRUMENTS |
388 |
printf("%d..%d, ", iLow, iHigh); |
printf("%d..%d, ", iLow, iHigh); |
389 |
fflush(stdout); |
fflush(stdout); |