Re: [LAD] Writing a library?

From: Joshua Boyd <jdboyd@email-addr-hidden>
Date: Wed Jul 23 2008 - 15:41:20 EEST

On Jul 22, 2008, at 10:26 PM, 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.
>
> 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 would prefer to write it in C++, as that's what I know, and even
> then,
> not too well, hence why I thought I'd start with something simple like
> parsing a text file. If anyone has any advice, recommendations, or
> ideas, I'll happily listen and learn. I have yet to think too much
> about
> how the data will be stored in the class, and what methods to make
> available to access it, so if anyone knows any best practices
> there, I'd
> really like to know. Consider this a feeler post.

I'd strongly suggest you consider learning C if you want to maximize
other people using your library. If you write the library in C++ it
will be hard for anyone but C++ users to use it. If you write it in
straight C, or at least expose a plain C interface, it will be
trivial to use for C users, C++ users, Objective C users, Python
users, Smalltalk users and some scheme and lisp users, and I'm sure
I'm missing other languages that can interface with C easily.

Also, I suggest that you learn how to use a lex program like Flex.
You could also possibly use a parser generator, something like yacc/
bison on top of that. The time spent learning flex will be time very
well spent and the time spent learning it will probably pay itself
back immediately as your write your tokenizer. There are quite a few
good free lex and/or yacc guides available, often on university web
sites.
_______________________________________________
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 16:15:04 2008

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2008 - 16:15:04 EEST