EZAudio
EZAudio copied to clipboard
Audio plot crashes when entering foreground
Something is wrong with the buffer that I send to updateBuffer:withBufferSize:
. When I try to print buffer[0]
I get error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory
.
This only happens once every five times I bring the app back into foreground. It never happen the first time I run the app. This makes me believe buffer has been released somehow, but that doesn't explain why it doesn't happen every time.

I'm running EZAudio 1.1.5
I think this can be resolved by retaining the data before passing it on to the audio plot. Like this:
let samples: [Float] = self.convertToSamples(buffer, withBufferSize: bufferSize)
self.audioPlot?.updateBuffer(&samples, withBufferSize: UInt32(samples.count))
This seems to solve the problem for me. Or at least make it a lot less probable to crash.