[linux-audio-dev] TAP-plugins reverb presets

Alfons Adriaensen fons.adriaensen at alcatel.be
Fri Mar 5 13:40:08 UTC 2004


On Fri, Mar 05, 2004 at 12:39:56PM +0000, Steve Harris wrote:
> On Fri, Mar 05, 2004 at 01:11:29PM +0100, Alfons Adriaensen wrote:
> > And all it takes is just one hint bit saying that the port is enumerated.
> > The strings themselves are placed in the portnames array, after all the
> > portnames, so no new fields are required. The existing range hints will
> > tell the host how many there are for a port that has the ENUM hint bit set
> > (i.e. max - min + 1). Perfectly backward compatible, and simple.
> 
> I dont think thats very clean myself, and how do you represent the numbers
> that go with the labels?
> 
> eg. gate(1410) has -1.0 -> "key listen", 0.0 -> "gate", 1.0 -> "bypass"
> and you might reasonably want non integer values for enumerations.
> 
> - Steve

HINT_ENUMERATED must always be used together with HINT_INTEGER.
Hosts that have not yet implemented it will see the port as a
normal integer valued port.

It's really the same as a C/C++ enum, which is mapped to integers
whatever the items actually represent. Any mapping from the index
to internal parameter values or logic is done by the plugin code.

An enumerated port would typically correspond to a switch statement
or other program flow logic in your code. If the enum maps to a set
of discrete values for a single parameter, then the labels can of
course represent these values, but that would be for display puposes
only. But in most cases such a port would select between options that
are not logically represented by a single parameter value. Your gate
plugin is a perfect example of this.

Let MIN, MAX be the port range hints.

Then for you example MIN = -1, MAX = 1, and the three string could
be "Key listen", "Gate", "Bypass". The actual range is not important
int this case. For a list of presets one would of course use 0..N-1
or 1..N. It's up to host whether to display the index along with the
label or not. I wouldn't do it.

Appending the labels to the port names array looks very clean to
me. The array becomes in effect an array that contains all strings
required - first the top level ones (port names), then the second
level (enum labels). This is not a dirty trick or an ad-hoc solution,
it could be generalised to higher levels. 


-- 
Fons



More information about the Linux-audio-dev mailing list