[linux-audio-dev] C++ wrapper for libsndfile

Lars Luthman lars.luthman at gmail.com
Sat Jul 29 11:53:19 UTC 2006

On Sat, 2006-07-29 at 21:31 +1000, Erik de Castro Lopo wrote:
> Hi all,
> Thanks to suggestions from people here I now have a relatively
> complete C++ wrapper for libsndfile:
>     http://www.mega-nerd.com/tmp/sndfile.hh
> There is also a pre-release of libsndfile which includes a
> test for this wrapper:
>     http://www.mega-nerd.com/tmp/libsndfile-1.0.17pre7.tar.gz
> C++ users, please comment.

The 4 different overloaded versions of the read, readf, write, and
writef functions will cause ambiguities that will force you to cast them
to their respective types in order to use pointers to them, for example
in functors (e.g. a sigc++ slot), like this:

  mem_fun(sndobj, (sf_count_t (Sndfile::*)(float*,

If they were specialisations of the same template functions instead,
with the sample type as template parameter, you'd only have to write

  mem_fun(sndobj, &Sndfile::read<float>);

which is a lot nicer and easier to read.

Lars Luthman - please encrypt any email sent to me if possible
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x04C77E2E
Fingerprint: FCA7 C790 19B9 322D EB7A E1B3 4371 4650 04C7 7E2E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20060729/9b32f2f7/attachment.pgp>

More information about the Linux-audio-dev mailing list