1
0
Fork 0

Add a port names field on Plugin

This commit is contained in:
Robbert van der Helm 2022-05-28 00:20:32 +02:00
parent 4b760d1c19
commit 625ad06584
2 changed files with 28 additions and 3 deletions

View file

@ -53,6 +53,16 @@ pub trait Plugin: Default + Send + Sync + 'static {
/// `DEFAULT_NUM_INPUTS`.
const DEFAULT_AUX_OUTPUTS: Option<AuxiliaryIOConfig> = None;
/// Optional names for the main and auxiliary input and output ports. Will be generated if not
/// set. This is mostly useful to give descriptive names to the outputs for multi-output
/// plugins.
const PORT_NAMES: PortNames = PortNames {
main_input: None,
main_output: None,
aux_inputs: None,
aux_outputs: None,
};
/// Whether the plugin accepts note events, and what which events it wants to receive. If this
/// is set to [`MidiConfig::None`], then the plugin won't receive any note events.
const MIDI_INPUT: MidiConfig = MidiConfig::None;
@ -326,8 +336,6 @@ pub struct BusConfig {
}
/// Configuration for auxiliary inputs or outputs on [`BusCofnig`].
//
// TODO: Add a way to name these
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct AuxiliaryIOConfig {
/// The number of auxiliary input or output busses.
@ -336,6 +344,23 @@ pub struct AuxiliaryIOConfig {
pub num_channels: u32,
}
/// Contains names for the main input and output ports as well as for all of the auxiliary input and
/// output ports. Setting these is optional, but it makes working with multi-output plugins much
/// more convenient.
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct PortNames {
/// The name for the main input port. Will be generated if not set.
pub main_input: Option<&'static str>,
/// The name for the main output port. Will be generated if not set.
pub main_output: Option<&'static str>,
/// Names for auxiliary (sidechain) input ports. Will be generated if not set or if this slice
/// does not contain enough names.
pub aux_inputs: Option<&'static [&'static str]>,
/// Names for auxiliary output ports. Will be generated if not set or if this slice does not
/// contain enough names.
pub aux_outputs: Option<&'static [&'static str]>,
}
/// Configuration for (the host's) audio buffers.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct BufferConfig {

View file

@ -21,6 +21,6 @@ pub use crate::param::smoothing::{Smoothable, Smoother, SmoothingStyle};
pub use crate::param::{BoolParam, FloatParam, IntParam, Param, ParamFlags};
pub use crate::plugin::{
AuxiliaryBuffers, AuxiliaryIOConfig, BufferConfig, BusConfig, ClapPlugin, Editor,
ParentWindowHandle, Plugin, ProcessMode, ProcessStatus, Vst3Plugin,
ParentWindowHandle, Plugin, PortNames, ProcessMode, ProcessStatus, Vst3Plugin,
};
pub use crate::wrapper::state::PluginState;