Re: Simple AudioFile Copy program
Re: Simple AudioFile Copy program
- Subject: Re: Simple AudioFile Copy program
- From: David Duncan <email@hidden>
- Date: Sun, 9 Nov 2003 00:42:01 -0500
On Nov 9, 2003, at 12:12 AM, James Baxter wrote:
I think here
err = AudioFileReadBytes(fileHandle, 0, 0, (UInt32
*)&bcnt, myData);
and here
err = AudioFileWriteBytes (newFileHandle,
0,
0,
(UInt32 *)&bcnt,
myData);
are your main problems, because you are treating bcnt as a UInt32, but
have it declared as a UInt64. When you take the address and cast the
pointer, you are pointing to the wrong 32-bits of the integer -
essentially dividing the file size by 4 billion. Since you say the file
is 1.88MB, you are basically requesting, and then writing zero bytes to
the file.
A couple of observations: 1) If you plan to alter the data enroute to
another file, then you should read in smaller chunks, in case one day
you are faced with a REALLY big file to handle and 2) If you don't plan
to modify the file at all, then you should use standard block
reading/writing routines instead of Audio File, as this will give you
better performance (and with less coding overhead).
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.
David Duncan
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.