From owner-freebsd-questions@FreeBSD.ORG Thu Dec 31 20:44:38 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3C9D1065695 for ; Thu, 31 Dec 2009 20:44:37 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr9.xs4all.nl (smtp-vbr9.xs4all.nl [194.109.24.29]) by mx1.freebsd.org (Postfix) with ESMTP id 8808A8FC1E for ; Thu, 31 Dec 2009 20:44:37 +0000 (UTC) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr9.xs4all.nl (8.13.8/8.13.8) with ESMTP id nBVKiX23068550; Thu, 31 Dec 2009 21:44:34 +0100 (CET) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id C57C7BAAB; Thu, 31 Dec 2009 21:44:33 +0100 (CET) Date: Thu, 31 Dec 2009 21:44:33 +0100 From: Roland Smith To: Gary Kline Message-ID: <20091231204433.GA48113@slackbox.xs4all.nl> References: <20091231093637.GA1832@thought.org> <447hs3kmco.fsf@be-well.ilk.org> <20091231201117.GB3733@thought.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline In-Reply-To: <20091231201117.GB3733@thought.org> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: Lowell Gilbert , FreeBSD Mailing List Subject: Re: is there a way to convert an audio file into a char array? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 20:44:38 -0000 --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--