本文整理汇总了C++中MidiTrack::cparts方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiTrack::cparts方法的具体用法?C++ MidiTrack::cparts怎么用?C++ MidiTrack::cparts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiTrack
的用法示例。
在下文中一共展示了MidiTrack::cparts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: chainTrackParts
void chainTrackParts(MidiTrack* t, bool incRefCount)/*{{{*/
{
PartList* pl = t->parts();
for (iPart ip = pl->begin(); ip != pl->end(); ++ip)
{
Part* p = ip->second;
chainCheckErr(p);
// Do we want to increase the reference count?
if (incRefCount)
p->events()->incARef(1);
// Added by Tim. p3.3.6
//printf("chainTrackParts track %p %s part %p %s evlist %p\n", t, t->name().toLatin1().constData(), p, p->name().toLatin1().constData(), p->cevents());
Part* p1 = 0;
// Look for a part with the same event list, that we can chain to.
// It's faster if track type is known...
{
MidiTrack* mt = 0;
MidiTrackList* mtl = song->midis();
for (ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
{
mt = *imt;
const PartList* pl = mt->cparts();
for (ciPart ip = pl->begin(); ip != pl->end(); ++ip)
{
// Added by Tim. p3.3.6
//printf("chainTrackParts track %p %s part %p %s evlist %p\n", mt, mt->name().toLatin1().constData(), ip->second, ip->second->name().toLatin1().constData(), ip->second->cevents());
if (ip->second != p && ip->second->cevents() == p->cevents())
{
p1 = ip->second;
break;
}
}
// If a suitable part was found on a different track, we're done. We will chain to it.
// Otherwise keep looking for parts on another track. If no others found, then we
// chain to any suitable part which was found on the same given track t.
if (p1 && mt != t)
break;
}
}
// No part found with same event list? Done.
if (!p1)
continue;
// Make sure the part to be chained is unchained first.
p->prevClone()->setNextClone(p->nextClone());
p->nextClone()->setPrevClone(p->prevClone());
// Link the part to be chained.
p->setPrevClone(p1);
p->setNextClone(p1->nextClone());
// Re-link the existing part.
p1->nextClone()->setPrevClone(p);
p1->setNextClone(p);
}
}/*}}}*/
示例2: chainCloneInternal
void chainCloneInternal(Part* p)
{
Track* t = p->track();
Part* p1 = 0;
// Look for a part with the same event list, that we can chain to.
// It's faster if track type is known...
if (!t || (t && t->isMidiTrack()))
{
MidiTrack* mt = 0;
MidiTrackList* mtl = song->midis();
for (ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
{
mt = *imt;
const PartList* pl = mt->cparts();
for (ciPart ip = pl->begin(); ip != pl->end(); ++ip)
{
// Added by Tim. p3.3.6
//printf("chainCloneInternal track %p %s part %p %s evlist %p\n", (*imt), (*imt)->name().toLatin1().constData(), ip->second, ip->second->name().toLatin1().constData(), ip->second->cevents());
if (ip->second != p && ip->second->cevents() == p->cevents())
{
p1 = ip->second;
break;
}
}
// If a suitable part was found on a different track, we're done. We will chain to it.
// Otherwise keep looking for parts on another track. If no others found, then we
// chain to any suitable part which was found on the same given track t.
if (p1 && mt != t)
break;
}
}
if ((!p1 && !t) || (t && t->type() == Track::WAVE))
{
WaveTrack* wt = 0;
WaveTrackList* wtl = song->waves();
for (ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
{
wt = *iwt;
const PartList* pl = wt->cparts();
for (ciPart ip = pl->begin(); ip != pl->end(); ++ip)
{
if (ip->second != p && ip->second->cevents() == p->cevents())
{
p1 = ip->second;
break;
}
}
if (p1 && wt != t)
break;
}
}
// No part found with same event list? Done.
if (!p1)
return;
// Make sure the part to be chained is unchained first.
p->prevClone()->setNextClone(p->nextClone());
p->nextClone()->setPrevClone(p->prevClone());
// Link the part to be chained.
p->setPrevClone(p1);
p->setNextClone(p1->nextClone());
// Re-link the existing part.
p1->nextClone()->setPrevClone(p);
p1->setNextClone(p);
}