is there a way to convert an audio file into a char array?
Roland Smith
rsmith at xs4all.nl
Thu Dec 31 20:44:38 UTC 2009
On Thu, Dec 31, 2009 at 12:11:17PM -0800, Gary Kline wrote:
>
> Yeah, I views the file with od -c; but wouldn't it be much faster
> to have the data file part of my test program than having to open,
> read, cat thru /dev/dsp each time, close file? I stole the cat
> from the K&R book, and by reading the click.h data file it seems
> everything would go much faster.
Just read them all once, at start-up and store them in a buffer. You could use
mmap(2), but if the sound fragments are small, that might be a waste of memory
becasue mmap maps at least a page.
I'll send you a utility function I've written to read files into memory off-list.
Roland
--
R.F.Smith http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20091231/deb00da0/attachment.pgp
More information about the freebsd-questions
mailing list