[][src]Trait fpsdk::plugin::Plugin

pub trait Plugin: Debug + RefUnwindSafe + Send + Sync + 'static {
    fn new(host: Host, tag: Tag) -> Self
    where
        Self: Sized
;
fn info(&self) -> Info;
fn save_state(&mut self, writer: StateWriter);
fn load_state(&mut self, reader: StateReader);
fn on_message(&mut self, message: Message) -> Box<dyn AsRawPtr>;
fn name_of(&self, value: GetName) -> String; fn process_event(&mut self, _event: Event) { ... }
fn process_param(
        &mut self,
        _index: usize,
        _value: ValuePtr,
        _flags: ProcessParamFlags
    ) -> Box<dyn AsRawPtr> { ... }
fn idle(&mut self) { ... }
fn tick(&mut self) { ... }
fn midi_tick(&mut self) { ... }
fn render(&mut self, _input: &[[f32; 2]], _output: &mut [[f32; 2]]) { ... }
fn voice_handler(&mut self) -> Option<&mut dyn ReceiveVoiceHandler> { ... }
fn midi_in(&mut self, _message: MidiMessage) { ... }
fn loop_in(&mut self, _message: ValuePtr) { ... } }

This trait must be implemented for your plugin.

Required methods

fn new(host: Host, tag: Tag) -> Self where
    Self: Sized

Initializer.

fn info(&self) -> Info

Get plugin Info.

fn save_state(&mut self, writer: StateWriter)

Save plugin's state.

fn load_state(&mut self, reader: StateReader)

Load plugin's state.

fn on_message(&mut self, message: Message) -> Box<dyn AsRawPtr>

The host calls this function to request something that isn't done in a specialized function.

See host::Message for possible messages.

Can be called from GUI or mixer threads.

fn name_of(&self, value: GetName) -> String

This is called when the host wants to know a text representation of some value.

Can be called from GUI or mixer threads.

Loading content...

Provided methods

fn process_event(&mut self, _event: Event)

Process an event sent by the host.

Can be called from GUI or mixer threads.

fn process_param(
    &mut self,
    _index: usize,
    _value: ValuePtr,
    _flags: ProcessParamFlags
) -> Box<dyn AsRawPtr>

Something has to be done concerning a parameter. What exactly has to be done is explained by the flags parameter (see ProcessParamFlags).

  • index - the index of the parameter.
  • value - the (new) value of the parameter.
  • flags - describes what needs to be done to the parameter. It can be a combination of several flags.

If ProcessParamFlags::GET_VALUE is specified in flags, the result has to be the value of the parameter.

Can be called from GUI or mixer threads.

fn idle(&mut self)

This function is called continuously. It allows the plugin to perform certain tasks that are not time-critical and which do not take up a lot of time either. For example, in this function you may show a hint message when the mouse moves over a control in the editor.

Called from GUI thread.

fn tick(&mut self)

Gets called before a new tick is mixed (not played), if the plugin added InfoBuilder::want_new_tick into Info.

Internal controller plugins should call host::Host::on_controller from here.

Called from mixer thread.

fn midi_tick(&mut self)

This is called before a new midi tick is played (not mixed).

Can be called from GUI or mixer threads.

fn render(&mut self, _input: &[[f32; 2]], _output: &mut [[f32; 2]])

The processing function. The input buffer is empty for generator plugins.

The buffers are in interlaced 32Bit float stereo format.

Called from mixer thread.

fn voice_handler(&mut self) -> Option<&mut dyn ReceiveVoiceHandler>

Get ReceiveVoiceHandler.

Implement this method if you make a generator plugin.

fn midi_in(&mut self, _message: MidiMessage)

The host will call this when there's new MIDI data available. This function is only called when the plugin has called the host::Host::on_message with plugin::message::WantMidiInput and value set to true.

Can be called from GUI or mixer threads.

fn loop_in(&mut self, _message: ValuePtr)

MAY NOT WORK

This gets called with a new buffered message to the plugin itself.

Loading content...

Implementors

Loading content...