Re: ExtAudioFileWriteAsync is... semi-broken?
Re: ExtAudioFileWriteAsync is... semi-broken?
- Subject: Re: ExtAudioFileWriteAsync is... semi-broken?
- From: Seth Willits <email@hidden>
- Date: Mon, 31 Oct 2011 16:28:06 -0700
Hmm. I did read a suggestion to do that (perhaps it was yours), but it'd have to loop continuously until the writing thread became active and wrote some data to disk freeing up room in the buffer, which then lets the call to ExtAudioFileWriteAsync work eventually, which seems.... odd and wrong. Might as well use a synchronous write?
I really would like to know what the advantages/disadvantages are of sync vs async here. It's a bummer the documentation doesn't touch on that.
--
Seth Willits
On Oct 30, 2011, at 11:42 PM, tahome izwah wrote:
> Did you try looping over the buffer that you're trying to write using
> less frames per EAFWriteAsync call? That solved a similar issue for me
> a while back.
>
> --th
>
> 2011/10/30 Seth Willits <email@hidden>:
>> ExtAudioFileWriteAsync is throwing kExtAudioFileError_AsyncWriteBufferOverflow, and I'm trying to figure out why it happens and what to do about it. The documentation merely says: "An asynchronous write operation could not be completed in time." and offers no suggestions or hints about what to do.
>>
>> Since ExtAudioFileWriteAsync says it writes to a ring buffer, and then that data is continuously written to the file in the background, it seems pretty clear that this buffer has filled up and thus ExtAudioFileWriteAsync throws an error saying it can't write anything else into it.
>>
>> Once this occurs, then what? There's no function to flush the buffer to the file, so there's no way to force it back into a working state, and it's not like I have any indicator as to why the buffer is full or a way to prevent it from becoming full. The only thing I can think of to do is start caching the buffers being given to me (by an AudioOutputUnit), and send them to ExtAudioFileAsync later on. But then that's really kinda wonky and involves extra memory copies etc, but then why use Async at all in that case since I'm basically replicating what it's supposed to be doing. So.... this function seems kinda useless and I dare say semi-broken because I don't see how it can work as intended.
>>
>> A quick change in my app to call the synchronous version instead, works perfectly fine, but I have a feeling that Async exists for a reason, so I'm probably missing some important thing about why Async is better. But what?
>>
>>
>> Any thoughts?
>>
>>
>> --
>> Seth Willits
>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden