## AgsLv2Plugin

AgsLv2Plugin — The lv2 plugin class

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_LV2_PLUGIN_DESCRIPTOR()
#define | AGS_LV2_EVENT_BUFFER()
#define | AGS_LV2_EVENT()
#define | AGS_LV2_EVENT_DATA()
#define | AGS_LV2_ATOM_SEQUENCE()
#define | AGS_LV2_ATOM_EVENT()
gboolean | ags_lv2_plugin_test_flags ()
void | ags_lv2_plugin_set_flags ()
void | ags_lv2_plugin_unset_flags ()
LV2_Event_Buffer * | ags_lv2_plugin_event_buffer_alloc ()
void | ags_lv2_plugin_event_buffer_free ()
void | ags_lv2_plugin_event_buffer_realloc_data ()
LV2_Event_Buffer * | ags_lv2_plugin_event_buffer_concat ()
gboolean | ags_lv2_plugin_event_buffer_append_midi ()
gboolean | ags_lv2_plugin_event_buffer_remove_midi ()
void | ags_lv2_plugin_clear_event_buffer ()
gpointer | ags_lv2_plugin_alloc_atom_sequence ()
void | ags_lv2_plugin_atom_sequence_free ()
gboolean | ags_lv2_plugin_atom_sequence_append_midi ()
gboolean | ags_lv2_plugin_atom_sequence_remove_midi ()
void | ags_lv2_plugin_clear_atom_sequence ()
GList * | ags_lv2_plugin_find_uri ()
GList * | ags_lv2_plugin_find_pname ()
void | ags_lv2_plugin_change_program ()
AgsLv2Plugin * | ags_lv2_plugin_new ()

## Properties

char * | doap-name | Read / Write
char * | foaf-homepage | Read / Write
char * | foaf-mbox | Read / Write
char * | foaf-name | Read / Write
AgsTurtle * | manifest | Read / Write
char * | pname | Read / Write
gpointer | preset | Read / Write
AgsTurtle * | turtle | Read / Write
char * | ui-uri | Read / Write
char * | uri | Read / Write

## Signals

void | change-program | Run Last

## Types and Values

enum | AgsLv2PluginFlags

## Object Hierarchy

        GFlags
        ╰── AgsLv2PluginFlags
        GObject
        ╰── AgsBasePlugin
            ╰── AgsLv2Plugin

## Includes

    #include <ags/plugin/ags_lv2_plugin.h>

## Description

The AgsLv2Plugin loads/unloads a Lv2 plugin.

## Functions

### AGS_LV2_PLUGIN_DESCRIPTOR()

    #define AGS_LV2_PLUGIN_DESCRIPTOR(ptr) ((LV2_Descriptor *)(ptr))

### AGS_LV2_EVENT_BUFFER()

    #define AGS_LV2_EVENT_BUFFER(ptr) ((LV2_Event_Buffer *)(ptr))

### AGS_LV2_EVENT()

    #define AGS_LV2_EVENT(ptr) ((LV2_Event *)(ptr))

### AGS_LV2_EVENT_DATA()

    #define AGS_LV2_EVENT_DATA(ptr) ((void *)(ptr + sizeof(LV2_Event)))

### AGS_LV2_ATOM_SEQUENCE()

    #define AGS_LV2_ATOM_SEQUENCE(ptr) ((LV2_Atom_Sequence *)(ptr))

### AGS_LV2_ATOM_EVENT()

    #define AGS_LV2_ATOM_EVENT(ptr) ((LV2_Atom_Event *)(ptr))

### ags_lv2_plugin_test_flags ()

    gboolean
    ags_lv2_plugin_test_flags (AgsLv2Plugin *lv2_plugin,
                               AgsLv2PluginFlags flags);

Test `flags` to be set on `recall` .

#### Parameters

lv2_plugin | the AgsLv2Plugin |
flags | the flags |

#### Returns

`TRUE` if flags are set, else `FALSE`

Since: 3.0.0

### ags_lv2_plugin_set_flags ()

    void
    ags_lv2_plugin_set_flags (AgsLv2Plugin *lv2_plugin,
                              AgsLv2PluginFlags flags);

Set flags.

#### Parameters

lv2_plugin | the AgsLv2Plugin |
flags | the flags |

Since: 3.0.0

### ags_lv2_plugin_unset_flags ()

    void
    ags_lv2_plugin_unset_flags (AgsLv2Plugin *lv2_plugin,
                                AgsLv2PluginFlags flags);

Unset flags.

#### Parameters

lv2_plugin | the AgsLv2Plugin |
flags | the flags |

Since: 3.0.0

### ags_lv2_plugin_event_buffer_alloc ()

    LV2_Event_Buffer *
    ags_lv2_plugin_event_buffer_alloc (guint buffer_size);

Allocate LV2_Event_Buffer struct.

#### Parameters

buffer_size | the data's buffer size |

#### Returns

a new allocated LV2_Event_Buffer.

[type gpointer][transfer none]

Since: 3.0.0

### ags_lv2_plugin_event_buffer_free ()

    void
    ags_lv2_plugin_event_buffer_free (gpointer event_buffer);

Free LV2_Event_Buffer struct.

#### Parameters

event_buffer | the LV2_Event_Buffer struct. | [type gpointer][transfer none]

Since: 3.3.0

### ags_lv2_plugin_event_buffer_realloc_data ()

    void
    ags_lv2_plugin_event_buffer_realloc_data
                                   (LV2_Event_Buffer *event_buffer,
                                    guint buffer_size);

Reallocate LV2_Event_Buffer struct's data field.

#### Parameters

event_buffer | the LV2_Event_Buffer struct. | [type gpointer][transfer none]
buffer_size | the data's buffer size |

Since: 3.0.0

### ags_lv2_plugin_event_buffer_concat ()

    LV2_Event_Buffer *
    ags_lv2_plugin_event_buffer_concat (LV2_Event_Buffer *event_buffer,
                                        ...);

Concats the event buffers.

#### Parameters

event_buffer | the first buffer. | [type gpointer][transfer none]
... | `NULL` terminated variadict arguments |

#### Returns

The newly allocated event buffer.

[type gpointer][transfer none]

Since: 3.0.0

### ags_lv2_plugin_event_buffer_append_midi ()

    gboolean
    ags_lv2_plugin_event_buffer_append_midi
                                   (gpointer event_buffer,
                                    guint buffer_size,
                                    snd_seq_event_t *events,
                                    guint event_count);

Append MIDI data to event buffer.

#### Parameters

event_buffer | the event buffer |
buffer_size | the event buffer size |
events | the events to write. | [type gpointer][transfer none]
event_count | the number of events to write |

#### Returns

`TRUE` on success otherwise `FALSE`

Since: 3.0.0

### ags_lv2_plugin_event_buffer_remove_midi ()

    gboolean
    ags_lv2_plugin_event_buffer_remove_midi
                                   (gpointer event_buffer,
                                    guint buffer_size,
                                    guint note);

Remove MIDI data from event buffer.

#### Parameters

event_buffer | the event buffer |
buffer_size | the event buffer size |
note | the key to remove |

#### Returns

`TRUE` on success otherwise `FALSE`

Since: 3.0.0

### ags_lv2_plugin_clear_event_buffer ()

    void
    ags_lv2_plugin_clear_event_buffer (gpointer event_buffer,
                                       guint buffer_size);

Clear the event buffer.

#### Parameters

event_buffer | the event buffer |
buffer_size | size of `event_buffer` |

Since: 3.0.0

### ags_lv2_plugin_alloc_atom_sequence ()

    gpointer
    ags_lv2_plugin_alloc_atom_sequence (guint sequence_size);

Allocates a LV2_Atom_Sequence

#### Parameters

sequence_size | the requested size |

#### Returns

the new atom sequence

Since: 3.0.0

### ags_lv2_plugin_atom_sequence_free ()

    void
    ags_lv2_plugin_atom_sequence_free (gpointer atom_sequence);

Free atom sequence.

#### Parameters

atom_sequence | the atom sequence |

Since: 3.3.0

### ags_lv2_plugin_atom_sequence_append_midi ()

    gboolean
    ags_lv2_plugin_atom_sequence_append_midi
                                   (gpointer atom_sequence,
                                    guint sequence_size,
                                    snd_seq_event_t *events,
                                    guint event_count);

Append MIDI data to atom sequence.

#### Parameters

atom_sequence | the atom sequence |
sequence_size | the atom sequence size |
events | the events to write. | [type gpointer][transfer none]
event_count | the number of events to write |

#### Returns

`TRUE` on success otherwise `FALSE`

Since: 3.0.0

### ags_lv2_plugin_atom_sequence_remove_midi ()

    gboolean
    ags_lv2_plugin_atom_sequence_remove_midi
                                   (gpointer atom_sequence,
                                    guint sequence_size,
                                    guint note);

Remove MIDI data from atom sequence.

#### Parameters

atom_sequence | the atom sequence |
sequence_size | the atom sequence size |
note | the key to remove |

#### Returns

`TRUE` on success otherwise `FALSE`

Since: 3.0.0

### ags_lv2_plugin_clear_atom_sequence ()

    void
    ags_lv2_plugin_clear_atom_sequence (gpointer atom_sequence,
                                        guint sequence_size);

Clear the atom sequence.

#### Parameters

atom_sequence | the atom sequence |
sequence_size | size of `atom_sequence` |

Since: 3.0.0

### ags_lv2_plugin_find_uri ()

    GList *
    ags_lv2_plugin_find_uri (GList *lv2_plugin,
                             gchar *uri);

Find uri in `lv2_plugin` GList

#### Parameters

lv2_plugin | a GList containig AgsLv2Plugin. | [element-type AgsAudio.Lv2Plugin][transfer none]
uri | the uri to find |

#### Returns

the matching GList containing AgsLv2Plugin.

[element-type AgsAudio.Lv2Plugin][transfer none]

Since: 3.0.0

### ags_lv2_plugin_find_pname ()

    GList *
    ags_lv2_plugin_find_pname (GList *lv2_plugin,
                               gchar *pname);

Find pname in `lv2_plugin` GList

#### Parameters

lv2_plugin | a GList containig AgsLv2Plugin. | [element-type AgsAudio.Lv2Plugin][transfer none]
pname | the pname to find |

#### Returns

the matching GList containing AgsLv2Plugin.

[element-type AgsAudio.Lv2Plugin][transfer none]

Since: 3.0.0

### ags_lv2_plugin_change_program ()

    void
    ags_lv2_plugin_change_program (AgsLv2Plugin *lv2_plugin,
                                   gpointer lv2_handle,
                                   guint bank_index,
                                   guint program_index);

Change program of `lv2_handle` .

#### Parameters

lv2_plugin | the AgsLv2Plugin |
lv2_handle | the lv2 handle |
bank_index | the bank index |
program_index | the program index |

Since: 3.0.0

### ags_lv2_plugin_new ()

    AgsLv2Plugin *
    ags_lv2_plugin_new (AgsTurtle *turtle,
                        gchar *filename,
                        gchar *effect,
                        gchar *uri,
                        guint effect_index);

Creates an AgsLv2Plugin

#### Parameters

turtle | the AgsTurtle |
filename | the plugin .so |
effect | the effect's string representation |
uri | the effect's uri |
effect_index | the effect's index |

#### Returns

a new AgsLv2Plugin

Since: 3.0.0

## Types and Values

### enum AgsLv2PluginFlags

Enum values to control the behavior or indicate internal state of AgsLv2Plugin by enable/disable as flags.

#### Members

AGS_LV2_PLUGIN_IS_SYNTHESIZER | plugin is synthesizer |
AGS_LV2_PLUGIN_NEEDS_WORKER | plugin needs worker |
AGS_LV2_PLUGIN_HAS_PROGRAM_INTERFACE | plugin has program interface |

## Property Details

### The `“doap-name”` property

      “doap-name”                char *

The assigned doap name.

Owner: AgsLv2Plugin

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“foaf-homepage”` property

      “foaf-homepage”            char *

The assigned foaf homepage.

Owner: AgsLv2Plugin

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“foaf-mbox”` property

      “foaf-mbox”                char *

The assigned foaf mbox.

Owner: AgsLv2Plugin

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“foaf-name”` property

      “foaf-name”                char *

The assigned foaf name.

Owner: AgsLv2Plugin

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“manifest”` property

      “manifest”                 AgsTurtle *

The assigned manifest.

Owner: AgsLv2Plugin

Flags: Read / Write

Since: 3.0.0

### The `“pname”` property

      “pname”                    char *

The assigned pname.

Owner: AgsLv2Plugin

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“preset”` property

      “preset”                   gpointer

The assigned preset.

[transfer full]

Owner: AgsLv2Plugin

Flags: Read / Write

Since: 3.0.0

### The `“turtle”` property

      “turtle”                   AgsTurtle *

The assigned turtle.

Owner: AgsLv2Plugin

Flags: Read / Write

Since: 3.0.0

### The `“ui-uri”` property

      “ui-uri”                   char *

The assigned ui-uri.

Owner: AgsLv2Plugin

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“uri”` property

      “uri”                      char *

The assigned uri.

Owner: AgsLv2Plugin

Flags: Read / Write

Default value: NULL

Since: 3.0.0

## Signal Details

### The `“change-program”` signal

    void
    user_function (AgsLv2Plugin *lv2_plugin,
                   gpointer      lv2_handle,
                   guint         bank,
                   guint         program,
                   gpointer      user_data)

The ::change-program signal creates a new instance of plugin.

#### Parameters

lv2_plugin | the plugin to change-program |
lv2_handle | the Lv2 handle |
bank | the bank number |
program | the program number |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0