# Ports

const LilvNode *lilv_port_get_node(const LilvPlugin *plugin, const LilvPort *port)

  Get the RDF node of `port`.

  Ports nodes may be may be URIs or blank nodes.

  Returns:

    A shared node which must not be modified or freed.

LilvNodes *lilv_port_get_value(const LilvPlugin *plugin, const LilvPort *port, const LilvNode *predicate)

  Port analog of `lilv_plugin_get_value()`.

LilvNode *lilv_port_get(const LilvPlugin *plugin, const LilvPort *port, const LilvNode *predicate)

  Get a single property value of a port.

  This is equivalent to lilv_nodes_get_first(lilv_port_get_value(…)) but is simpler to use in the common case of only caring about one value. The caller is responsible for freeing the returned node.

LilvNodes *lilv_port_get_properties(const LilvPlugin *plugin, const LilvPort *port)

  Return the LV2 port properties of a port.

bool lilv_port_has_property(const LilvPlugin *plugin, const LilvPort *port, const LilvNode *property)

  Return whether a port has a certain property.

bool lilv_port_supports_event(const LilvPlugin *plugin, const LilvPort *port, const LilvNode *event_type)

  Return whether a port supports a certain event type.

  More precisely, this returns true iff the port has an atom:supports or an ev:supportsEvent property with `event_type` as the value.

uint32_t lilv_port_get_index(const LilvPlugin *plugin, const LilvPort *port)

  Get the index of a port.

  The index is only valid for the life of the plugin and may change between versions. For a stable identifier, use the symbol.

const LilvNode *lilv_port_get_symbol(const LilvPlugin *plugin, const LilvPort *port)

  Get the symbol of a port.

  The ‘symbol’ is a short string, a valid C identifier. Returned value is owned by `port` and must not be freed.

LilvNode *lilv_port_get_name(const LilvPlugin *plugin, const LilvPort *port)

  Get the name of a port.

  This is guaranteed to return the untranslated name (the doap:name in the data file without a language tag). Returned value must be freed by the caller.

const LilvNodes *lilv_port_get_classes(const LilvPlugin *plugin, const LilvPort *port)

  Get all the classes of a port.

  This can be used to determine if a port is an input, output, audio, control, midi, etc, etc, though it’s simpler to use `lilv_port_is_a()`. The returned list does not include lv2:Port, which is implied. Returned value is shared and must not be destroyed by caller.

bool lilv_port_is_a(const LilvPlugin *plugin, const LilvPort *port, const LilvNode *port_class)

  Determine if a port is of a given class (input, output, audio, etc).

  For convenience/performance/extensibility reasons, hosts are expected to create a LilvNode for each port class they “care about”. Well-known type URI strings like `LILV_URI_INPUT_PORT` are defined for convenience, but this function is designed so that Lilv is usable with any port types without requiring explicit support in Lilv.

void lilv_port_get_range(const LilvPlugin *plugin, const LilvPort *port, LilvNode **def, LilvNode **min, LilvNode **max)

  Get the default, minimum, and maximum values of a port.

  `def`, `min`, and `max` are outputs, pass pointers to uninitialized LilvNode* variables. These will be set to point at new values (which must be freed by the caller using `lilv_node_free()`), or NULL if the value does not exist.

LilvScalePoints *lilv_port_get_scale_points(const LilvPlugin *plugin, const LilvPort *port)

  Get the scale points (enumeration values) of a port.

  This returns a collection of ‘interesting’ named values of a port, which for example might be appropriate entries for a value selector in a UI.

  Returned value may be NULL if `port` has no scale points, otherwise it must be freed by caller with lilv_scale_points_free().