Mercurial > hg > segmenter-vamp-plugin
comparison segmentino/Segmentino.cpp @ 76:a595de3e6f8d
Fix invalid call to parts.erase(parts.end()), which can crash and never does anything good. I think this is the intended behaviour.
author | Chris Cannam |
---|---|
date | Thu, 24 Jan 2019 15:07:04 +0000 |
parents | f1717a01dd9a |
children | 29892906421f |
comparison
equal
deleted
inserted
replaced
75:f1717a01dd9a | 76:a595de3e6f8d |
---|---|
1216 | 1216 |
1217 | 1217 |
1218 // Merge Nulls | 1218 // Merge Nulls |
1219 void mergenulls(vector<Part> &parts) | 1219 void mergenulls(vector<Part> &parts) |
1220 { | 1220 { |
1221 /* | |
1222 cerr << "Segmentino: mergenulls: before: "<< endl; | |
1223 for (int iPart=0; iPart<(int)parts.size(); ++iPart) { | |
1224 cerr << parts[iPart].letter << ": "; | |
1225 for (int iIndex=0; iIndex<(int)parts[iPart].indices.size(); ++iIndex) { | |
1226 cerr << parts[iPart].indices[iIndex]; | |
1227 if (iIndex+1 < (int)parts[iPart].indices.size()) { | |
1228 cerr << ", "; | |
1229 } | |
1230 } | |
1231 cerr << endl; | |
1232 } | |
1233 */ | |
1221 for (int iPart=0; iPart<(int)parts.size(); ++iPart) | 1234 for (int iPart=0; iPart<(int)parts.size(); ++iPart) |
1222 { | 1235 { |
1223 | 1236 |
1224 vector<Part> newVectorPart; | 1237 vector<Part> newVectorPart; |
1225 | 1238 |
1256 else | 1269 else |
1257 { | 1270 { |
1258 newVectorPart[newpartind].n = newVectorPart[newpartind].n+1; | 1271 newVectorPart[newpartind].n = newVectorPart[newpartind].n+1; |
1259 } | 1272 } |
1260 } | 1273 } |
1261 parts.erase (parts.end()); | 1274 parts.erase (parts.begin() + iPart); |
1262 | 1275 |
1263 for (int i=0; i<(int)newVectorPart.size(); ++i) | 1276 for (int i=0; i<(int)newVectorPart.size(); ++i) |
1264 parts.push_back(newVectorPart[i]); | 1277 parts.push_back(newVectorPart[i]); |
1265 } | 1278 |
1266 } | 1279 break; |
1280 } | |
1281 } | |
1282 /* | |
1283 cerr << "Segmentino: mergenulls: after: "<< endl; | |
1284 for (int iPart=0; iPart<(int)parts.size(); ++iPart) { | |
1285 cerr << parts[iPart].letter << ": "; | |
1286 for (int iIndex=0; iIndex<(int)parts[iPart].indices.size(); ++iIndex) { | |
1287 cerr << parts[iPart].indices[iIndex]; | |
1288 if (iIndex+1 < (int)parts[iPart].indices.size()) { | |
1289 cerr << ", "; | |
1290 } | |
1291 } | |
1292 cerr << endl; | |
1293 } | |
1294 */ | |
1267 } | 1295 } |
1268 | 1296 |
1269 /* ------ Segmentation ------ */ | 1297 /* ------ Segmentation ------ */ |
1270 | 1298 |
1271 vector<Part> songSegment(Vamp::Plugin::FeatureList quantisedChromagram) | 1299 vector<Part> songSegment(Vamp::Plugin::FeatureList quantisedChromagram) |