Subject: Re: [ecasound] ECI documentation
From: Kai Vehmanen (firstname.lastname@example.org)
Date: Sun Dec 10 2000 - 20:41:38 EET
On Sun, 10 Dec 2000, janne halttunen wrote:
> The introduction of 'command_float_arg' made me realize that also
> ecasound has to parse it's input! I think this aspect of passing info
> with minimal parsing *both ways* should perhaps still need little
> tuning. Example:
> command_with_args('-o', '/dev/dsp')
Uhm, I had to spend quite a bit of time pondering whether to include
'command_float_arg()' or not. It does look ugly, and spoils the look of my
otherwise lean and mean API. :) But in the end, I had to include it
because float is the only return type, which is very difficult to convert
to/from a string without losing precision. This becomes particularly
annoying when you for instance want to get the exact gain factor produced
by -ev. Getting all the bits correctly is very important in this case.
So speed wasn't the main goal here. At least now, my aim is to keep
the parser fairly generic. This means that it can be used both to
handle direct user-input (must survive from incorrecly formatted input,
understand all commands variants, etc), as well as for input from ECI
clients (must be reasonably fast).
And at least in my tests, the parser has been fairly fast. The
critical actions it does are:
- separating the command from the arguments
- identifying direct commands (beginning with '-') and
sending them to the command-line parser (hierarchy of switch
statements and map lookups -> quite fast)
- mapping the EIAM commands from string to integers (using STL map,
search based on a red-black tree, so it's fairly fast; O(log n))
- select the correct subroutine using a switch() statement
So there aren't any really expensive tasks in the code path.
Parsing short string sequences (mostly under 16 bytes) is relatively
cheap when compared to what the engine is doing (millions of bytes
processed every second).
-- . http://www.eca.cx ... [ audio software for linux ] /\ . . http://www.eca.cx/sculpscape [ my armchair-tunes mp3/ra/wav ]
-- To unsubscribe send message 'unsubscribe' in the body of the message to <email@example.com>.
This archive was generated by hypermail 2b28 : Sun Dec 10 2000 - 19:52:08 EET