Mercurial > hg > beatroot-vamp
diff Agent.h @ 12:59520cd6abac
Debug output, and some actual debugging... getting there.
author | Chris Cannam |
---|---|
date | Thu, 06 Oct 2011 15:21:03 +0100 |
parents | 4f6626f9ffac |
children | f1252b6a7cf5 |
line wrap: on
line diff
--- a/Agent.h Fri Sep 30 23:11:14 2011 +0100 +++ b/Agent.h Thu Oct 06 15:21:03 2011 +0100 @@ -20,6 +20,10 @@ #include <cmath> +#ifdef DEBUG_BEATROOT +#include <iostream> +#endif + class AgentList; /** Agent is the central class for beat tracking. @@ -116,30 +120,6 @@ * @param ibi The beat period (inter-beat interval) of the Agent's tempo hypothesis. */ Agent(double ibi) { - init(ibi); - } // constructor - - /** Copy constructor. - * @param clone The Agent to duplicate. */ - Agent(const Agent &clone) { - idNumber = idCounter++; - phaseScore = clone.phaseScore; - tempoScore = clone.tempoScore; - topScoreTime = clone.topScoreTime; - beatCount = clone.beatCount; - beatInterval = clone.beatInterval; - initialBeatInterval = clone.initialBeatInterval; - beatTime = clone.beatTime; - events = EventList(clone.events); - postMargin = clone.postMargin; - preMargin = clone.preMargin; - } // copy constructor - -protected: - /** Initialise all the fields of this Agent. - * @param ibi The initial tempo hypothesis of the Agent. - */ - void init(double ibi) { innerMargin = INNER_MARGIN; correctionFactor = DEFAULT_CORRECTION_FACTOR; expiryTime = DEFAULT_EXPIRY_TIME; @@ -154,10 +134,15 @@ topScoreTime = 0.0; beatCount = 0; beatTime = -1.0; - events.clear(); - } // init() + } // constructor + Agent clone() const { + Agent a(*this); + a.idCounter++; + return a; + } +protected: double threshold(double value, double min, double max) { if (value < min) return min; @@ -187,6 +172,12 @@ (1.0 - memFactor) * conFactor * e.salience; } else phaseScore += conFactor * e.salience; +#ifdef DEBUG_BEATROOT + std::cerr << "Ag#" << idNumber << ": " << beatInterval << std::endl; + std::cerr << " Beat" << beatCount << " Time=" << beatTime + << " Score=" << tempoScore << ":P" << phaseScore << ":" + << topScoreTime << std::endl; +#endif } // accept() /** The given Event is tested for a possible beat time. The following situations can occur: