Re: MTCoreAudio, CAAudioFileWriter and conversion
Re: MTCoreAudio, CAAudioFileWriter and conversion
- Subject: Re: MTCoreAudio, CAAudioFileWriter and conversion
- From: Michael Thornburgh <email@hidden>
- Date: Tue, 11 Oct 2005 09:34:49 -0700
if you're using an MTAudioBuffer as i described earlier, then on the
read side feeding your audioFileWriter, the buffer is probably
blocked waiting for more data. i wouldn't be surprised then if the
audioFileWriter->Stop() can't actually do anything.
if audioFileWriter->Stop() is synchronous (that is, it doesn't return
until writing has completed and the file is closed), simply reversing
the order of these two operations should fix that problem. that is:
audioFileWriter->Stop();
[[self recordingDevice] deviceStop];
if audioFileWriter->Stop() is not synchronous, then you will need to
somehow otherwise synchronize the actual stopping/closing of your
output file before doing -deviceStop, so there will still be audio
samples filling the buffer and keeping it from blocking.
-mike
On Oct 11, 2005, at 6:17 AM, Olivier Destrebecq wrote:
In my stop recording message i do the following:
// stop recording
[[self recordingDevice] deviceStop];
audioFileWriter->Stop();
I assume this is enough...
thanks
Olivier Destrebecq
http://otusweb.spymac.com/portfolio/
On Oct 11, 2005, at 2:09 AM, Jens Alfke wrote:
On 10 Oct '05, at 5:45 PM, Olivier Destrebecq wrote:
My code run, the file gets created, but then when i try to open
it with Quicktime, it tells me it cannot open it. Also if i add
code to try to convert to AAC before writing to disk i get an
error. I include the code in this email for your review.
The code you showed us doesn't ever close the output file. Are you
just killing the process after recording enough audio? As far as I
can tell, an AIFF file has to be explicitly closed after writing
the data, so that the writer can either add a necessary trailer or
update the header. Otherwise the file isn't openable.
email@hidden wrote:
My question would be: in minimal lines of code, how would one
save a sampled sound buffer (which MTCoreAudio provides) into an
AIFF file.
It's really easy using CAAudioFile. You call CreateNew() on the
file object, repeatedly call its Write() method passing in a
buffer list, then call Close().
--Jens
_______________________________________________
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