comparison src/testApp.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
comparison
equal deleted inserted replaced
2:179c09199b3c 3:5e188c0035b6
32 eventMatcher.recordedTracks.loadTestAudio(); 32 eventMatcher.recordedTracks.loadTestAudio();
33 33
34 34
35 //audioFilePlayer.loadAudioFile(infilename); 35 //audioFilePlayer.loadAudioFile(infilename);
36 } 36 }
37 /* 37
38 void testApp::loadTestAudio(){
39
40
41 const char *infilename = "../../../data/sound/bach4_short1.wav";
42
43 //LoadedAudioHolder lah;
44 // lah.loadAudioFile(infilename);
45 // loadedAudioFiles.push_back(lah);
46
47 //Take care here - we need a pointer to create new instance
48 //but not then delete the instance before the vector of all audio tracks has been used
49 //the above code using lah has problem that it deletes objects once out of the scope of testApp.setup()
50 //when lah is in theory no longer used - something like that possible? - at least pointers to onset detection seem deleted
51 loadedAudioPtr = new LoadedAudioHolder;
52 loadedAudioPtr->loadAudioFile(infilename);
53 // loadedAudioFiles.push_back(*loadedAudioPtr);
54 loadedAudioFiles[0] = *loadedAudioPtr;
55
56 loadedAudioFiles[0].fileLoader.onsetDetect.window.setToRelativeSize(0, 0.0, 1, 0.25);
57
58 // printf("Loaded audio %i\n", (int)numberOfAudioTracks);
59 printf("loaded max val is %f\n", loadedAudioFiles[0].fileLoader.onsetDetect.onsetDetector.maximumDetectionValue);
60
61 printf("BEFORE LOADING 1\n");
62 keyPressed('p');
63
64 loadedAudioPtr = new LoadedAudioHolder;
65 loadedAudioPtr->loadAudioFile(infilename);
66 // loadedAudioFiles.push_back(*loadedAudioPtr);
67 loadedAudioFiles[1] = *loadedAudioPtr;
68 loadedAudioFiles[1].fileLoader.onsetDetect.window.setToRelativeSize(0, 0.3, 1, 0.25);
69
70 printf("AFTER LOADING 1\n");
71 keyPressed('p');
72
73 }
74 */
75 38
76 //-------------------------------------------------------------- 39 //--------------------------------------------------------------
77 void testApp::update(){ 40 void testApp::update(){
78 41
79 eventMatcher.recordedTracks.updatePosition(); 42 eventMatcher.recordedTracks.updatePosition();
94 57
95 // check for mouse moved message 58 // check for mouse moved message
96 if ( m.getAddress() == "/aubioPitch" ){ 59 if ( m.getAddress() == "/aubioPitch" ){
97 float pitchIn = m.getArgAsFloat(0); 60 float pitchIn = m.getArgAsFloat(0);
98 int timeIn = m.getArgAsInt32(1); 61 int timeIn = m.getArgAsInt32(1);
99 printf("AUBIO PITCH RECEIVED %f at time %i\n", pitchIn, timeIn); 62 printf("\nAUBIO PITCH RECEIVED %f at time %i\n", pitchIn, timeIn);
100 eventMatcher.newPitchEvent(pitchIn, timeIn); 63 eventMatcher.newPitchEvent(pitchIn, timeIn);
101 } 64 }
102 65
103 if ( m.getAddress() == "/kick" ){ 66 if ( m.getAddress() == "/kick" ){
104 // float pitchIn = m.getArgAsFloat(0); 67 // float pitchIn = m.getArgAsFloat(0);
110 if ( m.getAddress() == "/snare" ){ 73 if ( m.getAddress() == "/snare" ){
111 // float pitchIn = m.getArgAsFloat(0); 74 // float pitchIn = m.getArgAsFloat(0);
112 double timeIn = m.getArgAsInt32(0); 75 double timeIn = m.getArgAsInt32(0);
113 printf("snare RECEIVED at time %f\n", timeIn); 76 printf("snare RECEIVED at time %f\n", timeIn);
114 eventMatcher.newSnareEvent(timeIn); 77 eventMatcher.newSnareEvent(timeIn);
78 }
79
80 if ( m.getAddress() == "/start" ){
81 printf("start!\n");
82 eventMatcher.startPlaying();
115 } 83 }
116 } 84 }
117 } 85 }
118 86
119 //-------------------------------------------------------------- 87 //--------------------------------------------------------------
168 openNewAudioFileWithdialogBox(); 136 openNewAudioFileWithdialogBox();
169 137
170 } 138 }
171 139
172 if (key == 'p'){ 140 if (key == 'p'){
173 141 eventMatcher.bayesianStruct.posterior.printArray();
174 } 142 }
175 143
176 144
177 if (key == OF_KEY_UP){ 145 if (key == OF_KEY_UP){
178 eventMatcher.recordedTracks.zoomOut(); 146 eventMatcher.recordedTracks.zoomOut();