Date: Thu, 31 Dec 2009 21:44:33 +0100 From: Roland Smith <rsmith@xs4all.nl> To: Gary Kline <kline@thought.org> Cc: Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>, FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: is there a way to convert an audio file into a char array? Message-ID: <20091231204433.GA48113@slackbox.xs4all.nl> In-Reply-To: <20091231201117.GB3733@thought.org> References: <20091231093637.GA1832@thought.org> <447hs3kmco.fsf@be-well.ilk.org> <20091231201117.GB3733@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 31, 2009 at 12:11:17PM -0800, Gary Kline wrote: >=20 > 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 mem= ory 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 --=20 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) --2oS5YaxWCcQjTEyO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAks9DTEACgkQEnfvsMMhpyUkXACdER4h1yej2GkIt5zMMwC6ZWA9 7IcAmgNvDzzy42WUUWXCs1sDXysqDqQ9 =2ush -----END PGP SIGNATURE----- --2oS5YaxWCcQjTEyO--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091231204433.GA48113>