Revision 36:937432fc2898
| BeatRootProcessor.cpp | ||
|---|---|---|
| 31 | 31 |
|
| 32 | 32 |
} // processFrame() |
| 33 | 33 |
|
| 34 |
EventList BeatRootProcessor::beatTrack() {
|
|
| 34 |
EventList BeatRootProcessor::beatTrack(EventList *unfilledReturn) {
|
|
| 35 | 35 |
|
| 36 | 36 |
#ifdef DEBUG_BEATROOT |
| 37 | 37 |
std::cerr << "Spectral flux:" << std::endl; |
| ... | ... | |
| 67 | 67 |
std::cerr << "Onsets: " << onsetList.size() << std::endl; |
| 68 | 68 |
#endif |
| 69 | 69 |
|
| 70 |
return BeatTracker::beatTrack(agentParameters, onsetList); |
|
| 70 |
return BeatTracker::beatTrack(agentParameters, onsetList, unfilledReturn);
|
|
| 71 | 71 |
|
| 72 | 72 |
} // processFile() |
| 73 | 73 |
|
| BeatRootProcessor.h | ||
|---|---|---|
| 118 | 118 |
|
| 119 | 119 |
/** Tracks beats once all frames have been processed by processFrame |
| 120 | 120 |
*/ |
| 121 |
EventList beatTrack(); |
|
| 121 |
EventList beatTrack(EventList *optionalUnfilledBeatReturn);
|
|
| 122 | 122 |
|
| 123 | 123 |
protected: |
| 124 | 124 |
/** Allocates or re-allocates memory for arrays, based on parameter settings */ |
| BeatRootVampPlugin.cpp | ||
|---|---|---|
| 239 | 239 |
d.hasDuration = false; |
| 240 | 240 |
list.push_back(d); |
| 241 | 241 |
|
| 242 |
d.identifier = "unfilled"; |
|
| 243 |
d.name = "Un-interpolated beats"; |
|
| 244 |
d.description = "Locations of detected beats, before agent interpolation occurs"; |
|
| 245 |
list.push_back(d); |
|
| 246 |
|
|
| 242 | 247 |
return list; |
| 243 | 248 |
} |
| 244 | 249 |
|
| ... | ... | |
| 300 | 305 |
BeatRootVampPlugin::FeatureSet |
| 301 | 306 |
BeatRootVampPlugin::getRemainingFeatures() |
| 302 | 307 |
{
|
| 303 |
EventList el = m_processor->beatTrack(); |
|
| 308 |
EventList unfilled; |
|
| 309 |
EventList el = m_processor->beatTrack(&unfilled); |
|
| 304 | 310 |
|
| 305 | 311 |
Feature f; |
| 306 | 312 |
f.hasTimestamp = true; |
| ... | ... | |
| 315 | 321 |
fs[0].push_back(f); |
| 316 | 322 |
} |
| 317 | 323 |
|
| 324 |
for (EventList::const_iterator i = unfilled.begin(); |
|
| 325 |
i != unfilled.end(); ++i) {
|
|
| 326 |
f.timestamp = m_origin + Vamp::RealTime::fromSeconds(i->time); |
|
| 327 |
fs[1].push_back(f); |
|
| 328 |
} |
|
| 329 |
|
|
| 318 | 330 |
return fs; |
| 319 | 331 |
} |
| 320 | 332 |
|
| BeatTracker.cpp | ||
|---|---|---|
| 16 | 16 |
#include "BeatTracker.h" |
| 17 | 17 |
|
| 18 | 18 |
EventList BeatTracker::beatTrack(AgentParameters params, |
| 19 |
EventList events, EventList beats) |
|
| 19 |
EventList events, EventList beats, |
|
| 20 |
EventList *unfilledReturn) |
|
| 20 | 21 |
{
|
| 21 | 22 |
AgentList agents; |
| 22 | 23 |
int count = 0; |
| ... | ... | |
| 43 | 44 |
Agent *best = agents.bestAgent(); |
| 44 | 45 |
EventList results; |
| 45 | 46 |
if (best) {
|
| 47 |
if (unfilledReturn) *unfilledReturn = best->events; |
|
| 46 | 48 |
best->fillBeats(beatTime); |
| 47 | 49 |
results = best->events; |
| 48 | 50 |
} |
| BeatTracker.h | ||
|---|---|---|
| 54 | 54 |
|
| 55 | 55 |
/** Perform beat tracking. |
| 56 | 56 |
* @param events The onsets or peaks in a feature list |
| 57 |
* @param unfilledReturn Pointer to list in which to return |
|
| 58 |
* un-interpolated beats, or NULL |
|
| 57 | 59 |
* @return The list of beats, or an empty list if beat tracking fails |
| 58 | 60 |
*/ |
| 59 |
static EventList beatTrack(AgentParameters params, EventList events) {
|
|
| 60 |
return beatTrack(params, events, EventList()); |
|
| 61 |
static EventList beatTrack(AgentParameters params, EventList events, |
|
| 62 |
EventList *unfilledReturn) {
|
|
| 63 |
return beatTrack(params, events, EventList(), unfilledReturn); |
|
| 61 | 64 |
} |
| 62 | 65 |
|
| 63 | 66 |
/** Perform beat tracking. |
| 64 | 67 |
* @param events The onsets or peaks in a feature list |
| 65 | 68 |
* @param beats The initial beats which are given, if any |
| 69 |
* @param unfilledReturn Pointer to list in which to return |
|
| 70 |
* un-interpolated beats, or NULL |
|
| 66 | 71 |
* @return The list of beats, or an empty list if beat tracking fails |
| 67 | 72 |
*/ |
| 68 | 73 |
static EventList beatTrack(AgentParameters params, |
| 69 |
EventList events, EventList beats); |
|
| 74 |
EventList events, EventList beats, |
|
| 75 |
EventList *unfilledReturn); |
|
| 70 | 76 |
|
| 71 | 77 |
|
| 72 | 78 |
// Various get and set methods |
Also available in: Unified diff