Mercurial > hg > sonic-annotator
diff runner/JAMSFeatureWriter.cpp @ 168:3e30dbb68ca2 jams
Write time or start/end based simply on whether the feature has them or not, let's not get clever
author | Chris Cannam |
---|---|
date | Wed, 15 Oct 2014 15:20:16 +0100 |
parents | e5873fb4ffb3 |
children | 859d8ec60e06 |
line wrap: on
line diff
--- a/runner/JAMSFeatureWriter.cpp Wed Oct 15 14:56:39 2014 +0100 +++ b/runner/JAMSFeatureWriter.cpp Wed Oct 15 15:20:16 2014 +0100 @@ -121,36 +121,17 @@ Plugin::Feature f(features[i]); - switch (m_tasks[transformId]) { - - case ChordTask: - case SegmentTask: - case NoteTask: - case UnknownTask: - if (f.hasDuration) { - d += QString - ("\"start\": { \"value\": %1 }, " - "\"end\": { \"value\": %2 }") - .arg(realTime2Sec(f.timestamp)) - .arg(realTime2Sec - (f.timestamp + - (f.hasDuration ? f.duration : Vamp::RealTime::zeroTime))); - break; - } else { - // don't break; fall through to simpler no-duration case - } - - case BeatTask: - case KeyTask: - case OnsetTask: + if (f.hasDuration) { + d += QString + ("\"start\": { \"value\": %1 }, " + "\"end\": { \"value\": %2 }") + .arg(realTime2Sec(f.timestamp)) + .arg(realTime2Sec + (f.timestamp + + (f.hasDuration ? f.duration : Vamp::RealTime::zeroTime))); + } else { d += QString("\"time\": { \"value\": %1 }") .arg(realTime2Sec(f.timestamp)); - break; - - case MelodyTask: - case PitchTask: - //!!! - break; } if (f.label != "") {