Re: Streaming Graph to file
Re: Streaming Graph to file
- Subject: Re: Streaming Graph to file
- From: William Stewart <email@hidden>
- Date: Fri, 14 Apr 2006 12:11:01 -0700
On 14/04/2006, at 10:07 AM, Brian Whitman wrote:
Like others earlier last month I am also trying to write a graph
out to disk with ExtAudioFile. I keep getting a EXC_BAD_ACCESS on
the writes, the debugger saying "Cannot access memory at 0x4." The
code looks somewhat lke:
outputFormat = AudioStreamBasicDescription: 2 ch, 44100 Hz,
'lpcm' (0x0000000E) 16-bit big-endian signed integer
err = ExtAudioFileCreateNew (&dirFSRef, cfName, fileType,
&outputFormat, NULL, &of); (returns no error)
clientFormat = AudioStreamBasicDescription: 2 ch, 44100 Hz,
'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved (this
is the graph's ASBD, which plays fine otherwise)
err = ExtAudioFileSetProperty(of,
kExtAudioFileProperty_ClientDataFormat, size, &clientFormat);
(returns no error)
err = ExtAudioFileWriteAsync(of, 0, NULL); // priming, returns no
error
Set up the graph, etc.
To the final mixer AU i add a render notify and pass it a ref to my
Obj-C class:
AudioUnitAddRenderNotify(audioUnits->mixerAU, renderMixerProc,
(void*)def);
Start the graph. In the render proc I do:
ExtAudioFileWriteAsync(def->of, inNumberFrames, ioData);
Do you do this on pre or post render? You should be doing this on
PostRender, as that is when:
(1) The buffer will have valid audio contents
(2) The buffer pointers will be set
My suspicion is that you are calling to the Write call from the
render notification, but doing it both at pre and post render. At pre
render, the buffer list probably has NULL data pointers (which the
render call will reset), and the ExtAFWrite call is not checking for
null pointers.
As always, a bug report would be great.
Bill
Which is where the bad access is, on the very first frame (I've
verified that the ABL has data and inNumberFrames is 512.)
On Mar 6, 2006, at 5:40 AM, Karim Morsy wrote:
just a hint in case you haven't already done so... use
ExtAudioFileWriteAsync instead of ExtAudioFileWrite. It is much
easier to use, as it performs the write for you on an internal
thread very efficiently and you don't have to worry about managing
buffers and threads.
before starting your audio capture you should initialize the async
write: ExtAudioFileWriteAsync(outfile, 0, NULL).
_______________________________________________
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
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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