Mercurial > hg > sonic-annotator
comparison 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 |
comparison
equal
deleted
inserted
replaced
167:e5873fb4ffb3 | 168:3e30dbb68ca2 |
---|---|
119 | 119 |
120 d += " { "; | 120 d += " { "; |
121 | 121 |
122 Plugin::Feature f(features[i]); | 122 Plugin::Feature f(features[i]); |
123 | 123 |
124 switch (m_tasks[transformId]) { | 124 if (f.hasDuration) { |
125 | 125 d += QString |
126 case ChordTask: | 126 ("\"start\": { \"value\": %1 }, " |
127 case SegmentTask: | 127 "\"end\": { \"value\": %2 }") |
128 case NoteTask: | 128 .arg(realTime2Sec(f.timestamp)) |
129 case UnknownTask: | 129 .arg(realTime2Sec |
130 if (f.hasDuration) { | 130 (f.timestamp + |
131 d += QString | 131 (f.hasDuration ? f.duration : Vamp::RealTime::zeroTime))); |
132 ("\"start\": { \"value\": %1 }, " | 132 } else { |
133 "\"end\": { \"value\": %2 }") | |
134 .arg(realTime2Sec(f.timestamp)) | |
135 .arg(realTime2Sec | |
136 (f.timestamp + | |
137 (f.hasDuration ? f.duration : Vamp::RealTime::zeroTime))); | |
138 break; | |
139 } else { | |
140 // don't break; fall through to simpler no-duration case | |
141 } | |
142 | |
143 case BeatTask: | |
144 case KeyTask: | |
145 case OnsetTask: | |
146 d += QString("\"time\": { \"value\": %1 }") | 133 d += QString("\"time\": { \"value\": %1 }") |
147 .arg(realTime2Sec(f.timestamp)); | 134 .arg(realTime2Sec(f.timestamp)); |
148 break; | |
149 | |
150 case MelodyTask: | |
151 case PitchTask: | |
152 //!!! | |
153 break; | |
154 } | 135 } |
155 | 136 |
156 if (f.label != "") { | 137 if (f.label != "") { |
157 d += QString(", \"label\": { \"value\": \"%2\" }") | 138 d += QString(", \"label\": { \"value\": \"%2\" }") |
158 .arg(f.label.c_str()); | 139 .arg(f.label.c_str()); |