1
0
Fork 0

Rename DEFAULT_NUM_INPUTS and DEFAULT_NUM_OUTPUTS

This commit is contained in:
Robbert van der Helm 2022-08-19 14:34:21 +02:00
parent 743d456e0f
commit 1a706ea1c7
20 changed files with 70 additions and 63 deletions

View file

@ -6,6 +6,13 @@ new and what's changed, this document lists all breaking changes in reverse
chronological order. If a new feature did not require any changes to existing
code then it will not be listed here.
## [2022-08-19]
- `Plugin::DEFAULT_NUM_INPUTS` and `Plugin::DEFAULT_NUM_OUTPUTS` have been
renamed to `Plugin::DEFAULT_INPUT_CHANNELS` and
`Plugin::DEFAULT_OUTPUT_CHANNELS` respectively to avoid confusion as these
constants only affect the main input and output.
## [2022-07-18]
- `IntRange` and `FloatRange` no longer have min/max methods and instead have

View file

@ -302,8 +302,8 @@ impl Plugin for Crisp {
const VERSION: &'static str = "0.1.0";
const DEFAULT_NUM_INPUTS: u32 = NUM_CHANNELS;
const DEFAULT_NUM_OUTPUTS: u32 = NUM_CHANNELS;
const DEFAULT_INPUT_CHANNELS: u32 = NUM_CHANNELS;
const DEFAULT_OUTPUT_CHANNELS: u32 = NUM_CHANNELS;
const SAMPLE_ACCURATE_AUTOMATION: bool = true;

View file

@ -166,8 +166,8 @@ impl Plugin for Crossover {
const VERSION: &'static str = "0.1.0";
const DEFAULT_NUM_INPUTS: u32 = NUM_CHANNELS;
const DEFAULT_NUM_OUTPUTS: u32 = NUM_CHANNELS;
const DEFAULT_INPUT_CHANNELS: u32 = NUM_CHANNELS;
const DEFAULT_OUTPUT_CHANNELS: u32 = NUM_CHANNELS;
const DEFAULT_AUX_OUTPUTS: Option<AuxiliaryIOConfig> = Some(AuxiliaryIOConfig {
// Two to five of these busses will be used at a time

View file

@ -121,7 +121,7 @@ impl Default for Diopser {
// We only do stereo right now so this is simple
let (spectrum_input, spectrum_output) =
SpectrumInput::new(Self::DEFAULT_NUM_OUTPUTS as usize);
SpectrumInput::new(Self::DEFAULT_OUTPUT_CHANNELS as usize);
Self {
params: Arc::new(DiopserParams::new(should_update_filters.clone())),
@ -247,8 +247,8 @@ impl Plugin for Diopser {
const VERSION: &'static str = "0.2.0";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const SAMPLE_ACCURATE_AUTOMATION: bool = true;

View file

@ -110,8 +110,8 @@ impl Plugin for Gain {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const DEFAULT_AUX_INPUTS: Option<AuxiliaryIOConfig> = None;
const DEFAULT_AUX_OUTPUTS: Option<AuxiliaryIOConfig> = None;

View file

@ -75,8 +75,8 @@ impl Plugin for Gain {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const SAMPLE_ACCURATE_AUTOMATION: bool = true;

View file

@ -72,8 +72,8 @@ impl Plugin for Gain {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const SAMPLE_ACCURATE_AUTOMATION: bool = true;

View file

@ -71,8 +71,8 @@ impl Plugin for Gain {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const SAMPLE_ACCURATE_AUTOMATION: bool = true;

View file

@ -26,8 +26,8 @@ impl Plugin for MidiInverter {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 0;
const DEFAULT_NUM_OUTPUTS: u32 = 0;
const DEFAULT_INPUT_CHANNELS: u32 = 0;
const DEFAULT_OUTPUT_CHANNELS: u32 = 0;
const MIDI_INPUT: MidiConfig = MidiConfig::MidiCCs;
const MIDI_OUTPUT: MidiConfig = MidiConfig::MidiCCs;

View file

@ -148,8 +148,8 @@ impl Plugin for PolyModSynth {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
// We won't need any MIDI CCs here, we just want notes and polyphonic modulation
const MIDI_INPUT: MidiConfig = MidiConfig::Basic;

View file

@ -105,8 +105,8 @@ impl Plugin for Sine {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 0;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 0;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const MIDI_INPUT: MidiConfig = MidiConfig::Basic;
const SAMPLE_ACCURATE_AUTOMATION: bool = true;

View file

@ -90,8 +90,8 @@ impl Plugin for Stft {
const VERSION: &'static str = "0.0.1";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const SAMPLE_ACCURATE_AUTOMATION: bool = true;

View file

@ -120,8 +120,8 @@ impl Plugin for LoudnessWarWinner {
const VERSION: &'static str = "0.1.0";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
fn params(&self) -> Arc<dyn Params> {
self.params.clone()

View file

@ -165,8 +165,8 @@ impl Plugin for PubertySimulator {
const VERSION: &'static str = "0.1.0";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
fn params(&self) -> Arc<dyn Params> {
self.params.clone()

View file

@ -154,8 +154,8 @@ impl Plugin for SafetyLimiter {
const VERSION: &'static str = "0.1.0";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
fn params(&self) -> Arc<dyn Params> {
self.params.clone()

View file

@ -137,7 +137,7 @@ impl Default for SpectralCompressor {
// Changing any of the compressor threshold or ratio parameters will set an atomic flag in
// this object that causes the compressor thresholds and ratios to be recalcualted
let compressor_bank = compressor_bank::CompressorBank::new(
Self::DEFAULT_NUM_OUTPUTS as usize,
Self::DEFAULT_OUTPUT_CHANNELS as usize,
MAX_WINDOW_SIZE,
);
@ -153,7 +153,7 @@ impl Default for SpectralCompressor {
},
// These three will be set to the correct values in the initialize function
stft: util::StftHelper::new(Self::DEFAULT_NUM_OUTPUTS as usize, MAX_WINDOW_SIZE, 0),
stft: util::StftHelper::new(Self::DEFAULT_OUTPUT_CHANNELS as usize, MAX_WINDOW_SIZE, 0),
window_function: Vec::with_capacity(MAX_WINDOW_SIZE),
dry_wet_mixer: dry_wet_mixer::DryWetMixer::new(0, 0, 0),
compressor_bank,
@ -261,8 +261,8 @@ impl Plugin for SpectralCompressor {
const VERSION: &'static str = "0.2.0";
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
const DEFAULT_AUX_INPUTS: Option<AuxiliaryIOConfig> = Some(AuxiliaryIOConfig {
num_busses: 1,
num_channels: 2,

View file

@ -40,20 +40,20 @@ pub trait Plugin: Default + Send + Sync + 'static {
/// the defaults instead of setting up the busses properly.
///
/// Setting this to zero causes the plugin to have no main input bus.
const DEFAULT_NUM_INPUTS: u32 = 2;
const DEFAULT_INPUT_CHANNELS: u32 = 2;
/// The default number of output channels. All of the same caveats mentioned for
/// `DEFAULT_NUM_INPUTS` apply here.
/// `DEFAULT_INPUT_CHANNELS` apply here.
///
/// Setting this to zero causes the plugin to have no main output bus.
const DEFAULT_NUM_OUTPUTS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
/// If set, then the plugin will have this many sidechain input busses with a default number of
/// channels. Not all hosts support more than one sidechain input bus. Negotiating the actual
/// configuration wroks the same was as with `DEFAULT_NUM_INPUTS`.
/// configuration works the same was as with `DEFAULT_INPUT_CHANNELS`.
const DEFAULT_AUX_INPUTS: Option<AuxiliaryIOConfig> = None;
/// If set, then the plugin will have this many auxiliary output busses with a default number of
/// channels. Negotiating the actual configuration wroks the same was as with
/// `DEFAULT_NUM_INPUTS`.
/// `DEFAULT_INPUT_CHANNELS`.
const DEFAULT_AUX_OUTPUTS: Option<AuxiliaryIOConfig> = None;
/// Optional names for the main and auxiliary input and output ports. Will be generated if not
@ -107,8 +107,8 @@ pub trait Plugin: Default + Send + Sync + 'static {
/// Whether the plugin supports a bus config. This only acts as a check, and the plugin
/// shouldn't do anything beyond returning true or false.
fn accepts_bus_config(&self, config: &BusConfig) -> bool {
config.num_input_channels == Self::DEFAULT_NUM_INPUTS
&& config.num_output_channels == Self::DEFAULT_NUM_OUTPUTS
config.num_input_channels == Self::DEFAULT_INPUT_CHANNELS
&& config.num_output_channels == Self::DEFAULT_OUTPUT_CHANNELS
}
/// Initialize the plugin for the given bus and buffer configurations. These configurations will

View file

@ -506,8 +506,8 @@ impl<P: ClapPlugin> Wrapper<P> {
// In the off chance that the default config specified by the plugin is not in the above
// list, we'll try that as well.
let default_bus_config = BusConfig {
num_input_channels: P::DEFAULT_NUM_INPUTS,
num_output_channels: P::DEFAULT_NUM_OUTPUTS,
num_input_channels: P::DEFAULT_INPUT_CHANNELS,
num_output_channels: P::DEFAULT_OUTPUT_CHANNELS,
aux_input_busses: P::DEFAULT_AUX_INPUTS.unwrap_or_default(),
aux_output_busses: P::DEFAULT_AUX_OUTPUTS.unwrap_or_default(),
};
@ -549,8 +549,8 @@ impl<P: ClapPlugin> Wrapper<P> {
is_processing: AtomicBool::new(false),
current_bus_config: AtomicCell::new(BusConfig {
num_input_channels: P::DEFAULT_NUM_INPUTS,
num_output_channels: P::DEFAULT_NUM_OUTPUTS,
num_input_channels: P::DEFAULT_INPUT_CHANNELS,
num_output_channels: P::DEFAULT_OUTPUT_CHANNELS,
aux_input_busses: P::DEFAULT_AUX_INPUTS.unwrap_or_default(),
aux_output_busses: P::DEFAULT_AUX_OUTPUTS.unwrap_or_default(),
}),

View file

@ -289,8 +289,8 @@ impl<P: Vst3Plugin> WrapperInner<P> {
// that, we'll always initialize this configuration even before the host requests a
// channel layout.
current_bus_config: AtomicCell::new(BusConfig {
num_input_channels: P::DEFAULT_NUM_INPUTS,
num_output_channels: P::DEFAULT_NUM_OUTPUTS,
num_input_channels: P::DEFAULT_INPUT_CHANNELS,
num_output_channels: P::DEFAULT_OUTPUT_CHANNELS,
aux_input_busses: P::DEFAULT_AUX_INPUTS.unwrap_or_default(),
aux_output_busses: P::DEFAULT_AUX_OUTPUTS.unwrap_or_default(),
}),

View file

@ -91,7 +91,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
// HACK: Bitwig will not call the process function at all if the plugin does not have any
// audio IO, so we'll add a zero channel output to work around this if that is the
// case
let no_main_audio_io = P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_NUM_OUTPUTS == 0;
let no_main_audio_io = P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_OUTPUT_CHANNELS == 0;
// A plugin has a main input and output bus if the default number of channels is non-zero,
// and a plugin can also have auxiliary input and output busses
@ -99,7 +99,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
x if x == vst3_sys::vst::MediaTypes::kAudio as i32
&& dir == vst3_sys::vst::BusDirections::kInput as i32 =>
{
let main_busses = if P::DEFAULT_NUM_INPUTS > 0 { 1 } else { 0 };
let main_busses = if P::DEFAULT_INPUT_CHANNELS > 0 { 1 } else { 0 };
let aux_busses = P::DEFAULT_AUX_INPUTS.unwrap_or_default().num_busses as i32;
main_busses + aux_busses
@ -107,7 +107,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
x if x == vst3_sys::vst::MediaTypes::kAudio as i32
&& dir == vst3_sys::vst::BusDirections::kOutput as i32 =>
{
let main_busses = if P::DEFAULT_NUM_OUTPUTS > 0 { 1 } else { 0 };
let main_busses = if P::DEFAULT_OUTPUT_CHANNELS > 0 { 1 } else { 0 };
let aux_busses = P::DEFAULT_AUX_OUTPUTS.unwrap_or_default().num_busses as i32;
if no_main_audio_io {
@ -144,7 +144,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
// HACK: Bitwig will not call the process function at all if the plugin does not have any
// audio IO, so we'll add a zero channel output to work around this if that is the
// case
let no_main_audio_io = P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_NUM_OUTPUTS == 0;
let no_main_audio_io = P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_OUTPUT_CHANNELS == 0;
match (type_, dir, index) {
(t, _, _) if t == vst3_sys::vst::MediaTypes::kAudio as i32 => {
@ -159,7 +159,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
let bus_config = self.inner.current_bus_config.load();
if dir == vst3_sys::vst::BusDirections::kInput as i32 {
let aux_inputs_only =
P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_AUX_INPUTS.is_some();
P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_AUX_INPUTS.is_some();
let aux_input_start_idx = if aux_inputs_only { 0 } else { 1 };
if !aux_inputs_only && index == 0 {
info.bus_type = vst3_sys::vst::BusTypes::kMain as i32;
@ -197,7 +197,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
}
} else if dir == vst3_sys::vst::BusDirections::kOutput as i32 {
let aux_outputs_only =
P::DEFAULT_NUM_OUTPUTS == 0 && P::DEFAULT_AUX_OUTPUTS.is_some();
P::DEFAULT_OUTPUT_CHANNELS == 0 && P::DEFAULT_AUX_OUTPUTS.is_some();
let aux_output_start_idx = if aux_outputs_only { 0 } else { 1 };
if (!aux_outputs_only || no_main_audio_io) && index == 0 {
info.bus_type = vst3_sys::vst::BusTypes::kMain as i32;
@ -291,8 +291,8 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
(t, 0)
if t == vst3_sys::vst::MediaTypes::kAudio as i32
// We only have an IO pair when the plugin has both a main input and a main output
&& P::DEFAULT_NUM_INPUTS > 0
&& P::DEFAULT_NUM_OUTPUTS > 0 =>
&& P::DEFAULT_INPUT_CHANNELS > 0
&& P::DEFAULT_OUTPUT_CHANNELS > 0 =>
{
out_info.media_type = vst3_sys::vst::MediaTypes::kAudio as i32;
out_info.bus_index = in_info.bus_index;
@ -325,7 +325,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
// HACK: Bitwig will not call the process function at all if the plugin does not have any
// audio IO, so we'll add a zero channel output to work around this if that is the
// case
let no_main_audio_io = P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_NUM_OUTPUTS == 0;
let no_main_audio_io = P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_OUTPUT_CHANNELS == 0;
// We don't need any special handling here
match (type_, dir, index) {
@ -333,7 +333,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
if t == vst3_sys::vst::MediaTypes::kAudio as i32
&& d == vst3_sys::vst::BusDirections::kInput as i32 =>
{
let main_busses = if P::DEFAULT_NUM_INPUTS > 0 { 1 } else { 0 };
let main_busses = if P::DEFAULT_INPUT_CHANNELS > 0 { 1 } else { 0 };
let aux_busses = P::DEFAULT_AUX_INPUTS.unwrap_or_default().num_busses as i32;
if (0..main_busses + aux_busses).contains(&index) {
@ -346,7 +346,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
if t == vst3_sys::vst::MediaTypes::kAudio as i32
&& d == vst3_sys::vst::BusDirections::kOutput as i32 =>
{
let main_busses = if P::DEFAULT_NUM_OUTPUTS > 0 || no_main_audio_io {
let main_busses = if P::DEFAULT_OUTPUT_CHANNELS > 0 || no_main_audio_io {
1
} else {
0
@ -785,7 +785,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
// HACK: Bitwig will not call the process function at all if the plugin does not have any
// audio IO, so we'll add a zero channel output to work around this if that is the
// case
let no_main_audio_io = P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_NUM_OUTPUTS == 0;
let no_main_audio_io = P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_OUTPUT_CHANNELS == 0;
// Why are these signed integers again?
if num_ins < 0 || num_outs < 0 {
@ -796,7 +796,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
// support plugins with no main IO but with auxiliary IO, we'll need to take that into
// account when asserting this. If that's the case, then the first bus for that direction
// will have been marked auxiliary.
let aux_inputs_only = P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_AUX_INPUTS.is_some();
let aux_inputs_only = P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_AUX_INPUTS.is_some();
let num_input_channels = if aux_inputs_only || num_ins < 1 {
0
} else {
@ -819,7 +819,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
}
}
let aux_outputs_only = P::DEFAULT_NUM_OUTPUTS == 0 && P::DEFAULT_AUX_OUTPUTS.is_some();
let aux_outputs_only = P::DEFAULT_OUTPUT_CHANNELS == 0 && P::DEFAULT_AUX_OUTPUTS.is_some();
let num_output_channels = if (aux_outputs_only && !no_main_audio_io) || num_outs < 1 {
0
} else {
@ -879,7 +879,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
// HACK: Bitwig will not call the process function at all if the plugin does not have any
// audio IO, so we'll add a zero channel output to work around this if that is the
// case
let no_main_audio_io = P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_NUM_OUTPUTS == 0;
let no_main_audio_io = P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_OUTPUT_CHANNELS == 0;
let channel_count_to_map = |count| match count {
0 => vst3_sys::vst::kEmpty,
@ -900,7 +900,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
let bus_config = self.inner.current_bus_config.load();
let num_channels = if dir == vst3_sys::vst::BusDirections::kInput as i32 {
let aux_inputs_only = P::DEFAULT_NUM_INPUTS == 0 && P::DEFAULT_AUX_INPUTS.is_some();
let aux_inputs_only = P::DEFAULT_INPUT_CHANNELS == 0 && P::DEFAULT_AUX_INPUTS.is_some();
let aux_input_start_idx = if aux_inputs_only { 0 } else { 1 };
if !aux_inputs_only && index == 0 {
bus_config.num_input_channels
@ -913,7 +913,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
return kInvalidArgument;
}
} else if dir == vst3_sys::vst::BusDirections::kOutput as i32 {
let aux_outputs_only = P::DEFAULT_NUM_OUTPUTS == 0 && P::DEFAULT_AUX_OUTPUTS.is_some();
let aux_outputs_only = P::DEFAULT_OUTPUT_CHANNELS == 0 && P::DEFAULT_AUX_OUTPUTS.is_some();
let aux_output_start_idx = if aux_outputs_only { 0 } else { 1 };
if (!aux_outputs_only || no_main_audio_io) && index == 0 {
bus_config.num_output_channels