andrew@0: /* andrew@0: * LoadedAudioHolder.h andrew@0: * fileLoaderAndOnsetDetection andrew@0: * andrew@0: * Created by Andrew Robertson on 28/01/2012. andrew@0: * Copyright 2012 QMUL. All rights reserved. andrew@0: * andrew@0: */ andrew@0: andrew@0: //Holds the player ofSoundplayer andrew@0: //and the analysis - ofxSoundFileLoader andrew@0: //latter consists of the audio samples - in AudioFile.h andrew@0: //and the onset detection, chroma and pitch analysis - in ofxAubioOnsetDetection andrew@0: andrew@0: andrew@0: #ifndef LOADED_AUDIO_HOLDER_H andrew@0: #define LOADED_AUDIO_HOLDER_H andrew@0: andrew@0: andrew@0: #include "ofMain.h" andrew@0: #include "ofxSoundFileLoader.h" andrew@0: andrew@0: class LoadedAudioHolder{ andrew@0: andrew@0: public: andrew@0: andrew@0: LoadedAudioHolder(); andrew@0: andrew@0: void updateToPlayPosition(); andrew@0: void updateToMillisPosition(const double& millis); andrew@0: void updatePlaybackPositionToMillis(const double& millis); andrew@0: andrew@0: void draw(); andrew@0: void windowResized(const int& w, const int& h); andrew@0: andrew@0: void loadAudioFile(string soundFileName); andrew@0: andrew@0: void togglePlay();//pauses if playing and vice-versa andrew@0: void stop(); andrew@0: void switchScreens(); andrew@0: andrew@0: void printEvents(); andrew@0: andrew@0: //Samples to show or iterate through andrew@0: ofxSoundFileLoader fileLoader; andrew@0: ofSoundPlayer loadedAudio; andrew@0: std::string loadedFileName; andrew@0: andrew@0: int trackType; andrew@0: void setTrackType(const int& type); andrew@0: andrew@0: typedef vector DoubleVector; andrew@2: DoubleVector onsetTimesMillis;//onset times as measured by the chroma-onset detector andrew@2: andrew@2: typedef vector IntVector; andrew@2: IntVector onsetTimesFrames; andrew@2: andrew@0: void copyOnsetTimes(); andrew@0: andrew@0: private: andrew@0: andrew@0: //Audio To PLay andrew@0: bool audioPlaying, audioPaused; andrew@0: andrew@0: }; andrew@0: #endif