本文整理汇总了C++中PartList::add方法的典型用法代码示例。如果您正苦于以下问题:C++ PartList::add方法的具体用法?C++ PartList::add怎么用?C++ PartList::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartList
的用法示例。
在下文中一共展示了PartList::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: partMap
PartMap PartList::partMap(MidiTrack* track)
{
PartMap pmap;
PartList* list = new PartList;
for (iPart i = begin(); i != end(); ++i)
{
if (i->second->track() == track)
{
list->add(i->second);
}
}
pmap.track = track;
pmap.parts = list;
return pmap;
}
示例2: processTrack
void LOS::processTrack(MidiTrack* track)
{
EventList* tevents = track->events();
if (tevents->empty())
return;
//---------------------------------------------------
// Identify Parts
// The MIDI tracks are broken up into parts
// A new Part will be located based on track.
// Events will be aligned on new track
//---------------------------------------------------
PartList* pl = track->parts();
int lastTick = 0;
for (iEvent i = tevents->begin(); i != tevents->end(); ++i)
{
Event event = i->second;
int epos = event.tick() + event.lenTick();
if (epos > lastTick)
lastTick = epos;
}
QString partname = track->name();
int len = song->roundUpBar(lastTick + 1);
// p3.3.27
if (config.importMidiSplitParts)
{
int bar2, beat;
unsigned tick;
sigmap.tickValues(len, &bar2, &beat, &tick);
int lastOff = 0;
int st = -1; // start tick current part
int x1 = 0; // start tick current measure
int x2 = 0; // end tick current measure
for (int bar = 0; bar < bar2; ++bar, x1 = x2)
{
///x2 = sigmap.bar2tick(bar+1, 0, 0);
x2 = sigmap.bar2tick(bar + 1, 0, 0);
if (lastOff > x2)
{
// this measure is busy!
continue;
}
iEvent i1 = tevents->lower_bound(x1);
iEvent i2 = tevents->lower_bound(x2);
if (i1 == i2)
{ // empty?
if (st != -1)
{
MidiPart* part = new MidiPart(track);
part->setTick(st);
part->setLenTick(x1 - st);
// printf("new part %d len: %d\n", st, x1-st);
part->setName(partname);
pl->add(part);
st = -1;
}
}
else
{
if (st == -1)
st = x1; // begin new part
//HACK:
//lastOff:
for (iEvent i = i1; i != i2; ++i)
{
Event event = i->second;
if (event.type() == Note)
{
int off = event.tick() + event.lenTick();
if (off > lastOff)
lastOff = off;
}
}
}
}
if (st != -1)
{
MidiPart* part = new MidiPart(track);
part->setTick(st);
// printf("new part %d len: %d\n", st, x2-st);
part->setLenTick(x2 - st);
part->setName(partname);
pl->add(part);
}
}
else
{
// Just one long part...
MidiPart* part = new MidiPart(track);
//part->setTick(st);
part->setTick(0);
part->setLenTick(len);
//.........这里部分代码省略.........