21 |
* MA 02111-1307 USA * |
* MA 02111-1307 USA * |
22 |
***************************************************************************/ |
***************************************************************************/ |
23 |
|
|
|
#include <vector> |
|
|
|
|
24 |
#include "RIFF.h" |
#include "RIFF.h" |
25 |
|
|
26 |
#include "SF.h" |
#include "SF.h" |
657 |
return regions[idx]; |
return regions[idx]; |
658 |
} |
} |
659 |
|
|
660 |
std::vector<Region*> InstrumentBase::GetRegionsOnKey(int key, uint8_t vel) { |
Query::Query(InstrumentBase& instrument) : instrument(instrument) { |
661 |
std::vector<Region*> v; |
i = 0; |
662 |
for (int i = 0; i < GetRegionCount(); i++) { |
} |
663 |
Region* r = GetRegion(i); |
|
664 |
if ( |
Region* Query::next() { |
665 |
((r->loKey == NONE && r->hiKey == NONE) || (key >= r->loKey && key <= r->hiKey)) && |
while (i < instrument.GetRegionCount()) { |
666 |
((r->minVel == NONE && r->maxVel == NONE) || (vel >= r->minVel && vel <= r->maxVel)) |
Region* r = instrument.GetRegion(i++); |
667 |
) { |
if (((r->loKey == NONE && r->hiKey == NONE) || (key >= r->loKey && key <= r->hiKey)) && |
668 |
v.push_back(r); |
((r->minVel == NONE && r->maxVel == NONE) || (vel >= r->minVel && vel <= r->maxVel))) { |
669 |
|
return r; |
670 |
} |
} |
671 |
} |
} |
672 |
|
return 0; |
|
return v; |
|
673 |
} |
} |
674 |
|
|
675 |
Instrument::Instrument(sf2::File* pFile, RIFF::Chunk* ck) : InstrumentBase(pFile) { |
Instrument::Instrument(sf2::File* pFile, RIFF::Chunk* ck) : InstrumentBase(pFile) { |