当前位置: 首页>>代码示例>>C++>>正文


C++ TrackPointer::setCuePoint方法代码示例

本文整理汇总了C++中TrackPointer::setCuePoint方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPointer::setCuePoint方法的具体用法?C++ TrackPointer::setCuePoint怎么用?C++ TrackPointer::setCuePoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TrackPointer的用法示例。


在下文中一共展示了TrackPointer::setCuePoint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createTestTrack

TEST_F(CueControlTest, LoadAutodetectedCues_QuantizeDisabled) {
    m_pQuantizeEnabled->set(0);

    TrackPointer pTrack = createTestTrack();
    pTrack->setSampleRate(44100);
    pTrack->setBpm(120.0);

    pTrack->setCuePoint(CuePosition(240.0, Cue::AUTOMATIC));

    auto pIntro = pTrack->createAndAddCue();
    pIntro->setType(Cue::INTRO);
    pIntro->setSource(Cue::AUTOMATIC);
    pIntro->setPosition(210.0);
    pIntro->setLength(120.0);

    auto pOutro = pTrack->createAndAddCue();
    pOutro->setType(Cue::OUTRO);
    pOutro->setSource(Cue::AUTOMATIC);
    pOutro->setPosition(770.0);
    pOutro->setLength(220.0);

    loadTrack(pTrack);

    EXPECT_DOUBLE_EQ(240.0, m_pCuePoint->get());
    EXPECT_DOUBLE_EQ(210.0, m_pIntroStartPosition->get());
    EXPECT_DOUBLE_EQ(330.0, m_pIntroEndPosition->get());
    EXPECT_DOUBLE_EQ(770.0, m_pOutroStartPosition->get());
    EXPECT_DOUBLE_EQ(990.0, m_pOutroEndPosition->get());
}
开发者ID:mixxxdj,项目名称:mixxx,代码行数:29,代码来源:cuecontrol_test.cpp

示例2: config

TEST_F(CueControlTest, SeekOnLoadDefault_CueRecallDisabled) {
    m_pSeekOnLoadMode->slotSet(SEEK_ON_LOAD_DEFAULT);

    // Note: CueRecall uses inverse logic (0 means enabled).
    config()->set(ConfigKey("[Controls]", "CueRecall"), ConfigValue(1));

    TrackPointer pTrack = createTestTrack();
    pTrack->setCuePoint(CuePosition(100.0, Cue::MANUAL));

    loadTrack(pTrack);

    EXPECT_DOUBLE_EQ(100.0, m_pCuePoint->get());
    EXPECT_DOUBLE_EQ(0.0, getCurrentSample());
}
开发者ID:mixxxdj,项目名称:mixxx,代码行数:14,代码来源:cuecontrol_test.cpp

示例3: cueSet

// Moves the cue point to current position or to closest beat in case
// quantize is enabled
void CueControl::cueSet(double v) {
    if (!v)
        return;

    QMutexLocker lock(&m_mutex);
    double closestBeat = m_pClosestBeat->get();
    double cue = (m_pQuantizeEnabled->get() > 0.0 && closestBeat != -1) ?
            closestBeat : getCurrentSample();
    m_pCuePoint->set(cue);
    TrackPointer pLoadedTrack = m_pLoadedTrack;
    lock.unlock();

    // Store cue point in loaded track
    if (pLoadedTrack) {
        pLoadedTrack->setCuePoint(cue);
    }
}
开发者ID:DJMaxergy,项目名称:mixxx,代码行数:19,代码来源:cuecontrol.cpp

示例4: cueSet

// Moves the cue point to current position or to closest beat in case
// quantize is enabled
void CueControl::cueSet(double v) {
    if (!v)
        return;

    QMutexLocker lock(&m_mutex);
    double cue = (m_pQuantizeEnabled->get() > 0.0 && m_pClosestBeat->get() != -1) ?
            floor(m_pClosestBeat->get()) : floor(getCurrentSample());
    if (!even(static_cast<int>(cue))) {
        cue--;
    }
    m_pCuePoint->set(cue);
    TrackPointer pLoadedTrack = m_pLoadedTrack;
    lock.unlock();

    // Store cue point in loaded track
    if (pLoadedTrack) {
        pLoadedTrack->setCuePoint(cue);
    }
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例5: trackLoaded

void CueControl::trackLoaded(TrackPointer pNewTrack, TrackPointer pOldTrack) {
    QMutexLocker lock(&m_mutex);

    DEBUG_ASSERT(m_pLoadedTrack == pOldTrack);
    if (m_pLoadedTrack) {
        disconnect(m_pLoadedTrack.get(), 0, this, 0);
        for (int i = 0; i < m_iNumHotCues; ++i) {
            detachCue(i);
        }

        m_pCueIndicator->setBlinkValue(ControlIndicator::OFF);
        m_pCuePoint->set(-1.0);
        m_pLoadedTrack.reset();
    }

    if (!pNewTrack) {
        return;
    }
    m_pLoadedTrack = pNewTrack;

    connect(m_pLoadedTrack.get(), SIGNAL(cuesUpdated()),
            this, SLOT(trackCuesUpdated()),
            Qt::DirectConnection);

    CuePointer pLoadCue;
    for (const CuePointer& pCue: m_pLoadedTrack->getCuePoints()) {
        if (pCue->getType() == Cue::CUE) {
            continue; // skip
        }
        if (pCue->getType() == Cue::LOAD) {
            DEBUG_ASSERT(!pLoadCue);
            pLoadCue = pCue;
        }
        int hotcue = pCue->getHotCue();
        if (hotcue != -1) {
            attachCue(pCue, hotcue);
        }
    }
    double cuePoint;
    if (pLoadCue) {
        cuePoint = pLoadCue->getPosition();
    } else {
        // If no load cue point is stored, read from track
        cuePoint = m_pLoadedTrack->getCuePoint();
    }
    m_pCuePoint->set(cuePoint);

    // Need to unlock before emitting any signals to prevent deadlock.
    lock.unlock();

    // Use pNewTrack here, because m_pLoadedTrack might have been reset
    // immediately after leaving the locking scope!
    pNewTrack->setCuePoint(cuePoint);

    // If cue recall is ON in the prefs, then we're supposed to seek to the cue
    // point on song load. Note that [Controls],cueRecall == 0 corresponds to "ON", not OFF.
    bool cueRecall = (getConfig()->getValueString(
                ConfigKey("[Controls]","CueRecall"), "0").toInt() == 0);
    if (cueRecall && (cuePoint >= 0.0)) {
        seekExact(cuePoint);
    } else if (!(m_pVinylControlEnabled->get() &&
            m_pVinylControlMode->get() == MIXXX_VCMODE_ABSOLUTE)) {
        // If cuerecall is off, seek to zero unless
        // vinylcontrol is on and set to absolute.  This allows users to
        // load tracks and have the needle-drop be maintained.
        seekExact(0.0);
    }

    trackCuesUpdated();
}
开发者ID:,项目名称:,代码行数:70,代码来源:


注:本文中的TrackPointer::setCuePoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。