Mercurial > hg > audio-time-warp
view src/timeWarp.h @ 3:d0242d0a48e8
I've changed timeWarp.h to have a capital T: TimeWarp.h as befits a class. Also added destructor method
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Thu, 19 May 2011 16:23:49 +0100 |
parents | 6842ff391568 |
children | f40577e6b30d |
line wrap: on
line source
/* * timeWarp.h * chromaReader13 * * Created by Andrew on 16/05/2011. * Copyright 2011 QMUL. All rights reserved. * */ #ifndef _TIME_WARP #define _TIME_WARP #include "ofMain.h" #include "chromaGram.h" #include "ChordDetect.h" #include "sndfile.h" #include "ofxFileDialogOSX.h" #define FRAMESIZE 512 #define ENERGY_LENGTH 80000 #define CHROMA_LENGTH 12000 #define CHROMA_CONVERSION_FACTOR 16 //16 times as many frames in energy as in chroma //length in terms of frames (at 512 samples per frame - there are 90 per second) => 900: 10 seconds class timeWarp : public ofBaseApp{ public: /* void setup(); void update(); void draw(); void keyPressed (int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void audioRequested (float * input, int bufferSize, int nChannels); void loadSndfile(); */ double getEnergyOfFrame(); void putEnergyInFrame(); // void drawChromoGram(); // void loadFirstAudioFile(); void initialiseVariables(); //variables typedef std::vector<double> DoubleVector; typedef std::vector<DoubleVector> DoubleMatrix; DoubleMatrix chromaMatrix; DoubleMatrix secondMatrix; DoubleMatrix* matrixPtr; // void drawDoubleMatrix(DoubleMatrix* dMatrix);//DoubleMatrix* dMatrix); WOULD BE NICE TO USE POINTER BUT NOT WORKING YET // void drawSpectralDifference(DoubleMatrix* dMatrix); DoubleVector firstEnergyVector; DoubleVector secondEnergyVector; DoubleMatrix similarityMatrix; void calculateSimilarityMatrix(); // bool drawSimilarity; // void drawSimilarityMatrix(); // void printSimilarityMatrix(int sizeToPrint); Chromagram chromoGramm; Chromagram secondChromoGramm; DoubleMatrix alignmentMeasureMatrix;//just the choma alignment DoubleVector minimumAlignmentPath; //new addition DoubleMatrix superAlignmentMeasureMatrix; //for the onset + chromagram alignment DoubleVector superMinimumAlignmentPath; // void drawAlignmentPath(int startingChromaXFrame, int startingChromaYFrame); int findStartWidthFrame(); // void printScoreForRow(int row, int max); // int numberOfScrollWidthsForFirstFile; // int numberOfScrollWidthsForSecondFile; // void checkIfAudioPositionExceedsWidthForFirstFile(); typedef std::vector<int> IntVector; typedef std::vector<IntVector> IntMatrix; // void updateAlignmentPathIndex(int idenifier); IntMatrix backwardsAlignmentPath; int backwardsAlignmentIndex; bool findPreviousMinimumInBackwardsPath(); bool testForNewAlignmentMinimum(double *previousMinimum, int i, int j); void calculateAlignmentMatrix(); double getDistance(int i, int j); // void printAlignmentMatrix(); double getMinimum(int i, int j, float newValue); bool extendAlignmentUp(); bool extendAlignmentAlong(); void calculateMinimumAlignmentPath(); int findMinimumOfVector(DoubleVector *d); // void swapBetweenPlayingFilesUsingAlignmentMatch(); // int findMatchFromAlignment(bool whichFileToTest); // void drawEnergyVectorFromPointer(DoubleVector* energyVec); // void processAudioToDoubleMatrix(Chromagram* chromaG, DoubleMatrix* myDoubleMatrix, DoubleVector* energyVector); // void loadNewAudio(string soundFileName); // void loadSecondAudio(string soundFileName); // void loadSoundFiles(); // void openFileDialogBox(); // void loadLibSndFile(const char * filename); // bool getFilenameFromDialogBox(string* fileNameToSave); // void openNewAudioFileWithdialogBox(); //int* firstAudioLength, secondAudioLength; // string soundFileName, secondFileName; // float screenHeight, screenWidth; // bool moveOn; // bool drawSpectralDifferenceFunction; float frame[FRAMESIZE]; float diagonalPenalty; // int frameIndex; // float chromoGramVector[CHROMA_LENGTH][12]; // int rootChord[CHROMA_LENGTH]; // int energyIndex; // int totalFrames; // int scrollWidth;// 1600 // float chromoLength; // bool audioPlaying, audioPaused; // bool drawSecondMatrix; /* //------------------- for the simple sine wave synthesis float targetFrequency; float phase; float phaseAdder; float phaseAdderTarget; string sndfileInfoString, textString; int xIndex; bool firstAudioFilePlaying; ofSoundPlayer loadedAudio; ofSoundPlayer secondAudio; ofSoundPlayer *playingAudio; */ // float audioPosition; // float width, height; // int chromaIndex; // int totalNumberOfFrames; // int currentPlayingFrame; // int currentChromaFrame ; // string chordString; //Chromagram* chromoGrammPtr; // string userInfoString; // ChordDetect chord; //sndfile part // SNDFILE *infile; // define input and output sound files // SF_INFO sfinfo ; // struct to hold info about sound file }; #endif