ExtAudioFileWriteAsync problem
ExtAudioFileWriteAsync problem
- Subject: ExtAudioFileWriteAsync problem
- From: "tahome izwah" <email@hidden>
- Date: Tue, 25 Jul 2006 12:06:54 +0200
Hi all,
I am currently debugging an application of mine based on the latest
RecordAudioToFile code example. Instead of reading from the default
Audio Unit to record from the audio-in I am creating the data myself
in a short loop like this:
long x = 0.;
for (long i = 0; i < 25; i++)
{
for (long c = 0; c < framesPerWrite; c++)
data[0][c]=data[1][c]=sin(1000.*2.*M_PI*x++/44100.);
err = audioFileWriter->Write(data, framesPerWrite);
if(err != noErr) break;
printf("writing %d\n", i);
}
The two-dimensional data[][] array gets converted to an
AudioBufferList in my call to Write() and then ExtAudioFileWriteAsync
is called to do the actual write to disk, but strange things are
happening. Sometimes the resulting file is 1.2 MB in size (which is
the size it should be), sometimes it's only 180k and sometimes it is
an empty file of 4k. Note that this is the size after
ExtAudioFileDispose so I do not believe it to be a cache problem.
I was able to verify that the problem does not occur when I perform
synchronous writes through ExtAudioFileWrite so I guess it might be a
timing thing... is it possible that successive calls to
ExtAudioFileWriteAsync can cause it to miss data? I am using the same
allocated AudioBufferList for each call and just fill it with new
data...
I am not getting an error from ExtAudioFileWriteAsync either,
everything is running smoothly except that no/not enough data are
being written to the file.
Am I missing something or is this a bug in ExtAudioFileWriteAsync
causing it to return prematurely, ie. before the data are copied to
the internal ring buffer?
Thanks,
Tahome
_______________________________________________
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