Re: [LAD] Writing a library?

From: Erik de Castro Lopo <mle+la@email-addr-hidden-nerd.com>
Date: Wed Jul 23 2008 - 06:51:54 EEST

Darren Landrum wrote:

> I've been looking around for a library to read and write SFZ files,
> which is an open sampler format released by Cakewalk:
>
> http://www.cakewalk.com/DevXchange/sfz.asp
>
> Finding none, I thought I might try my hand at writing a library for
> this myself, as there is no embedded wave information like with Gig
> files. SFZ is simply a text file to be parsed.

Back in the early 1990s I started out writing a library to read WAV
files. I soon realised that I also wanted to read AIFF and AU files.
It then occured to me that rather than write three libraries I should
write one library that abstracts away the three different formats and
provide a single API to read/write all three (and possibly more) file
types. That library became libsndfile:

    http://www.mega-nerd.com/libsndfile/

Since there is already a library to read Gig files and I believe
another to read Sound Fonts (swami?) maybe you should look towards
unifying the reading of all these formats rather similar through one
API.

> Now, I know about writing a good header file, and its associated class,
> and all that, but I have no knowledge of how to write it as a dynamic
> library. Google searches on every possible permutation have been
> worthless to me as well.

I use autoconf/automake/libtool for this because for me thats the
easiest way to create a cross-platfrom build system.

For a relatively simple usage of these tools have a look at

    http://www.mega-nerd.com/SRC/

I leant these tools by hacking other peoples projects because the
documentation was so poor. Currently the documentation for these
tools is good *reference* docs, but still pretty overwhelming if
you're new to them/

> I would prefer to write it in C++,

Feel free to write the internals in whatever language you like,
but please consider providing a pure C API.

Writing wrappers for languages like Python, Perl, Ruby etc is far
easier if the API is a C API than if it is C++.

HTH,
Erik

-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"If I were on life-support, I'd rather have it run by a Gameboy
than a Windows box."
-- Cliff Wells in comp.lang.python
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Wed Jul 23 08:15:02 2008

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2008 - 08:15:02 EEST