# HG changeset patch # User cannam # Date 1165919935 0 # Node ID 47b0a143db396e756932b02396a870e9d54ccebd # Parent faec23aecc745783ae80b49649796a33972676d8 ... diff -r faec23aecc74 -r 47b0a143db39 host/FDWriteAction.cpp --- a/host/FDWriteAction.cpp Fri Dec 08 18:18:28 2006 +0000 +++ b/host/FDWriteAction.cpp Tue Dec 12 10:38:55 2006 +0000 @@ -64,12 +64,11 @@ void FDWriteAction::fire() { - std::cerr << getName().toStdString() << ": fire" << std::endl; - if (m_fd < 0) return; QMutexLocker locker(&m_mutex); if (m_togglePrevious) { if (m_previousData == m_data) return; + std::cerr << getName().toStdString() << ": fire" << std::endl; if (m_previousData != "") { // bug here write(m_fd, m_previousData.toLocal8Bit().data(), m_previousData.length()); diff -r faec23aecc74 -r 47b0a143db39 host/ImageAction.cpp --- a/host/ImageAction.cpp Fri Dec 08 18:18:28 2006 +0000 +++ b/host/ImageAction.cpp Tue Dec 12 10:38:55 2006 +0000 @@ -5,6 +5,9 @@ #include +QString +ImageAction::m_currentImage; + ImageAction::ImageAction(QString imageName) : m_imageName(imageName) { @@ -25,8 +28,10 @@ void ImageAction::fire() { + if (m_currentImage == m_imageName) return; std::cerr << "ImageAction(\"" << getName().toStdString() << "\")::fire" << std::endl; + m_currentImage = m_imageName; emit showImage(m_imageName); } diff -r faec23aecc74 -r 47b0a143db39 host/ImageAction.h --- a/host/ImageAction.h Fri Dec 08 18:18:28 2006 +0000 +++ b/host/ImageAction.h Tue Dec 12 10:38:55 2006 +0000 @@ -21,6 +21,7 @@ protected: QString m_imageName; + static QString m_currentImage; }; #endif diff -r faec23aecc74 -r 47b0a143db39 host/Processor.cpp --- a/host/Processor.cpp Fri Dec 08 18:18:28 2006 +0000 +++ b/host/Processor.cpp Tue Dec 12 10:38:55 2006 +0000 @@ -212,7 +212,8 @@ Vamp::RealTime rt = Vamp::RealTime::frame2RealTime(frame[reader], sr); - bool changed = currentState.present; +// bool changed = currentState.present; + bool changed = false; Vamp::RealTime gap = rt - currentState.laststamp; m_pluginStates[pluginIndex][output] = OutputState(false, changed, currentState.value, currentState.laststamp, currentState.gap); @@ -245,7 +246,8 @@ m_pluginStates[pluginIndex][output]; if (fl.empty()) { - bool changed = currentState.present; +// bool changed = currentState.present; + bool changed = false; Vamp::RealTime gap = rt - currentState.laststamp; m_pluginStates[pluginIndex][output] = OutputState(false, changed, currentState.value, currentState.laststamp, currentState.gap); @@ -259,9 +261,14 @@ value = fl[0].values[0]; } bool changed = - (!currentState.present || +// (!currentState.present || (fabsf(currentState.value - value) > - 0.000001)); + 0.000001) +// ) + ; + if (changed) { + std::cerr << "changed: " < " << value << std::endl; + } Vamp::RealTime gap = rt - currentState.laststamp; // std::cerr << "gap = " << gap << std::endl; m_pluginStates[pluginIndex][output] = @@ -436,6 +443,7 @@ Rule *rule(*i); bool passed = false; + bool oneChanged = false; for (Rule::ConditionList::const_iterator j = rule->getConditions().begin(); j != rule->getConditions().end(); ++j) { @@ -455,7 +463,10 @@ passed = false; - if (!state.changed) break; //!!!??? + if (state.changed) { +// std::cerr << "State changed with present = " << state.present << ", value = " << state.value << std::endl; + oneChanged = true; + } switch (type) { @@ -477,10 +488,11 @@ case Condition::Present: passed = state.present; + if (passed) oneChanged = true; break; case Condition::Changed: - passed = true; + passed = state.changed; break; case Condition::GapGreaterThan: @@ -496,7 +508,7 @@ if (!passed) break; } - if (passed) { + if (passed && oneChanged) { for (Rule::ActionList::const_iterator ai = rule->getActions().begin(); ai != rule->getActions().end(); ++ai) { Action *action = *ai; diff -r faec23aecc74 -r 47b0a143db39 host/SimpleXMLRuleLoader.cpp --- a/host/SimpleXMLRuleLoader.cpp Fri Dec 08 18:18:28 2006 +0000 +++ b/host/SimpleXMLRuleLoader.cpp Tue Dec 12 10:38:55 2006 +0000 @@ -162,7 +162,7 @@ QString type = atts.value("type").toLower(); if (type == "image") { - QString image = atts.value("image").toLower(); + QString image = atts.value("image"); Action *action = new ImageAction(image); m_rule->addAction(action); std::cerr << "INFO: SimpleXMLRuleLoader: Added image action" << std::endl;