# HG changeset patch # User Chris Cannam # Date 1177688388 0 # Node ID 7a5ba9dadbf7d38d2af7700b9502b7449ac0c00e # Parent a5733f662a5cae21030e25ba0c25417271d4c000 * Fix #1706927 NaNs from plugin outputs should not be used diff -r a5733f662a5c -r 7a5ba9dadbf7 transform/FeatureExtractionPluginTransform.cpp --- a/transform/FeatureExtractionPluginTransform.cpp Fri Apr 27 14:37:48 2007 +0000 +++ b/transform/FeatureExtractionPluginTransform.cpp Fri Apr 27 15:39:48 2007 +0000 @@ -123,6 +123,7 @@ int binCount = 1; float minValue = 0.0, maxValue = 0.0; + bool haveExtents = false; if (m_descriptor->hasFixedBinCount) { binCount = m_descriptor->binCount; @@ -134,6 +135,7 @@ if (binCount > 0 && m_descriptor->hasKnownExtents) { minValue = m_descriptor->minValue; maxValue = m_descriptor->maxValue; + haveExtents = true; } size_t modelRate = m_input->getSampleRate(); @@ -163,8 +165,14 @@ } else if (binCount == 1) { - SparseTimeValueModel *model = new SparseTimeValueModel - (modelRate, modelResolution, minValue, maxValue, false); + SparseTimeValueModel *model; + if (haveExtents) { + model = new SparseTimeValueModel + (modelRate, modelResolution, minValue, maxValue, false); + } else { + model = new SparseTimeValueModel + (modelRate, modelResolution, false); + } model->setScaleUnits(outputs[m_outputFeatureNo].unit.c_str()); m_output = model; @@ -180,15 +188,22 @@ // yet store velocity.) //!!! todo: ask the user! - NoteModel *model = new NoteModel - (modelRate, modelResolution, minValue, maxValue, false); + NoteModel *model; + if (haveExtents) { + model = new NoteModel + (modelRate, modelResolution, minValue, maxValue, false); + } else { + model = new NoteModel + (modelRate, modelResolution, false); + } model->setScaleUnits(outputs[m_outputFeatureNo].unit.c_str()); m_output = model; } else { - - m_output = new EditableDenseThreeDimensionalModel + + EditableDenseThreeDimensionalModel *model = + new EditableDenseThreeDimensionalModel (modelRate, modelResolution, binCount, false); if (!m_descriptor->binNames.empty()) { @@ -196,9 +211,10 @@ for (size_t i = 0; i < m_descriptor->binNames.size(); ++i) { names.push_back(m_descriptor->binNames[i].c_str()); } - (dynamic_cast(m_output)) - ->setBinNames(names); + model->setBinNames(names); } + + m_output = model; } }