Mercurial > hg > beatroot-vamp
comparison Agent.cpp @ 23:633ec097fa56
Expose the processing parameters Simon suggests
author | Chris Cannam |
---|---|
date | Tue, 03 Sep 2013 17:32:09 +0100 |
parents | 55969570044e |
children |
comparison
equal
deleted
inserted
replaced
22:6afcb5edd7ab | 23:633ec097fa56 |
---|---|
14 */ | 14 */ |
15 | 15 |
16 #include "Agent.h" | 16 #include "Agent.h" |
17 #include "BeatTracker.h" | 17 #include "BeatTracker.h" |
18 | 18 |
19 double Agent::POST_MARGIN_FACTOR = 0.3; | 19 const double AgentParameters::DEFAULT_POST_MARGIN_FACTOR = 0.3; |
20 double Agent::PRE_MARGIN_FACTOR = 0.15; | 20 const double AgentParameters::DEFAULT_PRE_MARGIN_FACTOR = 0.15; |
21 const double AgentParameters::DEFAULT_MAX_CHANGE = 0.2; | |
22 const double AgentParameters::DEFAULT_EXPIRY_TIME = 10.0; | |
23 | |
21 const double Agent::INNER_MARGIN = 0.040; | 24 const double Agent::INNER_MARGIN = 0.040; |
22 double Agent::MAX_CHANGE = 0.2; | 25 const double Agent::CONF_FACTOR = 0.5; |
23 double Agent::CONF_FACTOR = 0.5; | |
24 const double Agent::DEFAULT_CORRECTION_FACTOR = 50.0; | 26 const double Agent::DEFAULT_CORRECTION_FACTOR = 50.0; |
25 const double Agent::DEFAULT_EXPIRY_TIME = 10.0; | |
26 | 27 |
27 int Agent::idCounter = 0; | 28 int Agent::idCounter = 0; |
28 | |
29 double Agent::innerMargin = 0.0; | |
30 double Agent::correctionFactor = 0.0; | |
31 double Agent::expiryTime = 0.0; | |
32 double Agent::decayFactor = 0.0; | |
33 | 29 |
34 void Agent::accept(Event e, double err, int beats) { | 30 void Agent::accept(Event e, double err, int beats) { |
35 beatTime = e.time; | 31 beatTime = e.time; |
36 events.push_back(e); | 32 events.push_back(e); |
37 if (fabs(initialBeatInterval - beatInterval - | 33 if (fabs(initialBeatInterval - beatInterval - |
38 err / correctionFactor) < MAX_CHANGE * initialBeatInterval) | 34 err / correctionFactor) < maxChange * initialBeatInterval) |
39 beatInterval += err / correctionFactor;// Adjust tempo | 35 beatInterval += err / correctionFactor;// Adjust tempo |
40 beatCount += beats; | 36 beatCount += beats; |
41 double conFactor = 1.0 - CONF_FACTOR * err / | 37 double conFactor = 1.0 - CONF_FACTOR * err / |
42 (err>0? postMargin: -preMargin); | 38 (err>0? postMargin: -preMargin); |
43 if (decayFactor > 0) { | 39 if (decayFactor > 0) { |