Mercurial > hg > drum-timing-analyser
annotate DrumTimingLoader_OF/ofxAudioFileLoader/ofxSoundFileLoader.h @ 1:106bc2d4f702
added timing analyser file
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Sat, 23 Nov 2013 15:44:47 +0000 |
parents | 82352cfc0b23 |
children |
rev | line source |
---|---|
andrew@0 | 1 /* |
andrew@0 | 2 * ofxSoundFileLoader.h |
andrew@0 | 3 * audioFileLoaderSVN1 |
andrew@0 | 4 * |
andrew@0 | 5 * Created by Andrew on 04/09/2011. |
andrew@0 | 6 * Copyright 2011 QMUL. All rights reserved. |
andrew@0 | 7 * |
andrew@0 | 8 */ |
andrew@0 | 9 |
andrew@0 | 10 #ifndef SOUND_FILE_LOADER_H |
andrew@0 | 11 #define SOUND_FILE_LOADER_H |
andrew@0 | 12 |
andrew@0 | 13 |
andrew@0 | 14 #include "ofMain.h" |
andrew@0 | 15 #include "sndfile.h" |
andrew@0 | 16 #include "AudioFile.h" |
andrew@0 | 17 #include "ofxAubioOnsetDetection.h" |
andrew@0 | 18 |
andrew@0 | 19 |
andrew@0 | 20 #define FRAMESIZE 512 |
andrew@0 | 21 |
andrew@0 | 22 |
andrew@0 | 23 |
andrew@0 | 24 class ofxSoundFileLoader{ |
andrew@0 | 25 |
andrew@0 | 26 public: |
andrew@0 | 27 ofxSoundFileLoader(); |
andrew@0 | 28 ~ofxSoundFileLoader(); |
andrew@0 | 29 float frame[FRAMESIZE]; |
andrew@0 | 30 |
andrew@0 | 31 void updateToAudioPosition(const float& audioPosition); |
andrew@0 | 32 void updateToMillisPosition(const double& millis); |
andrew@0 | 33 void drawFile(); |
andrew@0 | 34 void zoomOut(); |
andrew@0 | 35 void zoomIn(); |
andrew@0 | 36 |
andrew@0 | 37 void loadLibSndFile(const char *infilename); |
andrew@0 | 38 |
andrew@0 | 39 // void openNewFileWithDialogBox(); |
andrew@0 | 40 void loadNewAudio(std::string filename); |
andrew@0 | 41 |
andrew@0 | 42 typedef std::vector<double> DoubleVector; |
andrew@0 | 43 // typedef std::vector<DoubleVector> DoubleMatrix; |
andrew@0 | 44 |
andrew@0 | 45 //0 draws audio vector samples |
andrew@0 | 46 //1 draws the onset fn, pitch and chroma data |
andrew@0 | 47 int screenToDraw; |
andrew@0 | 48 |
andrew@0 | 49 AudioFile audioHolder; |
andrew@0 | 50 |
andrew@0 | 51 ofxAubioOnsetDetection onsetDetect; |
andrew@0 | 52 //chromaOnsetHolder chromaHolder; - add in here |
andrew@0 | 53 |
andrew@0 | 54 int totalNumberOfSamples; |
andrew@0 | 55 |
andrew@0 | 56 void readAudio(); |
andrew@0 | 57 |
andrew@0 | 58 string soundFileName; |
andrew@0 | 59 SNDFILE *infile; // define input and output sound files |
andrew@0 | 60 SF_INFO sfinfo ; // struct to hold info about sound file |
andrew@0 | 61 |
andrew@0 | 62 void freeMemory(); |
andrew@0 | 63 |
andrew@0 | 64 |
andrew@0 | 65 }; |
andrew@0 | 66 #endif |