Ejemplo n.º 1
0
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());
}
Ejemplo n.º 2
0
TEST_F(CueControlTest, LoadTrackWithIntroEndAndOutroStart) {
    TrackPointer pTrack = createTestTrack();
    auto pIntro = pTrack->createAndAddCue();
    pIntro->setType(Cue::INTRO);
    pIntro->setSource(Cue::MANUAL);
    pIntro->setPosition(-1.0);
    pIntro->setLength(150.0);
    auto pOutro = pTrack->createAndAddCue();
    pOutro->setType(Cue::OUTRO);
    pOutro->setSource(Cue::MANUAL);
    pOutro->setPosition(250.0);
    pOutro->setLength(0.0);

    loadTrack(pTrack);

    EXPECT_DOUBLE_EQ(-1.0, m_pCuePoint->get());
    EXPECT_DOUBLE_EQ(-1.0, m_pIntroStartPosition->get());
    EXPECT_DOUBLE_EQ(150.0, m_pIntroEndPosition->get());
    EXPECT_DOUBLE_EQ(250.0, m_pOutroStartPosition->get());
    EXPECT_DOUBLE_EQ(-1.0, m_pOutroEndPosition->get());
    EXPECT_FALSE(m_pIntroStartEnabled->toBool());
    EXPECT_TRUE(m_pIntroEndEnabled->toBool());
    EXPECT_TRUE(m_pOutroStartEnabled->toBool());
    EXPECT_FALSE(m_pOutroEndEnabled->toBool());
}
Ejemplo n.º 3
0
TEST_F(CueControlTest, LoadAutodetectedCues_QuantizeEnabled) {
    m_pQuantizeEnabled->set(1);

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

    const int frameSize = 2;
    const int sampleRate = pTrack->getSampleRate();
    const double bpm = pTrack->getBpm();
    const double beatLength = (60.0 * sampleRate / bpm) * frameSize;

    pTrack->setCuePoint(CuePosition(1.9 * beatLength, Cue::AUTOMATIC));

    auto pIntro = pTrack->createAndAddCue();
    pIntro->setType(Cue::INTRO);
    pIntro->setSource(Cue::AUTOMATIC);
    pIntro->setPosition(2.1 * beatLength);
    pIntro->setLength(1.2 * beatLength);

    auto pOutro = pTrack->createAndAddCue();
    pOutro->setType(Cue::OUTRO);
    pOutro->setSource(Cue::AUTOMATIC);
    pOutro->setPosition(11.1 * beatLength);
    pOutro->setLength(4.4 * beatLength);

    loadTrack(pTrack);

    EXPECT_DOUBLE_EQ(2.0 * beatLength, m_pCuePoint->get());
    EXPECT_DOUBLE_EQ(2.0 * beatLength, m_pIntroStartPosition->get());
    EXPECT_DOUBLE_EQ(4.0 * beatLength, m_pIntroEndPosition->get());
    EXPECT_DOUBLE_EQ(11.0 * beatLength, m_pOutroStartPosition->get());
    EXPECT_DOUBLE_EQ(16.0 * beatLength, m_pOutroEndPosition->get());
}
Ejemplo n.º 4
0
TEST_F(CueControlTest, LoadTrackWithDetectedCues) {
    TrackPointer pTrack = createTestTrack();
    pTrack->setCuePoint(CuePosition(100.0, Cue::AUTOMATIC));
    auto pIntro = pTrack->createAndAddCue();
    pIntro->setType(Cue::INTRO);
    pIntro->setSource(Cue::AUTOMATIC);
    pIntro->setPosition(100.0);
    pIntro->setLength(0.0);
    auto pOutro = pTrack->createAndAddCue();
    pOutro->setType(Cue::OUTRO);
    pOutro->setSource(Cue::AUTOMATIC);
    pOutro->setPosition(-1.0);
    pOutro->setLength(200.0);

    loadTrack(pTrack);

    EXPECT_DOUBLE_EQ(100.0, m_pCuePoint->get());
    EXPECT_DOUBLE_EQ(100.0, m_pIntroStartPosition->get());
    EXPECT_DOUBLE_EQ(-1.0, m_pIntroEndPosition->get());
    EXPECT_DOUBLE_EQ(-1.0, m_pOutroStartPosition->get());
    EXPECT_DOUBLE_EQ(200.0, m_pOutroEndPosition->get());
    EXPECT_TRUE(m_pIntroStartEnabled->toBool());
    EXPECT_FALSE(m_pIntroEndEnabled->toBool());
    EXPECT_FALSE(m_pOutroStartEnabled->toBool());
    EXPECT_TRUE(m_pOutroEndEnabled->toBool());
}
Ejemplo n.º 5
0
TEST_F(CueControlTest, SeekOnLoadIntroCue) {
    m_pSeekOnLoadMode->slotSet(SEEK_ON_LOAD_INTRO_CUE);

    TrackPointer pTrack = createTestTrack();
    auto pIntro = pTrack->createAndAddCue();
    pIntro->setType(Cue::INTRO);
    pIntro->setSource(Cue::MANUAL);
    pIntro->setPosition(200.0);

    loadTrack(pTrack);

    EXPECT_DOUBLE_EQ(200.0, m_pIntroStartPosition->get());
    EXPECT_DOUBLE_EQ(200.0, getCurrentSample());

    // Move cue and check if track is following it.
    pIntro->setPosition(400.0);
    ProcessBuffer();

    EXPECT_DOUBLE_EQ(400.0, m_pIntroStartPosition->get());
    EXPECT_DOUBLE_EQ(400.0, getCurrentSample());
}