EZAudio
EZAudio copied to clipboard
Resetting EZAudioFile and EZRecorder for New Re-Recording Leads To Crash
Imagine I have one view controller that handles multiple recordings, that is: record once, re-record again, navigate away and come back to reload existing recording.
So... when I record using most of EZAudio sample code - all works good. However, when I record a new recording I have to reset EZRecorder:
self.audioFile = [EZAudioFile audioFileWithURL:[self getFilePathURL] andDelegate:self ]; self.recorder = [EZRecorder recorderWithDestinationURL:[self getFilePathURL] andSourceFormat:self.audioFile.clientFormat];
However that leads to app crash: "Error: Failed to open audio file for reading" at some point.
How to reload EZAudioFile and EZRecorder correctly?
I need that same functionality, I'd be interested in knowing how to do that too. Did you find a safe way to reset EZRecorder
yet? I also need to reset EZAudioPlot
.
Currently on the master branch I added a closeAudioFile
function to the EZRecorder
. I'm finishing up adding a clear
function to the EZAudioPlot
that may be helpful.
I am using the closeAudioFile function with EZRecorder and the clear function with the EZAudioPlot. I am still having crashes when trying to begin recording a second file. Has anyone else solved this? I get the error EXC_BAD_ACCESS associated with the function AudioRingBuffer::GetTimeBounds. I have tried lots of debugging strategies, including NSZombies, trying to catch some over-released object. No dice. Admittedly, I am not an extremely experienced iOS programmer. Any suggestions are welcome.
@Wahoozaboo are you using the same instance of the EZRecorder? Technically, if you close the audio file and create a new instance for your second recording you should be fine.
@syedhali Thanks for responding. I am not not using the same instance. But I was monkeying around with little changes all morning, and switched the order of the methods within the stopRecording call. I think the problem was that I was calling [self.microphone stopFetchingAudio] after [self.recorder closeAudioFile]. Now that I stop fetching audio from the microphone BEFORE closing the audio file, it isn't crashing. I'm going to do some more rigorous testing to make sure that's really all there is to it... Feeling optimistic!
@Wahoozaboo was this the case? Did [self.microphone stopFetchingAudio] before you close the file [self.recorder closeAudioFile] resolve this issue?
@rosiematt Yes, it works for me. Are you having a similar issue? Now my struggle is getting audio monitoring working (I want to be able to play and record, simultaneously. Making a smart phone stethoscope - I want the user to be able to listen while recording a heart sound).
I am still facing this issue, Any updates?
I am still facing this issue, Any updates?