On Thu, 2008-04-17 at 13:08 +0200, Pau Arumí wrote:
So basically
it's just a more descriptive way of referencing plugin
ports. You could just as well use the indices and the number of ports
directly and don't bother with lv2peg, but it's nice to have while
working on a plugin with lots of ports where you may remove and add
ports while hacking, or change ranges and default values (those things
are also included in the output of lv2peg). There is more info and some
examples at
http://lv2plug.in/lv2pftci/
Now it all makes sense. Thanks.
However I'd like to see the entire example (the link lv2pftci seems
dead). If available, could you point to the generated gain.peg and the
human written RDF? (Or an equivalent example)
Sorry, I got my addresses mixed up. The correct one is
http://ll-plugins.nongnu.org/lv2pftci .
For the example in the thread above the RDF would look something like
this:
@prefix lv2: <http://lv2plug.in/ns/lv2core#>.
@prefix doap: <http://usefulinc.com/ns/doap#>.
@prefix ll: <http://ll-plugins.nongnu.org/lv2/namespace#>.
<http://my.plugin/>
a lv2:Plugin;
lv2:binary <gain.so>;
doap:name "Gain";
doap:license <http://usefulinc.com/doap/licenses/gpl>;
ll:pegName "p";
lv2:port [
a lv2:AudioPort, lv2:InputPort;
lv2:index 0;
lv2:symbol "in";
lv2:name "Input";
],
[
a lv2:AudioPort, lv2:OutputPort;
lv2:index 1;
lv2:symbol "out";
lv2:name "Output";
],
[
a lv2:ControlPort, lv2:OutputPort;
lv2:index 2;
lv2:symbol "gain";
lv2:name "Gain";
].
...and lv2peg would output this:
#ifndef gain_peg
#define gain_peg
#ifndef PEG_STRUCT
#define PEG_STRUCT
typedef struct {
float min;
float max;
float default_value;
char toggled;
char integer;
char logarithmic;
} peg_data_t;
#endif
/* <http://my.plugin/> */
static const char p_uri[] = "http://my.plugin/";
enum p_port_enum {
p_in,
p_out,
p_gain,
p_n_ports
};
static const peg_data_t p_ports[] = {
{ -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 },
{ -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 },
{ -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 },
};
#endif /* gain_peg */
Since no ranges or default values are given for the ports -FLT_MAX and
FLT_MAX are used, that's where the 3.40282e+38s come from.
--ll