Subject: Re: [linux-audio-dev] API design again
From: Paul Barton-Davis (pbd@Op.Net)
Date: ke loka 06 1999 - 21:55:38 EDT
>If it was only about the 5% (or whatever) of CPU time, I would have
>dropped the buffered event system. But how do you generate and/or
>process events in a system where plug-ins don't know about events? I
>see events as data that can be processed - not just a simple
>parameter control interface.
Its not about keeping the event system hidden from the plugin. Its
about separating the delivery of real-time information about the state
of the world from the request to process some sound.
Clearly, a plugin must still be able to handle state changes. But the
code to do that will, in most cases, simple be resetting variables,
setting flags, etc. This is quite distinct from the task done by
process(). If an event generates or actually contains data to be
processed, then it goes into the plugin via process(). If it merely
tells us about a state change ("MIDI NoteOn", "GUI says value shifted
to 0.92", etc.), then the plugin gets told via (we'll call it ...)
notify().
Think of it another way. Lets suppose I have the code for the Antares
AutoTune TDM plugin. Lets suppose its written without any idea of an
event system, it might even be written without much idea that its a
plugin at all.
If I want to use this code as a plugin for <insert-plugin-API-name-here>,
then there are two possibilities that I can see:
1) if the API passes an event buffer to process()
- I need to write a wrapper for the code along the lines suggested
by Roger Larsson.
2) if the API passes events to a separate function, and a frame count
to process()
- I can probably use the code as-is, and add an event-handling
function.
So, in both cases, I'll have to do some real work. Which is better ?
My guess, and its only a guess, is that for the most part, it will be
less work, and less disruptive to the code, to use (2). But I could be
wrong. I see this as a key question, because the idea that the only
code to be used with a plugin API will be new code is crazy - reuse is
part of the whole joy of open source, and
reuse-without-excessive-rewriting is even better.
And if anyone *does* have the Antares AutoTune source code, please
post it ! :))
--p
This archive was generated by hypermail 2b28 : ke maalis 08 2000 - 13:40:59 EST