comparison core/RTAudio.cpp @ 41:4255ecbb9bec ultra-staging

Timers to measure performances, ultra experimental
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 19 May 2015 16:41:07 +0100
parents ad5cd8dd99b3
children 3068421c0737
comparison
equal deleted inserted replaced
40:419ce4ebfc4c 41:4255ecbb9bec
68 // extra confusion in their use cases by passing this argument 68 // extra confusion in their use cases by passing this argument
69 int gNumAudioChannels = 0; 69 int gNumAudioChannels = 0;
70 int gNumAnalogChannels = 0; 70 int gNumAnalogChannels = 0;
71 int gNumDigitalChannels = 0; 71 int gNumDigitalChannels = 0;
72 72
73
74 void printIntervals(){
75 rt_printf("\n");
76 gPRU->renderTimer.print();
77 gPRU->sleepTimer.print();
78 }
79
73 // initAudio() prepares the infrastructure for running PRU-based real-time 80 // initAudio() prepares the infrastructure for running PRU-based real-time
74 // audio, but does not actually start the calculations. 81 // audio, but does not actually start the calculations.
75 // periodSize indicates the number of _sensor_ frames per period: the audio period size 82 // periodSize indicates the number of _sensor_ frames per period: the audio period size
76 // is twice this value. In total, the audio latency in frames will be 4*periodSize, 83 // is twice this value. In total, the audio latency in frames will be 4*periodSize,
77 // plus any latency inherent in the ADCs and DACs themselves. 84 // plus any latency inherent in the ADCs and DACs themselves.
188 analogSampleRate, audioSampleRate, 195 analogSampleRate, audioSampleRate,
189 userData, settings)) { 196 userData, settings)) {
190 cout << "Couldn't initialise audio rendering\n"; 197 cout << "Couldn't initialise audio rendering\n";
191 return 1; 198 return 1;
192 } 199 }
193 200 gPRU->printIntervalsTask=createAuxiliaryTaskLoop(*printIntervals, 10, "transmit-receive-data");
194 return 0; 201 return 0;
195 } 202 }
196 203
197 // audioLoop() is the main function which starts the PRU audio code 204 // audioLoop() is the main function which starts the PRU audio code
198 // and then transfers control to the PRU object. The PRU object in 205 // and then transfers control to the PRU object. The PRU object in
211 rt_printf("Error: unable to start I2C audio codec\n"); 218 rt_printf("Error: unable to start I2C audio codec\n");
212 gShouldStop = 1; 219 gShouldStop = 1;
213 } 220 }
214 else { 221 else {
215 if(gPRU->start(gPRUFilename)) { 222 if(gPRU->start(gPRUFilename)) {
216 rt_printf("Error: unable to start PRU from file %s\n", gPRUFilename); 223 rt_printf("Error: unable to start PRU %s\n", gPRUFilename);
217 gShouldStop = 1; 224 gShouldStop = 1;
218 } 225 }
219 else { 226 else {
220 // All systems go. Run the loop; it will end when gShouldStop is set to 1 227 // All systems go. Run the loop; it will end when gShouldStop is set to 1
221 228