comparison src/midiEventHolder.h @ 0:b299a65a3ad0

start project
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 16 Aug 2011 11:29:59 +0100
parents
children 1a32ce016bb9
comparison
equal deleted inserted replaced
-1:000000000000 0:b299a65a3ad0
1 /*
2 * midiEventHolder.h
3 * midiCannamReader3
4 *
5 * Created by Andrew on 19/07/2011.
6 * Copyright 2011 QMUL. All rights reserved.
7 *
8 */
9 #include "ofMain.h"
10 #include "BayesianArrayStructure.h"
11
12 class midiEventHolder{
13
14 public:
15
16 midiEventHolder();
17 void printNotes();
18
19 typedef std::vector<int> IntVector;
20 typedef std::vector<IntVector> IntMatrix;
21
22 typedef std::vector<bool> BoolVector;
23
24 typedef std::vector<double> DoubleVector;
25 typedef std::vector<DoubleVector> DoubleMatrix;
26
27 //the rehearsal version
28 IntMatrix recordedNoteOnMatrix;//note, velocity, duration
29 IntVector matchesFound;
30 BoolVector noteOnMatches;
31 // int recordedNoteOnIndex;
32 DoubleVector recordedEventTimes;
33
34 IntMatrix playedNoteOnMatrix;
35 DoubleVector playedEventTimes;
36 int playedNoteIndex;
37 IntMatrix matchMatrix;
38
39
40 double minimumMatchSpeed , maximumMatchSpeed;
41
42 double period, pulsesPerQuarternote;
43 double getEventTimeMillis(double ticks);
44 double getEventTimeTicks(double millis);
45
46 int getLocationFromTicks(double tickPosition);
47 int getLocationFromMillis(double millisPosition);
48
49 double windowStartTime;
50
51 //functions for finding match to incoming note
52 void newNoteOnEvent(int pitch, int velocity, double timePlayed);
53 int findLocalMatches(int notePitch);
54 bool checkIfMatchedNote(const int& tmpIndex);
55 int findMatch(const int& notePitch, const int& startTime, const int& endTime);
56
57
58 void findLocalTempoPairs();
59
60
61 double likelihoodWidth;
62 double likelihoodToNoiseRatio;
63
64 void printMatchMatrix();
65
66 void setMatchLikelihoods(int numberOfMatches);
67
68 void setStartPlayingTimes();
69
70 int width, height;
71 /////
72 string matchString;
73 void updatePlayPosition();
74
75 DoubleMatrix beatPeriodMatrix;
76
77 void drawFile();
78 void reset();
79
80 int ticksPerScreen;
81 int tickLocation;
82 int numberOfScreensIn;
83 int noteArrayIndex;
84
85 int matchWindowWidth;
86
87 int noteMinimum, noteMaximum;
88 int* screenWidth;
89 int* screenHeight;
90 float noteHeight;
91 float tempo;
92 double lastPeriodUpdateTime;
93
94 double playPositionInMillis;
95
96 double timeOffsetForScreen;
97
98 double recentNoteOnTime;
99
100 void exampleCrossUpdate();
101 BayesianArrayStructure bayesStruct;
102
103 string timeString;
104 double startTime;
105
106 };