[][src]Trait kpal_plugin::PluginAPI

pub trait PluginAPI<E: Error + PluginError + 'static> where
    Self: Sized
{ fn new() -> Result<Self, E>;
fn init(&mut self) -> Result<(), E>;
fn attributes(&self) -> &Attributes<Self, E>; fn attribute_count(&self) -> usize { ... }
fn attribute_ids(&self) -> Vec<usize> { ... }
fn attribute_name(&self, id: usize) -> Result<Ref<CString>, E> { ... }
fn attribute_pre_init(&self, id: usize) -> Result<bool, E> { ... }
fn attribute_value(&self, id: usize, phase: Phase) -> Result<Val, E> { ... }
fn attribute_set_value(
        &self,
        id: usize,
        val: &Val,
        phase: Phase
    ) -> Result<(), E> { ... } }

The set of functions that must be implemented by a plugin.

Required methods

fn new() -> Result<Self, E>

Returns a new instance of the plugin. No initialization of the hardware is performed.

fn init(&mut self) -> Result<(), E>

Initialzes the plugin by performing any hardware initialization.

fn attributes(&self) -> &Attributes<Self, E>

Returns the attributes of the plugin.

Loading content...

Provided methods

fn attribute_count(&self) -> usize

Returns the number of attributes of the plugin.

fn attribute_ids(&self) -> Vec<usize>

Returns the attribute IDs.

fn attribute_name(&self, id: usize) -> Result<Ref<CString>, E>

Returns the name of an attribute.

If the attribute that corresponds to the id does not exist, then an error is returned. Otherwise, the name is returned as a C-compatible &CStr.

Arguments

  • id - the numeric ID of the attribute

fn attribute_pre_init(&self, id: usize) -> Result<bool, E>

Indicates whether an attribute may be set before initialization.

Arguments

id - the numeric ID of the attribute

fn attribute_value(&self, id: usize, phase: Phase) -> Result<Val, E>

Returns the value of an attribute.

If the attribute that corresponds to the id does not exist, then an error is returned. Otherwise, the value is returnd as a C-compatible tagged enum.

Arguments

  • id - the numeric ID of the attribute
  • phase - the lifecycle phase of the plugin that determines which callbacks to use

fn attribute_set_value(
    &self,
    id: usize,
    val: &Val,
    phase: Phase
) -> Result<(), E>

Sets the value of the attribute given by the id.

If the attribute that corresponds to the id does not exist, or if the attribute cannot be set, then an error is returned.

Arguments

  • id - the numeric ID of the attribute
  • val - a reference to a Val instance
  • phase - the lifecycle phase of the plugin that determines which callbacks to use
Loading content...

Implementors

Loading content...