Package voltage.core

# Class VoltagePluginHost

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltagePluginHost

public class VoltagePluginHost extends VoltageComponent
Control to host plugins. Used in Cherry Audio's PlugIn Host modules.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `VoltagePluginHost.MidiMessageWithSampleOffset`
  Constains a MIDI message with a sample time.
  `static enum`
  `VoltagePluginHost.VoltagePluginTypes`
  Types of supported plugins.

- ## Field Summary

  ### Fields inherited from class voltage.core.VoltageComponent

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltagePluginHost(String name, VoltageModule module)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `ClearLastChangedParam()`
  Clear the last parameter changed.
  `int`
  `GetBufferSize()`
  Gets the plugin's buffer size.
  `Rectangle`
  `GetEditorRect()`
  Gets the editor's coordinates and bounding rectangle.
  `int`
  `GetLastChangedParam()`
  Get the last plugin parameter by the user.
  `String`
  `GetManufacturer()`
  Get the manufacturer of the plugin
  `ArrayList<VoltagePluginHost.MidiMessageWithSampleOffset>`
  `GetMidiData()`
  Get any MIDI data from the plugin
  `String`
  `GetName()`
  Get the name of the plugin
  `int`
  `GetNumInputChannels()`
  Gets the number of input channels.
  `int`
  `GetNumOutputChannels()`
  Gets the number of output channels.
  `int`
  `GetNumPrograms()`
  Get the number of presets.
  `String[]`
  `GetParameters()`
  Get the names of automatable parameters.
  `float`
  `GetParameterValue(int paramIndex)`
  Gets a parameter's value.
  `int`
  `GetPluginIndex()`
  Returns the index of a plugin if it has one.
  `String`
  `GetPluginPath(VoltagePluginHost.VoltagePluginTypes plugType)`
  Gets the default plugin path for a specific type of plugin.
  `int`
  `GetProgram()`
  Gets the current preset index.
  `String[]`
  `GetPrograms()`
  Get any presets.
  `byte[]`
  `GetState()`
  Gets the plugin's state data.
  `boolean`
  `Load(String filePath)`
  Load a plugin.
  `boolean`
  `Load(String filePath, int pluginIndex)`
  Load a plugin with a plugin index (Used in VST3s)
  `boolean`
  `Loaded()`
  Is a plugin loaded?
  `boolean`
  `ProcessSamples(float[][] audioBuffer)`
  Process a buffer of samples.
  `void`
  `SetBufferSize(int newBufferSize)`
  Set the buffer size for the plugin.
  `void`
  `SetEditorRect(Rectangle r)`
  Sets the editor's bounds rectangle.
  `void`
  `SetMidiData(ArrayList<VoltagePluginHost.MidiMessageWithSampleOffset> midiDataList)`
  Sends MIDI data to the plugin.
  `void`
  `SetParameters(int[] paramIndices, float[] paramValues)`
  Set a list of parameter's value.
  `void`
  `SetParameterValue(int paramIndex, float newValue)`
  Set a parameter's value.
  `void`
  `SetProgram(int programNum)`
  Sets a new preset.
  `void`
  `SetState(byte[] data)`
  Set the plugin's state data.
  `void`
  `ShowEditor(boolean bShow)`
  Show the plugin's editor.
  `boolean`
  `ShowingEditor()`
  Is the plugin showing?
  `boolean`
  `WasLoadCanceled()`
  Was a load was canceled?

  ### Methods inherited from class voltage.core.VoltageComponent

  `AddChildComponent, GetComponentID, GetDisplayName, GetHeight, GetMaxValue, GetMinValue, GetRect, GetSkin, GetTooltipText, GetTransparency, GetUserProperty, GetValue, GetWidth, GetX, GetY, IsEnabled, IsVisible, RemoveChildComponent, SetCanBeAutomated, SetEnabled, SetPosition, SetRect, SetRect, SetSize, SetSkin, SetTransparency, SetUnits, SetUserProperty, SetValue, SetValue, SetValueNoNotification, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VoltagePluginHost

    public VoltagePluginHost(String name, VoltageModule module)
    Constructor
    Parameters:
      `name` - the internal name.
      `module` - the module this belongs to.

- ## Method Details

  - ### Load

    public boolean Load(String filePath)
    Load a plugin.
    Parameters:
      `filePath` - the path to the plugin.
    Returns:
      true if it has loaded.

  - ### Load

    public boolean Load(String filePath, int pluginIndex)
    Load a plugin with a plugin index (Used in VST3s)
    Parameters:
      `filePath` - the path to the plugin.
      `pluginIndex` - the index of the plugin.
    Returns:
      true if it has loaded.

  - ### Loaded

    public boolean Loaded()
    Is a plugin loaded?
    Returns:
      true if loaded.

  - ### ProcessSamples

    public boolean ProcessSamples(float[][] audioBuffer)
    Process a buffer of samples.
    Parameters:
      `audioBuffer` - a buffer of stereo audio data. ( Up to 4 channels of input data.)
    Returns:
      returns true if processed. The audioBuffer data contains the processed data on return.

  - ### SetMidiData

    public void SetMidiData(ArrayList<VoltagePluginHost.MidiMessageWithSampleOffset> midiDataList)
    Sends MIDI data to the plugin.
    Parameters:
      `midiDataList` - midi events with time offsets.

  - ### GetMidiData

    public ArrayList<VoltagePluginHost.MidiMessageWithSampleOffset> GetMidiData()
    Get any MIDI data from the plugin
    Returns:
      an array of midi data coming from the plugin.

  - ### GetNumInputChannels

    public int GetNumInputChannels()
    Gets the number of input channels.
    Returns:
      the number of input channels.

  - ### GetNumOutputChannels

    public int GetNumOutputChannels()
    Gets the number of output channels.
    Returns:
      the number of output channels.

  - ### GetPluginPath

    public String GetPluginPath(VoltagePluginHost.VoltagePluginTypes plugType)
    Gets the default plugin path for a specific type of plugin.
    Parameters:
      `plugType` - the type of plugin.
    Returns:
      the plugin type path for the plugin type.

  - ### ShowingEditor

    public boolean ShowingEditor()
    Is the plugin showing?
    Returns:
      true if showing.

  - ### ShowEditor

    public void ShowEditor(boolean bShow)
    Show the plugin's editor.
    Parameters:
      `bShow` - true to show. false to hide.

  - ### GetParameters

    public String[] GetParameters()
    Get the names of automatable parameters.
    Returns:
      a list of parameter names.

  - ### SetParameterValue

    public void SetParameterValue(int paramIndex, float newValue)
    Set a parameter's value.
    Parameters:
      `paramIndex` - the index of the parameter to adjust.
      `newValue` - a new value from 0.0 to 1.0.

  - ### SetParameters

    public void SetParameters(int[] paramIndices, float[] paramValues)
    Set a list of parameter's value.
    Parameters:
      `paramIndices` - a list of the parameter to adjust.
      `paramValues` - the values to adjust from 0.0 to 1.0.

  - ### GetParameterValue

    public float GetParameterValue(int paramIndex)
    Gets a parameter's value.
    Parameters:
      `paramIndex` - the index of the parameter.
    Returns:
      the value of the parameter.

  - ### GetState

    public byte[] GetState()
    Gets the plugin's state data. This is useful for restoring a plugin to it's current state.
    Returns:
      the buffer of state data.

  - ### SetState

    public void SetState(byte[] data)
    Set the plugin's state data.
    Parameters:
      `data` - the buffer to set for the plugin.
    See Also:
      - `GetState()`

  - ### SetBufferSize

    public void SetBufferSize(int newBufferSize)
    Set the buffer size for the plugin.
    Parameters:
      `newBufferSize` - the size of the buffer to set for the plugin.

  - ### GetBufferSize

    public int GetBufferSize()
    Gets the plugin's buffer size.
    Returns:
      the buffer size.

  - ### GetEditorRect

    public Rectangle GetEditorRect()
    Gets the editor's coordinates and bounding rectangle. This is useful for restoring it back to its state when loading a preset, etc.
    Returns:
      the bounds of the editor.

  - ### SetEditorRect

    public void SetEditorRect(Rectangle r)
    Sets the editor's bounds rectangle.
    Parameters:
      `r` - the bounds to set the plugin's editor to.

  - ### GetLastChangedParam

    public int GetLastChangedParam()
    Get the last plugin parameter by the user.
    Returns:
      the last plugin parameter index.

  - ### ClearLastChangedParam

    public void ClearLastChangedParam()
    Clear the last parameter changed. This can be used for 'learning' controls.

  - ### GetName

    public String GetName()
    Get the name of the plugin
    Returns:
      the name.

  - ### GetManufacturer

    public String GetManufacturer()
    Get the manufacturer of the plugin
    Returns:
      the manufacturer.

  - ### GetPrograms

    public String[] GetPrograms()
    Get any presets.
    Returns:
      a list of presets.

  - ### GetProgram

    public int GetProgram()
    Gets the current preset index.
    Returns:
      the index of the preset.

  - ### SetProgram

    public void SetProgram(int programNum)
    Sets a new preset.
    Parameters:
      `programNum` - the preset index to load.

  - ### GetNumPrograms

    public int GetNumPrograms()
    Get the number of presets.
    Returns:
      the number of presets.

  - ### GetPluginIndex

    public int GetPluginIndex()
    Returns the index of a plugin if it has one. VST3s are the only plugin that uses indices.
    Returns:
      the index.

  - ### WasLoadCanceled

    public boolean WasLoadCanceled()
    Was a load was canceled?
    Returns:
      true if the plugin load was canceled.