Exemplo n.º 1
0
void SimpleDesk::replaceCurrentCue()
{
    qDebug() << Q_FUNC_INFO;
    Q_ASSERT(m_selectedPlayback < uint(m_playbackSliders.size()));

    CueStack* cueStack = m_engine->cueStack(m_selectedPlayback);
    Q_ASSERT(cueStack != NULL);

    QItemSelectionModel* selectionModel = m_cueStackView->selectionModel();
    if (selectionModel->hasSelection() == true)
    {
        // Replace current cue values
        QModelIndex index = m_cueStackView->currentIndex();
        QString name = cueStack->cues().at(index.row()).name();
        Cue cue = m_engine->cue();
        cue.setName(name);
        cueStack->replaceCue(index.row(), cue);
    }
}
Exemplo n.º 2
0
void CueStack_Test::postRun()
{
    QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
    QVERIFY(def != NULL);

    QLCFixtureMode* mode = def->modes().first();
    QVERIFY(mode != NULL);

    Fixture* fxi = new Fixture(m_doc);
    fxi->setFixtureDefinition(def, mode);
    fxi->setName("Test Scanner");
    fxi->setAddress(10);
    fxi->setUniverse(0);
    m_doc->addFixture(fxi);

    MasterTimer mt(m_doc);
    QList<Universe*> ua;
    ua.append(new Universe(0, new GrandMaster()));
    CueStack cs(m_doc);
    cs.setFadeInSpeed(100);
    cs.setFadeOutSpeed(200);
    cs.setDuration(300);

    Cue cue;
    cue.setName("One");
    cue.setValue(0, 255);
    cue.setValue(1, 255);
    cue.setValue(500, 255);
    cue.setValue(10, 255); // LTP
    cue.setValue(11, 255); // LTP
    cs.appendCue(cue);

    cue = Cue();

    cue.setName("Two");
    cue.setValue(500, 255);
    cue.setValue(3, 255);
    cue.setValue(4, 255);
    cue.setValue(11, 255); // LTP
    cs.appendCue(cue);

    cs.preRun();

    // Switch to cue one
    cs.switchCue(-1, 0, ua);
    QCOMPARE(cs.m_fader->channels().size(), 5);

    QSignalSpy cueSpy(&cs, SIGNAL(currentCueChanged(int)));
    QSignalSpy stopSpy(&cs, SIGNAL(stopped()));

    cs.postRun(&mt);
    QCOMPARE(cs.m_fader, (GenericFader*) NULL);
    QCOMPARE(cs.m_currentIndex, -1);
    QCOMPARE(cueSpy.size(), 1);
    QCOMPARE(cueSpy.at(0).size(), 1);
    QCOMPARE(cueSpy.at(0).at(0).toInt(), -1);
    QCOMPARE(stopSpy.size(), 1);

    // Only HTP channels go to MasterTimer's GenericFader
    QCOMPARE(mt.m_fader->channels().size(), 3);
    FadeChannel fc;
    fc.setChannel(0);
    QCOMPARE(mt.m_fader->channels().contains(fc), true);
    fc.setChannel(1);
    QCOMPARE(mt.m_fader->channels().contains(fc), true);
    fc.setChannel(500);
    QCOMPARE(mt.m_fader->channels().contains(fc), true);
}
Exemplo n.º 3
0
void CueStack_Test::switchCue()
{
    QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
    QVERIFY(def != NULL);

    QLCFixtureMode* mode = def->modes().first();
    QVERIFY(mode != NULL);

    Fixture* fxi = new Fixture(m_doc);
    fxi->setFixtureDefinition(def, mode);
    fxi->setName("Test Scanner");
    fxi->setAddress(10);
    fxi->setUniverse(0);
    m_doc->addFixture(fxi);

    QList<Universe*> ua;
    ua.append(new Universe(0, new GrandMaster()));
    CueStack cs(m_doc);
    cs.setFadeInSpeed(100);
    cs.setFadeOutSpeed(200);
    cs.setDuration(300);

    Cue cue;
    cue.setName("One");
    cue.setValue(0, 255);
    cue.setValue(1, 255);
    cue.setValue(500, 255);
    cue.setValue(10, 255); // LTP
    cue.setValue(11, 255); // LTP
    cue.setFadeInSpeed(20);
    cue.setFadeOutSpeed(40);
    cs.appendCue(cue);

    cue = Cue();

    cue.setName("Two");
    cue.setValue(500, 255);
    cue.setValue(3, 255);
    cue.setValue(4, 255);
    cue.setValue(11, 255); // LTP
    cue.setFadeInSpeed(60);
    cue.setFadeOutSpeed(80);
    cs.appendCue(cue);

    cs.preRun();

    // Do nothing with invalid cue indices
    cs.switchCue(-1, -1, ua);
    QCOMPARE(cs.m_fader->channels().size(), 0);
    cs.switchCue(-1, 3, ua);
    QCOMPARE(cs.m_fader->channels().size(), 0);

    // Switch to cue one
    cs.switchCue(3, 0, ua);
    QCOMPARE(cs.m_fader->channels().size(), 5);

    FadeChannel fc;
    fc.setChannel(0);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(0));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(20));

    fc.setChannel(1);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(1));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(20));

    fc.setChannel(10);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(10));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(20));

    fc.setChannel(11);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(11));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(20));

    fc.setChannel(500);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(500));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(20));

    fc.setChannel(3);
    QCOMPARE(cs.m_fader->channels()[fc].channel(), QLCChannel::invalid());
    fc.setChannel(4);
    QCOMPARE(cs.m_fader->channels()[fc].channel(), QLCChannel::invalid());

    fc.setChannel(0);
    cs.m_fader->m_channels[fc].setCurrent(127);
    fc.setChannel(1);
    cs.m_fader->m_channels[fc].setCurrent(127);
    fc.setChannel(10);
    cs.m_fader->m_channels[fc].setCurrent(127);
    fc.setChannel(11);
    cs.m_fader->m_channels[fc].setCurrent(127);
    fc.setChannel(500);
    cs.m_fader->m_channels[fc].setCurrent(127);

    // Switch to cue two
    cs.switchCue(0, 1, ua);
    QCOMPARE(cs.m_fader->channels().size(), 7);

    fc.setChannel(0);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(0));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(40));

    fc.setChannel(1);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(1));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(40));

    fc.setChannel(11); // LTP channel also in the next cue
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(11));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(60));

    fc.setChannel(500);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(127));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(500));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(60));

    fc.setChannel(3);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(3));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(60));

    fc.setChannel(4);
    QCOMPARE(cs.m_fader->channels()[fc].start(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].current(), uchar(0));
    QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
    QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(4));
    QCOMPARE(cs.m_fader->channels()[fc].fadeTime(), uint(60));

    // Stop
    cs.switchCue(1, -1, ua);
    QCOMPARE(cs.m_fader->channels().size(), 7);

    MasterTimer mt(m_doc);
    cs.postRun(&mt);
}