annotate src/TempoFollower.h @ 19:1a62561bd72d

Added in tempo follower class that models the tempo of played events
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Thu, 09 Feb 2012 18:09:34 +0000
parents
children 4f6006cac9de
rev   line source
andrew@19 1 /*
andrew@19 2 * TempoFollower.h
andrew@19 3 * MultipleAudioMathcher
andrew@19 4 *
andrew@19 5 * Created by Andrew on 09/02/2012.
andrew@19 6 * Copyright 2012 QMUL. All rights reserved.
andrew@19 7 *
andrew@19 8 */
andrew@19 9
andrew@19 10 #ifndef TEMPO_FOLLOWER_H
andrew@19 11 #define TEMPO_FOLLOWER_H
andrew@19 12
andrew@19 13 #define NUMBER_OF_CHANNELS 3
andrew@19 14
andrew@19 15 #include "ofMain.h"
andrew@19 16 #include "DynamicVector.h"
andrew@19 17 #include "ofxWindowRegion.h"
andrew@19 18
andrew@19 19 class TempoFollower{
andrew@19 20
andrew@19 21 public:
andrew@19 22 TempoFollower();
andrew@19 23
andrew@19 24 DynamicVector tempoPrior;
andrew@19 25 DynamicVector tempoPosterior;
andrew@19 26 DynamicVector tempoLikelihood;
andrew@19 27 int tempoArraySize;
andrew@19 28 int minimumTempoInterval, maximumTempoInterval;
andrew@19 29
andrew@19 30 double playingTempo;
andrew@19 31
andrew@19 32 void reset();
andrew@19 33
andrew@19 34 //TEMPO STUFF
andrew@19 35
andrew@19 36 typedef std::vector<double> DoubleVector;
andrew@19 37 typedef std::vector<DoubleVector> DoubleMatrix;
andrew@19 38 typedef std::vector<DoubleMatrix> DoubleCube;
andrew@19 39 DoubleCube tempoIntervals;//channel, event index, vector of interval times
andrew@19 40
andrew@19 41
andrew@19 42 typedef std::vector<int> IntVector;
andrew@19 43 typedef std::vector<IntVector> IntMatrix;
andrew@19 44 IntMatrix eventTimes;
andrew@19 45 void setUpEventTimeMatrix();
andrew@19 46 void printEventTimes();
andrew@19 47
andrew@19 48 void updateTempo(const int& channel, const int& timeIn);
andrew@19 49 bool testTempoInterval(const int& channel, const double& testTempoInterval, DoubleVector& d);
andrew@19 50 void updateTempoDistribution(const DoubleVector& d);
andrew@19 51 void calculatePosterior();
andrew@19 52 void drawTempoArray(ofxWindowRegion& window);
andrew@19 53
andrew@19 54 };
andrew@19 55 #endif