Mercurial > hg > drum-timing-analyser
annotate DrumTimingLoader_OF/ofxAudioFileLoader/LoadedAudioHolder.h @ 3:303edbbcf1bd tip
updated ofxAubioOnsetDetection file
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Sun, 24 Nov 2013 08:15:17 +0000 |
parents | 50ba55abea8c |
children |
rev | line source |
---|---|
andrew@0 | 1 /* |
andrew@0 | 2 * LoadedAudioHolder.h |
andrew@0 | 3 * fileLoaderAndOnsetDetection |
andrew@0 | 4 * |
andrew@0 | 5 * Created by Andrew Robertson on 28/01/2012. |
andrew@0 | 6 * Copyright 2012 QMUL. All rights reserved. |
andrew@0 | 7 * |
andrew@0 | 8 */ |
andrew@0 | 9 |
andrew@0 | 10 //Holds the player ofSoundplayer |
andrew@0 | 11 //and the analysis - ofxSoundFileLoader |
andrew@0 | 12 //latter consists of the audio samples - in AudioFile.h |
andrew@0 | 13 //and the onset detection, chroma and pitch analysis - in ofxAubioOnsetDetection |
andrew@0 | 14 |
andrew@0 | 15 |
andrew@0 | 16 #ifndef LOADED_AUDIO_HOLDER_H |
andrew@0 | 17 #define LOADED_AUDIO_HOLDER_H |
andrew@0 | 18 |
andrew@0 | 19 |
andrew@0 | 20 #include "ofMain.h" |
andrew@0 | 21 #include "ofxSoundFileLoader.h" |
andrew@0 | 22 |
andrew@0 | 23 class LoadedAudioHolder{ |
andrew@0 | 24 |
andrew@0 | 25 public: |
andrew@0 | 26 |
andrew@0 | 27 LoadedAudioHolder(); |
andrew@0 | 28 |
andrew@0 | 29 void updateToPlayPosition(); |
andrew@0 | 30 void updateToMillisPosition(const double& millis); |
andrew@0 | 31 void updatePlaybackPositionToMillis(const double& millis); |
andrew@0 | 32 |
andrew@0 | 33 void draw(); |
andrew@0 | 34 void windowResized(const int& w, const int& h); |
andrew@0 | 35 |
andrew@0 | 36 void loadAudioFile(string soundFileName); |
andrew@0 | 37 |
andrew@0 | 38 void togglePlay();//pauses if playing and vice-versa |
andrew@0 | 39 void stop(); |
andrew@0 | 40 void switchScreens(); |
andrew@0 | 41 |
andrew@0 | 42 void printEvents(); |
andrew@0 | 43 |
andrew@0 | 44 //Samples to show or iterate through |
andrew@0 | 45 ofxSoundFileLoader fileLoader; |
andrew@0 | 46 ofSoundPlayer loadedAudio; |
andrew@0 | 47 std::string loadedFileName; |
andrew@0 | 48 |
andrew@0 | 49 int trackType; |
andrew@0 | 50 void setTrackType(const int& type); |
andrew@0 | 51 |
andrew@0 | 52 typedef vector<double> DoubleVector; |
andrew@2 | 53 DoubleVector onsetTimesMillis;//onset times as measured by the chroma-onset detector |
andrew@2 | 54 |
andrew@2 | 55 typedef vector<int> IntVector; |
andrew@2 | 56 IntVector onsetTimesFrames; |
andrew@2 | 57 |
andrew@0 | 58 void copyOnsetTimes(); |
andrew@0 | 59 |
andrew@0 | 60 private: |
andrew@0 | 61 |
andrew@0 | 62 //Audio To PLay |
andrew@0 | 63 bool audioPlaying, audioPaused; |
andrew@0 | 64 |
andrew@0 | 65 }; |
andrew@0 | 66 #endif |