1
0
Fork 0

Also prefer importing from prelude internally

Less breakage when restructuring modules.
This commit is contained in:
Robbert van der Helm 2023-04-22 15:13:39 +02:00
parent 34b416ecb6
commit 2dbd835778
31 changed files with 76 additions and 115 deletions

View file

@ -10,6 +10,14 @@ Since there is no stable release yet, the changes are organized per day in
reverse chronological order. The main purpose of this document in its current
state is to list breaking changes.
## [2023-04-22]
### Changed
- The prelude module now also re-exports the following:
- The `PluginApi` num.
- The `Transport` struct.
## [2023-04-05]
### Breaking changes

View file

@ -2,7 +2,7 @@
use std::num::NonZeroU32;
use crate::buffer::Buffer;
use crate::prelude::Buffer;
/// A description of a plugin's audio IO configuration. The [`Plugin`][crate::prelude::Plugin]
/// defines a list of supported audio IO configs, with the first one acting as the default layout.

View file

@ -3,10 +3,7 @@
use std::sync::Arc;
use super::PluginApi;
use crate::params::internals::ParamPtr;
use crate::params::Param;
use crate::plugin::Plugin;
use crate::wrapper::state::PluginState;
use crate::prelude::{Param, ParamPtr, Plugin, PluginState};
/// Callbacks the plugin can make when the user interacts with its GUI such as updating parameter
/// values. This is passed to the plugin during [`Editor::spawn()`][crate::prelude::Editor::spawn()]. All of

View file

@ -1,7 +1,7 @@
//! A context passed during plugin initialization.
use super::PluginApi;
use crate::plugin::Plugin;
use crate::prelude::Plugin;
/// Callbacks the plugin can make while it is being initialized. This is passed to the plugin during
/// [`Plugin::initialize()`][crate::plugin::Plugin::initialize()].

View file

@ -1,8 +1,7 @@
//! A context passed during the process function.
use super::PluginApi;
use crate::midi::PluginNoteEvent;
use crate::plugin::Plugin;
use crate::prelude::{Plugin, PluginNoteEvent};
/// Contains both context data and callbacks the plugin can use during processing. Most notably this
/// is how a plugin sends and receives note events, gets transport information, and accesses

View file

@ -4,7 +4,7 @@ use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use std::any::Any;
use std::sync::Arc;
use crate::context::gui::GuiContext;
use crate::prelude::GuiContext;
/// An editor for a [`Plugin`][crate::prelude::Plugin].
pub trait Editor: Send {

View file

@ -3,7 +3,7 @@
use midi_consts::channel_event as midi;
use self::sysex::SysExMessage;
use crate::plugin::Plugin;
use crate::prelude::Plugin;
pub mod sysex;

View file

@ -3,16 +3,10 @@
use std::sync::Arc;
use crate::audio_setup::{AudioIOLayout, AuxiliaryBuffers, BufferConfig};
use crate::buffer::Buffer;
use crate::context::gui::AsyncExecutor;
use crate::context::init::InitContext;
use crate::context::process::ProcessContext;
use crate::editor::Editor;
use crate::midi::sysex::SysExMessage;
use crate::midi::MidiConfig;
use crate::params::Params;
use crate::wrapper::state::PluginState;
use crate::prelude::{
AsyncExecutor, AudioIOLayout, AuxiliaryBuffers, Buffer, BufferConfig, Editor, InitContext,
MidiConfig, Params, PluginState, ProcessContext, SysExMessage,
};
pub mod clap;
#[cfg(feature = "vst3")]

View file

@ -1,6 +1,5 @@
use crate::wrapper::clap::features::ClapFeature;
use super::Plugin;
use crate::prelude::ClapFeature;
/// Provides auxiliary metadata needed for a CLAP plugin.
pub trait ClapPlugin: Plugin {

View file

@ -1,6 +1,5 @@
pub use crate::wrapper::vst3::subcategories::Vst3SubCategory;
use super::Plugin;
use crate::prelude::Vst3SubCategory;
/// Provides auxiliary metadata needed for a VST3 plugin.
pub trait Vst3Plugin: Plugin {

View file

@ -19,7 +19,8 @@ pub use crate::audio_setup::{
pub use crate::buffer::Buffer;
pub use crate::context::gui::{AsyncExecutor, GuiContext, ParamSetter};
pub use crate::context::init::InitContext;
pub use crate::context::process::ProcessContext;
pub use crate::context::process::{ProcessContext, Transport};
pub use crate::context::PluginApi;
// This also includes the derive macro
pub use crate::editor::{Editor, ParentWindowHandle};
pub use crate::midi::sysex::SysExMessage;

View file

@ -4,14 +4,11 @@ use std::collections::VecDeque;
use std::sync::Arc;
use super::wrapper::{OutputParamEvent, Task, Wrapper};
use crate::context::gui::GuiContext;
use crate::context::init::InitContext;
use crate::context::process::{ProcessContext, Transport};
use crate::context::PluginApi;
use crate::event_loop::EventLoop;
use crate::midi::PluginNoteEvent;
use crate::params::internals::ParamPtr;
use crate::plugin::clap::ClapPlugin;
use crate::prelude::{
ClapPlugin, GuiContext, InitContext, ParamPtr, PluginApi, PluginNoteEvent, ProcessContext,
Transport,
};
/// An [`InitContext`] implementation for the wrapper.
///

View file

@ -4,7 +4,7 @@ use std::ffi::{CStr, CString};
use std::marker::PhantomData;
use std::os::raw::c_char;
use crate::plugin::clap::ClapPlugin;
use crate::prelude::ClapPlugin;
/// A static descriptor for a plugin. This is used in both the descriptor and on the plugin object
/// itself.

View file

@ -8,7 +8,7 @@ use std::sync::Arc;
use super::descriptor::PluginDescriptor;
use super::wrapper::Wrapper;
use crate::plugin::clap::ClapPlugin;
use crate::prelude::ClapPlugin;
/// The plugin's factory. Initialized using a lazy_static from the entry point's `get_factory()`
/// function. From this point onwards we don't need to generate code with macros anymore.

View file

@ -78,17 +78,13 @@ use std::time::Duration;
use super::context::{WrapperGuiContext, WrapperInitContext, WrapperProcessContext};
use super::descriptor::PluginDescriptor;
use super::util::ClapPtr;
use crate::audio_setup::{AudioIOLayout, AuxiliaryBuffers, BufferConfig, ProcessMode};
use crate::context::gui::AsyncExecutor;
use crate::context::process::Transport;
use crate::editor::{Editor, ParentWindowHandle};
use crate::event_loop::{BackgroundThread, EventLoop, MainThreadExecutor, TASK_QUEUE_CAPACITY};
use crate::midi::sysex::SysExMessage;
use crate::midi::{MidiConfig, MidiResult, NoteEvent, PluginNoteEvent};
use crate::params::internals::ParamPtr;
use crate::params::{ParamFlags, Params};
use crate::plugin::clap::ClapPlugin;
use crate::plugin::{Plugin, ProcessStatus, TaskExecutor};
use crate::midi::MidiResult;
use crate::prelude::{
AsyncExecutor, AudioIOLayout, AuxiliaryBuffers, BufferConfig, ClapPlugin, Editor, MidiConfig,
NoteEvent, ParamFlags, ParamPtr, Params, ParentWindowHandle, Plugin, PluginNoteEvent,
ProcessMode, ProcessStatus, SysExMessage, TaskExecutor, Transport,
};
use crate::util::permit_alloc;
use crate::wrapper::clap::util::{read_stream, write_stream};
use crate::wrapper::state::{self, PluginState};

View file

@ -7,7 +7,7 @@ use self::backend::Backend;
use self::config::WrapperConfig;
use self::wrapper::{Wrapper, WrapperError};
use super::util::setup_logger;
use crate::plugin::Plugin;
use crate::prelude::Plugin;
mod backend;
mod config;

View file

@ -1,6 +1,4 @@
use crate::audio_setup::AuxiliaryBuffers;
use crate::context::process::Transport;
use crate::midi::PluginNoteEvent;
use crate::prelude::{AuxiliaryBuffers, PluginNoteEvent, Transport};
mod cpal;
mod dummy;

View file

@ -16,12 +16,11 @@ use std::thread::ScopedJoinHandle;
use super::super::config::WrapperConfig;
use super::Backend;
use crate::audio_setup::{AudioIOLayout, AuxiliaryBuffers};
use crate::buffer::Buffer;
use crate::context::process::Transport;
use crate::midi::{MidiConfig, MidiResult, PluginNoteEvent};
use crate::plugin::Plugin;
use crate::prelude::NoteEvent;
use crate::midi::MidiResult;
use crate::prelude::{
AudioIOLayout, AuxiliaryBuffers, Buffer, MidiConfig, NoteEvent, Plugin, PluginNoteEvent,
Transport,
};
use crate::wrapper::util::buffer_management::{BufferManager, ChannelPointers};
const MIDI_EVENT_QUEUE_CAPACITY: usize = 2048;

View file

@ -4,11 +4,7 @@ use std::time::{Duration, Instant};
use super::super::config::WrapperConfig;
use super::Backend;
use crate::audio_setup::{AudioIOLayout, AuxiliaryBuffers};
use crate::buffer::Buffer;
use crate::context::process::Transport;
use crate::midi::PluginNoteEvent;
use crate::plugin::Plugin;
use crate::prelude::{AudioIOLayout, AuxiliaryBuffers, Buffer, Plugin, PluginNoteEvent, Transport};
use crate::wrapper::util::buffer_management::{BufferManager, ChannelPointers};
/// This backend doesn't input or output any audio or MIDI. It only exists so the standalone

View file

@ -13,11 +13,11 @@ use parking_lot::Mutex;
use super::super::config::WrapperConfig;
use super::Backend;
use crate::audio_setup::{AudioIOLayout, AuxiliaryBuffers};
use crate::buffer::Buffer;
use crate::context::process::Transport;
use crate::midi::{MidiConfig, MidiResult, NoteEvent, PluginNoteEvent};
use crate::plugin::Plugin;
use crate::midi::MidiResult;
use crate::prelude::{
AudioIOLayout, AuxiliaryBuffers, Buffer, MidiConfig, NoteEvent, Plugin, PluginNoteEvent,
Transport,
};
use crate::wrapper::util::buffer_management::{BufferManager, ChannelPointers};
use crate::wrapper::util::{clamp_input_event_timing, clamp_output_event_timing};

View file

@ -1,8 +1,7 @@
use clap::{Parser, ValueEnum};
use std::num::NonZeroU32;
use crate::audio_setup::AudioIOLayout;
use crate::plugin::Plugin;
use crate::prelude::{AudioIOLayout, Plugin};
/// Configuration for a standalone plugin that would normally be provided by the DAW.
#[derive(Debug, Clone, Parser)]

View file

@ -2,13 +2,10 @@ use std::sync::Arc;
use super::backend::Backend;
use super::wrapper::{Task, Wrapper};
use crate::context::gui::GuiContext;
use crate::context::init::InitContext;
use crate::context::process::{ProcessContext, Transport};
use crate::context::PluginApi;
use crate::midi::PluginNoteEvent;
use crate::params::internals::ParamPtr;
use crate::plugin::Plugin;
use crate::prelude::{
GuiContext, InitContext, ParamPtr, Plugin, PluginApi, PluginNoteEvent, ProcessContext,
Transport,
};
/// An [`InitContext`] implementation for the standalone wrapper.
pub(crate) struct WrapperInitContext<'a, P: Plugin, B: Backend<P>> {

View file

@ -13,15 +13,12 @@ use std::thread;
use super::backend::Backend;
use super::config::WrapperConfig;
use super::context::{WrapperGuiContext, WrapperInitContext, WrapperProcessContext};
use crate::audio_setup::{AudioIOLayout, BufferConfig, ProcessMode};
use crate::context::gui::AsyncExecutor;
use crate::context::process::Transport;
use crate::editor::{Editor, ParentWindowHandle};
use crate::event_loop::{EventLoop, MainThreadExecutor, OsEventLoop};
use crate::midi::PluginNoteEvent;
use crate::params::internals::ParamPtr;
use crate::params::{ParamFlags, Params};
use crate::plugin::{Plugin, ProcessStatus, TaskExecutor};
use crate::prelude::{
AsyncExecutor, AudioIOLayout, BufferConfig, Editor, ParamFlags, ParamPtr, Params,
ParentWindowHandle, Plugin, PluginNoteEvent, ProcessMode, ProcessStatus, TaskExecutor,
Transport,
};
use crate::util::permit_alloc;
use crate::wrapper::state::{self, PluginState};
use crate::wrapper::util::process_wrapper;

View file

@ -6,10 +6,8 @@ use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;
use crate::audio_setup::BufferConfig;
use crate::params::internals::ParamPtr;
use crate::params::{Param, ParamMut, Params};
use crate::plugin::Plugin;
use crate::params::ParamMut;
use crate::prelude::{BufferConfig, Param, ParamPtr, Params, Plugin};
// These state objects are also exposed directly to the plugin so it can do its own internal preset
// management

View file

@ -3,8 +3,7 @@
use std::num::NonZeroU32;
use std::ptr::NonNull;
use crate::audio_setup::AudioIOLayout;
use crate::buffer::Buffer;
use crate::prelude::{AudioIOLayout, Buffer};
/// Buffers created using [`create_buffers`]. At some point the main `Plugin::process()` should
/// probably also take an argument like this instead of main+aux buffers if we also want to provide

View file

@ -5,15 +5,12 @@ use std::sync::atomic::Ordering;
use std::sync::Arc;
use vst3_sys::vst::IComponentHandler;
use crate::prelude::{
GuiContext, InitContext, ParamPtr, PluginApi, PluginNoteEvent, PluginState, ProcessContext,
Transport, Vst3Plugin,
};
use super::inner::{Task, WrapperInner};
use crate::context::gui::GuiContext;
use crate::context::init::InitContext;
use crate::context::process::{ProcessContext, Transport};
use crate::context::PluginApi;
use crate::midi::PluginNoteEvent;
use crate::params::internals::ParamPtr;
use crate::plugin::vst3::Vst3Plugin;
use crate::wrapper::state::PluginState;
/// An [`InitContext`] implementation for the wrapper.
///

View file

@ -11,7 +11,7 @@ use vst3_sys as vst3_com;
use super::subcategories::Vst3SubCategory;
use super::util::u16strlcpy;
use super::wrapper::Wrapper;
use crate::plugin::vst3::Vst3Plugin;
use crate::prelude::Vst3Plugin;
use crate::wrapper::util::strlcpy;
/// The VST3 SDK version this is roughly based on. The bindings include some VST 3.7 things but not

View file

@ -14,16 +14,11 @@ use super::note_expressions::NoteExpressionController;
use super::param_units::ParamUnits;
use super::util::{ObjectPtr, VstPtr, VST3_MIDI_PARAMS_END, VST3_MIDI_PARAMS_START};
use super::view::WrapperView;
use crate::audio_setup::{AudioIOLayout, BufferConfig, ProcessMode};
use crate::context::gui::AsyncExecutor;
use crate::context::process::Transport;
use crate::editor::Editor;
use crate::event_loop::{EventLoop, MainThreadExecutor, OsEventLoop};
use crate::midi::{MidiConfig, PluginNoteEvent};
use crate::params::internals::ParamPtr;
use crate::params::{ParamFlags, Params};
use crate::plugin::vst3::Vst3Plugin;
use crate::plugin::{Plugin, ProcessStatus, TaskExecutor};
use crate::prelude::{
AsyncExecutor, AudioIOLayout, BufferConfig, Editor, MidiConfig, ParamFlags, ParamPtr, Params,
Plugin, PluginNoteEvent, ProcessMode, ProcessStatus, TaskExecutor, Transport, Vst3Plugin,
};
use crate::util::permit_alloc;
use crate::wrapper::state::{self, PluginState};
use crate::wrapper::util::buffer_management::BufferManager;

View file

@ -3,8 +3,7 @@
use vst3_sys::vst::{NoteExpressionValueEvent, NoteOnEvent};
use crate::midi::sysex::SysExMessage;
use crate::midi::NoteEvent;
use crate::prelude::{NoteEvent, SysExMessage};
type MidiNote = u8;
type MidiChannel = u8;

View file

@ -13,8 +13,8 @@ use vst3_sys::VST3;
use super::inner::{Task, WrapperInner};
use super::util::{ObjectPtr, VstPtr};
use crate::editor::{Editor, ParentWindowHandle};
use crate::plugin::vst3::Vst3Plugin;
use crate::prelude::{Editor, ParentWindowHandle};
// Alias needed for the VST3 attribute macro
use vst3_sys as vst3_com;

View file

@ -26,13 +26,10 @@ use super::util::{
};
use super::util::{VST3_MIDI_CHANNELS, VST3_MIDI_PARAMS_END};
use super::view::WrapperView;
use crate::audio_setup::{AuxiliaryBuffers, BufferConfig, ProcessMode};
use crate::context::process::Transport;
use crate::midi::sysex::SysExMessage;
use crate::midi::{MidiConfig, NoteEvent};
use crate::params::ParamFlags;
use crate::plugin::vst3::Vst3Plugin;
use crate::plugin::ProcessStatus;
use crate::prelude::{
AuxiliaryBuffers, BufferConfig, MidiConfig, NoteEvent, ParamFlags, ProcessMode, ProcessStatus,
SysExMessage, Transport, Vst3Plugin,
};
use crate::util::permit_alloc;
use crate::wrapper::state;
use crate::wrapper::util::buffer_management::{BufferManager, ChannelPointers};