(The app uses no output and one channel of input the “zero outputs” and override code are all trying to turn off echoing sound to the internal speaker, which has been an issue)
Strangely, the error happens only occasionally. Since it’s in the app launch cycle I can’t think of anything nondeterministic that might be happening. Anyone seen this or have an idea of what might be going on?
can you post a simple example w/ code that causes the crash? audio is running a separate thread, and it could be that you are doing something that is crashing based on threading. (ie, two threads manipulating the same data). Thread errors are timing related, and can vary from time to time depending on how things are being run, etc.
I solved it by checking the pointers at the start and end of the audio buffer before passing them to a pitch analysis function. I think audioIn was being called sometimes before the buffer was full of samples, and so the pointer to the end of the buffer was null:
void testApp::audioIn (float * input, int bufferSize, int nChannels){
if (input) {
for (int i = 0; i < bufferSize; i++) {
left[i] = input[i];
}
if (&left[0] && &left[bufferSize]) {
// PITCH
AA.input(&left[0], &left[bufferSize]);
AA.process();
Tone const * tone = AA.findTone();
if (tone) {
// ...
}
} // end boundary checking on buffer
} // end if (input)
}
(But, P.S. Are there resources for learning about threads and thread-safety that you’d recommend? So far anything threaded is kind of a black box to me)