void Function::setTempoType(const Function::TempoType &type) { if (type == m_tempoType) return; m_tempoType = type; /* Retrieve the current BPM value known by the Master Timer */ float bpmNum = doc()->masterTimer()->bpmNumber(); /* Calculate the duration in ms of a single beat */ float beatTime = 60000.0 / bpmNum; switch (type) { /* Beats -> Time */ case Time: setFadeInSpeed(beatsToTime(fadeInSpeed(), beatTime)); setDuration(beatsToTime(duration(), beatTime)); setFadeOutSpeed(beatsToTime(fadeOutSpeed(), beatTime)); disconnect(doc()->masterTimer(), SIGNAL(bpmNumberChanged(int)), this, SLOT(slotBPMChanged(int))); break; /* Time -> Beats */ case Beats: setFadeInSpeed(timeToBeats(fadeInSpeed(), beatTime)); setDuration(timeToBeats(duration(), beatTime)); setFadeOutSpeed(timeToBeats(fadeOutSpeed(), beatTime)); connect(doc()->masterTimer(), SIGNAL(bpmNumberChanged(int)), this, SLOT(slotBPMChanged(int))); break; default: qDebug() << "Error. Unhandled tempo type" << type; break; } emit changed(m_id); }
void EFX::postLoad() { // Map legacy bus speeds to fixed speed values if (m_legacyFadeBus != Bus::invalid()) { quint32 value = Bus::instance()->value(m_legacyFadeBus); setFadeInSpeed((value / MasterTimer::frequency()) * 1000); setFadeOutSpeed((value / MasterTimer::frequency()) * 1000); } if (m_legacyHoldBus != Bus::invalid()) { quint32 value = Bus::instance()->value(m_legacyHoldBus); setDuration((value / MasterTimer::frequency()) * 1000); } }
bool CueStack::loadXML(const QDomElement& root) { qDebug() << Q_FUNC_INFO; m_cues.clear(); if (root.tagName() != KXMLQLCCueStack) { qWarning() << Q_FUNC_INFO << "CueStack node not found"; return false; } QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCCue) { Cue cue; if (cue.loadXML(tag) == true) appendCue(cue); } else if (tag.tagName() == KXMLQLCCueStackSpeed) { setFadeInSpeed(tag.attribute(KXMLQLCCueStackSpeedFadeIn).toUInt()); setFadeOutSpeed(tag.attribute(KXMLQLCCueStackSpeedFadeOut).toUInt()); setDuration(tag.attribute(KXMLQLCCueStackSpeedDuration).toUInt()); } else { qWarning() << Q_FUNC_INFO << "Unrecognized CueStack tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }