diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/midiEventHolder.h	Tue Aug 16 11:29:59 2011 +0100
@@ -0,0 +1,106 @@
+/*
+ *  midiEventHolder.h
+ *  midiCannamReader3
+ *
+ *  Created by Andrew on 19/07/2011.
+ *  Copyright 2011 QMUL. All rights reserved.
+ *
+ */
+#include "ofMain.h"
+#include "BayesianArrayStructure.h"
+
+class midiEventHolder{
+
+public:
+	
+	midiEventHolder();
+	void printNotes();
+	
+	typedef std::vector<int> IntVector;
+	typedef std::vector<IntVector> IntMatrix;
+	
+	typedef std::vector<bool> BoolVector;
+	
+	typedef std::vector<double> DoubleVector;
+	typedef std::vector<DoubleVector> DoubleMatrix;
+	
+	//the rehearsal version
+	IntMatrix recordedNoteOnMatrix;//note, velocity, duration
+	IntVector matchesFound;
+	BoolVector noteOnMatches;
+//	int recordedNoteOnIndex;
+	DoubleVector recordedEventTimes;
+	
+	IntMatrix playedNoteOnMatrix;
+	DoubleVector playedEventTimes;
+	int playedNoteIndex;
+	IntMatrix matchMatrix;
+	
+	
+	double minimumMatchSpeed , maximumMatchSpeed;
+	
+	double period, pulsesPerQuarternote;
+	double getEventTimeMillis(double ticks);
+	double getEventTimeTicks(double millis);
+	
+	int getLocationFromTicks(double tickPosition);
+	int getLocationFromMillis(double millisPosition);
+	
+	double windowStartTime;
+	
+	//functions for finding match to incoming note
+	void newNoteOnEvent(int pitch, int velocity, double timePlayed);
+	int findLocalMatches(int notePitch);
+	bool checkIfMatchedNote(const int& tmpIndex);
+	int findMatch(const int& notePitch, const int& startTime, const int& endTime);
+	
+	
+	void findLocalTempoPairs();
+	
+	
+	double likelihoodWidth;
+	double likelihoodToNoiseRatio;
+	
+	void printMatchMatrix();
+	
+	void setMatchLikelihoods(int numberOfMatches);
+	
+	void setStartPlayingTimes();
+	
+	int width, height;
+	/////
+	string matchString;
+	void updatePlayPosition();
+	
+	DoubleMatrix beatPeriodMatrix;
+	
+	void drawFile();
+	void reset();
+	
+	int ticksPerScreen;
+	int tickLocation;
+	int numberOfScreensIn;
+	int noteArrayIndex;
+	
+	int matchWindowWidth;
+	
+	int noteMinimum, noteMaximum;
+	int* screenWidth;
+	int* screenHeight;
+	float noteHeight;
+	float tempo;
+	double lastPeriodUpdateTime;
+	
+	double playPositionInMillis;
+	
+	double timeOffsetForScreen;
+	
+	double recentNoteOnTime;
+	
+	void exampleCrossUpdate();
+	BayesianArrayStructure bayesStruct;
+
+	string timeString;
+	double startTime;
+	
+};
\ No newline at end of file