Mercurial > hg > beatroot-vamp
diff BeatTracker.h @ 7:3c11becfc81a
Add tempo induction class as well
author | Chris Cannam |
---|---|
date | Tue, 27 Sep 2011 19:05:27 +0100 |
parents | 02d388f98c23 |
children | f04f87b5e643 |
line wrap: on
line diff
--- a/BeatTracker.h Tue Sep 27 18:37:01 2011 +0100 +++ b/BeatTracker.h Tue Sep 27 19:05:27 2011 +0100 @@ -18,6 +18,7 @@ #include "Event.h" #include "Agent.h" +#include "Induction.h" using std::vector; @@ -70,12 +71,14 @@ * @return The list of beats, or an empty list if beat tracking fails */ static EventList beatTrack(EventList events, EventList beats) { - AgentList agents = null; + AgentList agents; int count = 0; double beatTime = -1; if (!beats.empty()) { count = beats.size() - 1; - beatTime = beats.l.getLast().keyDown; + EventList::iterator itr = beats.end(); + --itr; + beatTime = itr->time; } if (count > 0) { // tempo given by mean of initial beats double ioi = (beatTime - beats.l.getFirst().keyDown) / count;