comparison src/testApp.h @ 4:f40577e6b30d

revised this to work with onset and chroma and looking now to do sequential DTW
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Wed, 08 Jun 2011 17:35:56 +0100
parents 9ce18f24b266
children 0d51e93bfe74
comparison
equal deleted inserted replaced
3:d0242d0a48e8 4:f40577e6b30d
40 void mouseReleased(int x, int y, int button); 40 void mouseReleased(int x, int y, int button);
41 void windowResized(int w, int h); 41 void windowResized(int w, int h);
42 42
43 void audioRequested (float * input, int bufferSize, int nChannels); 43 void audioRequested (float * input, int bufferSize, int nChannels);
44 void loadSndfile(); 44 void loadSndfile();
45 double getEnergyOfFrame(); 45 //double getEnergyOfFrame();
46 46
47 47
48 void drawChromoGram(); 48 void drawChromoGram();
49 49
50 void loadFirstAudioFile(); 50 void loadFirstAudioFile();
51 void initialiseVariables(); 51 void initialiseVariables();
52 52
53 53 void calculateSimilarityAndAlignment();
54 typedef std::vector<double> DoubleVector; 54
55 typedef std::vector<double> DoubleVector;
55 typedef std::vector<DoubleVector> DoubleMatrix; 56 typedef std::vector<DoubleVector> DoubleMatrix;
56 57
57 // DoubleMatrix chromaMatrix; 58 // DoubleMatrix chromaMatrix;
58 // DoubleMatrix secondMatrix; 59 // DoubleMatrix secondMatrix;
59 DoubleMatrix* matrixPtr; 60 DoubleMatrix* matrixPtr;
75 // DoubleMatrix alignmentMeasureMatrix; 76 // DoubleMatrix alignmentMeasureMatrix;
76 77
77 // DoubleVector minimumAlignmentPath; 78 // DoubleVector minimumAlignmentPath;
78 79
79 void drawAlignmentPath(int startingChromaXFrame, int startingChromaYFrame); 80 void drawAlignmentPath(int startingChromaXFrame, int startingChromaYFrame);
81 void drawForwardsAlignmentPath(int startingChromaXFrame, int startingChromaYFrame);
80 int findStartWidthFrame(); 82 int findStartWidthFrame();
81 83
82 void printScoreForRow(int row, int max); 84 void printScoreForRow(int row, int max);
83 85
84 int numberOfScrollWidthsForFirstFile; 86 int numberOfScrollWidthsForFirstFile;
124 bool getFilenameFromDialogBox(string* fileNameToSave); 126 bool getFilenameFromDialogBox(string* fileNameToSave);
125 void openNewAudioFileWithdialogBox(); 127 void openNewAudioFileWithdialogBox();
126 128
127 //int* firstAudioLength, secondAudioLength; 129 //int* firstAudioLength, secondAudioLength;
128 130
129 string soundFileName, secondFileName; 131 string firstFileName, secondFileName, soundFileName;
130 132
131 float screenHeight, screenWidth; 133 float screenHeight, screenWidth;
132 134
133 float pan; 135 float pan;
134 int sampleRate; 136 int sampleRate;
174 ofSoundPlayer *playingAudio; 176 ofSoundPlayer *playingAudio;
175 177
176 float audioPosition; 178 float audioPosition;
177 float width, height; 179 float width, height;
178 int chromaIndex; 180 int chromaIndex;
179 int totalNumberOfFrames; 181 // int totalNumberOfFrames;
180 int currentPlayingFrame; 182 int currentPlayingFrame;
181 int currentChromaFrame ; 183 int currentChromaFrame ;
182 string chordString; 184 string chordString;
183 185
184 //Chromagram* chromoGrammPtr; 186 //Chromagram* chromoGrammPtr;
189 //sndfile part 191 //sndfile part
190 SNDFILE *infile; // define input and output sound files 192 SNDFILE *infile; // define input and output sound files
191 SF_INFO sfinfo ; // struct to hold info about sound file 193 SF_INFO sfinfo ; // struct to hold info about sound file
192 194
193 int chromaConversionRatio;//not needed but could be useful 195 int chromaConversionRatio;//not needed but could be useful
194 timeWarp tw; 196 TimeWarp tw;
195 Chromagram chromaG; 197 Chromagram chromaG;
196 OnsetDetectionFunction* onset; 198 OnsetDetectionFunction* onset;
199
200 int conversionFactor;
197 }; 201 };
198 202
199 #endif 203 #endif