Mercurial > hg > multitrack-audio-matcher
view src/RecordedMultitrackAudio.cpp @ 3:5e188c0035b6
checking the offsets of the arrays
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Wed, 01 Feb 2012 16:05:26 +0000 |
parents | 179c09199b3c |
children | 746a5af43c02 |
line wrap: on
line source
/* * RecordedMultitrackAudio.cpp * MultipleAudioMathcher * * Created by Andrew on 31/01/2012. * Copyright 2012 QMUL. All rights reserved. * */ #include "RecordedMultitrackAudio.h" void RecordedMultitrackAudio::loadTestAudio(){ const char *infilename = "../../../data/sound/basicClavScale.wav"; //LoadedAudioHolder lah; // lah.loadAudioFile(infilename); // loadedAudioFiles.push_back(lah); //Take care here - we need a pointer to create new instance //but not then delete the instance before the vector of all audio tracks has been used //the above code using lah has problem that it deletes objects once out of the scope of testApp.setup() //when lah is in theory no longer used - something like that possible? - at least pointers to onset detection seem deleted loadedAudioPtr = new LoadedAudioHolder(); loadedAudioPtr->loadAudioFile(infilename); // loadedAudioFiles.push_back(*loadedAudioPtr); loadedAudioFiles[0] = *loadedAudioPtr; loadedAudioFiles[0].fileLoader.onsetDetect.window.setToRelativeSize(0, 0.0, 1, 0.2); loadedAudioFiles[0].setTrackType(0);// fileLoader.onsetDetect.trackType = 0; // printf("Loaded audio %i\n", (int)numberOfAudioTracks); printf("loaded max val is %f\n", loadedAudioFiles[0].fileLoader.onsetDetect.onsetDetector.maximumDetectionValue); printf("BEFORE LOADING 1\n"); printInfo(); infilename = "../../../data/sound/basicClavScale2.wav"; loadedAudioPtr = new LoadedAudioHolder; loadedAudioPtr->loadAudioFile(infilename); // loadedAudioFiles.push_back(*loadedAudioPtr); loadedAudioFiles[1] = *loadedAudioPtr; loadedAudioFiles[1].fileLoader.onsetDetect.window.setToRelativeSize(0, 0.2, 1, 0.2); loadedAudioFiles[1].setTrackType(1); // loadedAudioFiles[1].fileLoader.onsetDetect.trackType = 0; printf("AFTER LOADING 1\n"); printInfo(); numberOfAudioTracks = 2; } void RecordedMultitrackAudio::drawTracks(){ for (int i = 0;i < numberOfAudioTracks;i++){ loadedAudioFiles[i].draw(); } ofDrawBitmapString("pitch "+ofToString(recentPitch, 2), 20, 20); } void RecordedMultitrackAudio::updatePosition(){ for (int i = 0;i < numberOfAudioTracks;i++) loadedAudioFiles[i].updateToPlayPosition(); } void RecordedMultitrackAudio::switchScreens(){ for (int i = 0;i < numberOfAudioTracks;i++) loadedAudioFiles[i].switchScreens(); } void RecordedMultitrackAudio::togglePlay(){ for (int i = 0;i < numberOfAudioTracks;i++) loadedAudioFiles[i].togglePlay(); } void RecordedMultitrackAudio::stop(){ for (int i = 0;i < numberOfAudioTracks;i++) loadedAudioFiles[i].stop(); } void RecordedMultitrackAudio::printInfo(){ loadedAudioFiles[0].fileLoader.onsetDetect.printChromaInfo(); loadedAudioFiles[0].printEvents(); } void RecordedMultitrackAudio::windowResized(const int& w, const int& h){ for (int i = 0;i < numberOfAudioTracks;i++) loadedAudioFiles[i].windowResized(w, h); } void RecordedMultitrackAudio::zoomIn(){ for (int i = 0;i < numberOfAudioTracks;i++) loadedAudioFiles[i].fileLoader.zoomIn(); } void RecordedMultitrackAudio::zoomOut(){ for (int i = 0;i < numberOfAudioTracks;i++) loadedAudioFiles[i].fileLoader.zoomOut(); }