本文整理汇总了C++中TrackPointer::getCuePoint方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPointer::getCuePoint方法的具体用法?C++ TrackPointer::getCuePoint怎么用?C++ TrackPointer::getCuePoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackPointer
的用法示例。
在下文中一共展示了TrackPointer::getCuePoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotControlVinylSeek
void VinylControlControl::slotControlVinylSeek(double fractionalPos) {
// Prevent NaN's from sneaking into the engine.
if (isnan(fractionalPos)) {
return;
}
// Do nothing if no track is loaded.
TrackPointer pTrack = m_pTrack;
if (!pTrack) {
return;
}
double total_samples = getSampleOfTrack().total;
double new_playpos = round(fractionalPos * total_samples);
if (m_pControlVinylEnabled->get() > 0.0 && m_pControlVinylMode->get() == MIXXX_VCMODE_RELATIVE) {
int cuemode = (int)m_pControlVinylCueing->get();
//if in preroll, always seek
if (new_playpos < 0) {
seekExact(new_playpos);
return;
}
switch (cuemode) {
case MIXXX_RELATIVE_CUE_OFF:
return; // If off, do nothing.
case MIXXX_RELATIVE_CUE_ONECUE:
//if onecue, just seek to the regular cue
seekExact(pTrack->getCuePoint().getPosition());
return;
case MIXXX_RELATIVE_CUE_HOTCUE:
// Continue processing in this function.
break;
default:
qWarning() << "Invalid vinyl cue setting";
return;
}
double shortest_distance = 0;
int nearest_playpos = -1;
const QList<CuePointer> cuePoints(pTrack->getCuePoints());
QListIterator<CuePointer> it(cuePoints);
while (it.hasNext()) {
CuePointer pCue(it.next());
if (pCue->getType() != Cue::CUE || pCue->getHotCue() == -1) {
continue;
}
int cue_position = pCue->getPosition();
// pick cues closest to new_playpos
if ((nearest_playpos == -1) ||
(fabs(new_playpos - cue_position) < shortest_distance)) {
nearest_playpos = cue_position;
shortest_distance = fabs(new_playpos - cue_position);
}
}
if (nearest_playpos == -1) {
if (new_playpos >= 0) {
//never found an appropriate cue, so don't seek?
return;
}
//if negative, allow a seek by falling down to the bottom
} else {
m_bSeekRequested = true;
seekExact(nearest_playpos);
m_bSeekRequested = false;
return;
}
}
// Just seek where it wanted to originally.
m_bSeekRequested = true;
seekExact(new_playpos);
m_bSeekRequested = false;
}