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 reverse chronological order. The main purpose of this document in its current
state is to list breaking changes. 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] ## [2023-04-05]
### Breaking changes ### Breaking changes

View file

@ -2,7 +2,7 @@
use std::num::NonZeroU32; 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] /// 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. /// 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 std::sync::Arc;
use super::PluginApi; use super::PluginApi;
use crate::params::internals::ParamPtr; use crate::prelude::{Param, ParamPtr, Plugin, PluginState};
use crate::params::Param;
use crate::plugin::Plugin;
use crate::wrapper::state::PluginState;
/// Callbacks the plugin can make when the user interacts with its GUI such as updating parameter /// 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 /// 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. //! A context passed during plugin initialization.
use super::PluginApi; 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 /// Callbacks the plugin can make while it is being initialized. This is passed to the plugin during
/// [`Plugin::initialize()`][crate::plugin::Plugin::initialize()]. /// [`Plugin::initialize()`][crate::plugin::Plugin::initialize()].

View file

@ -1,8 +1,7 @@
//! A context passed during the process function. //! A context passed during the process function.
use super::PluginApi; use super::PluginApi;
use crate::midi::PluginNoteEvent; use crate::prelude::{Plugin, PluginNoteEvent};
use crate::plugin::Plugin;
/// Contains both context data and callbacks the plugin can use during processing. Most notably this /// 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 /// 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::any::Any;
use std::sync::Arc; use std::sync::Arc;
use crate::context::gui::GuiContext; use crate::prelude::GuiContext;
/// An editor for a [`Plugin`][crate::prelude::Plugin]. /// An editor for a [`Plugin`][crate::prelude::Plugin].
pub trait Editor: Send { pub trait Editor: Send {

View file

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

View file

@ -3,16 +3,10 @@
use std::sync::Arc; use std::sync::Arc;
use crate::audio_setup::{AudioIOLayout, AuxiliaryBuffers, BufferConfig}; use crate::prelude::{
use crate::buffer::Buffer; AsyncExecutor, AudioIOLayout, AuxiliaryBuffers, Buffer, BufferConfig, Editor, InitContext,
use crate::context::gui::AsyncExecutor; MidiConfig, Params, PluginState, ProcessContext, SysExMessage,
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;
pub mod clap; pub mod clap;
#[cfg(feature = "vst3")] #[cfg(feature = "vst3")]

View file

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

View file

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

View file

@ -19,7 +19,8 @@ pub use crate::audio_setup::{
pub use crate::buffer::Buffer; pub use crate::buffer::Buffer;
pub use crate::context::gui::{AsyncExecutor, GuiContext, ParamSetter}; pub use crate::context::gui::{AsyncExecutor, GuiContext, ParamSetter};
pub use crate::context::init::InitContext; 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 // This also includes the derive macro
pub use crate::editor::{Editor, ParentWindowHandle}; pub use crate::editor::{Editor, ParentWindowHandle};
pub use crate::midi::sysex::SysExMessage; pub use crate::midi::sysex::SysExMessage;

View file

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

View file

@ -4,7 +4,7 @@ use std::ffi::{CStr, CString};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::os::raw::c_char; 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 /// A static descriptor for a plugin. This is used in both the descriptor and on the plugin object
/// itself. /// itself.

View file

@ -8,7 +8,7 @@ use std::sync::Arc;
use super::descriptor::PluginDescriptor; use super::descriptor::PluginDescriptor;
use super::wrapper::Wrapper; 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()` /// 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. /// 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::context::{WrapperGuiContext, WrapperInitContext, WrapperProcessContext};
use super::descriptor::PluginDescriptor; use super::descriptor::PluginDescriptor;
use super::util::ClapPtr; 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::event_loop::{BackgroundThread, EventLoop, MainThreadExecutor, TASK_QUEUE_CAPACITY};
use crate::midi::sysex::SysExMessage; use crate::midi::MidiResult;
use crate::midi::{MidiConfig, MidiResult, NoteEvent, PluginNoteEvent}; use crate::prelude::{
use crate::params::internals::ParamPtr; AsyncExecutor, AudioIOLayout, AuxiliaryBuffers, BufferConfig, ClapPlugin, Editor, MidiConfig,
use crate::params::{ParamFlags, Params}; NoteEvent, ParamFlags, ParamPtr, Params, ParentWindowHandle, Plugin, PluginNoteEvent,
use crate::plugin::clap::ClapPlugin; ProcessMode, ProcessStatus, SysExMessage, TaskExecutor, Transport,
use crate::plugin::{Plugin, ProcessStatus, TaskExecutor}; };
use crate::util::permit_alloc; use crate::util::permit_alloc;
use crate::wrapper::clap::util::{read_stream, write_stream}; use crate::wrapper::clap::util::{read_stream, write_stream};
use crate::wrapper::state::{self, PluginState}; use crate::wrapper::state::{self, PluginState};

View file

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

View file

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

View file

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

View file

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

View file

@ -2,13 +2,10 @@ use std::sync::Arc;
use super::backend::Backend; use super::backend::Backend;
use super::wrapper::{Task, Wrapper}; use super::wrapper::{Task, Wrapper};
use crate::context::gui::GuiContext; use crate::prelude::{
use crate::context::init::InitContext; GuiContext, InitContext, ParamPtr, Plugin, PluginApi, PluginNoteEvent, ProcessContext,
use crate::context::process::{ProcessContext, Transport}; Transport,
use crate::context::PluginApi; };
use crate::midi::PluginNoteEvent;
use crate::params::internals::ParamPtr;
use crate::plugin::Plugin;
/// An [`InitContext`] implementation for the standalone wrapper. /// An [`InitContext`] implementation for the standalone wrapper.
pub(crate) struct WrapperInitContext<'a, P: Plugin, B: Backend<P>> { 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::backend::Backend;
use super::config::WrapperConfig; use super::config::WrapperConfig;
use super::context::{WrapperGuiContext, WrapperInitContext, WrapperProcessContext}; 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::event_loop::{EventLoop, MainThreadExecutor, OsEventLoop};
use crate::midi::PluginNoteEvent; use crate::prelude::{
use crate::params::internals::ParamPtr; AsyncExecutor, AudioIOLayout, BufferConfig, Editor, ParamFlags, ParamPtr, Params,
use crate::params::{ParamFlags, Params}; ParentWindowHandle, Plugin, PluginNoteEvent, ProcessMode, ProcessStatus, TaskExecutor,
use crate::plugin::{Plugin, ProcessStatus, TaskExecutor}; Transport,
};
use crate::util::permit_alloc; use crate::util::permit_alloc;
use crate::wrapper::state::{self, PluginState}; use crate::wrapper::state::{self, PluginState};
use crate::wrapper::util::process_wrapper; use crate::wrapper::util::process_wrapper;

View file

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

View file

@ -3,8 +3,7 @@
use std::num::NonZeroU32; use std::num::NonZeroU32;
use std::ptr::NonNull; use std::ptr::NonNull;
use crate::audio_setup::AudioIOLayout; use crate::prelude::{AudioIOLayout, Buffer};
use crate::buffer::Buffer;
/// Buffers created using [`create_buffers`]. At some point the main `Plugin::process()` should /// 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 /// 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 std::sync::Arc;
use vst3_sys::vst::IComponentHandler; use vst3_sys::vst::IComponentHandler;
use crate::prelude::{
GuiContext, InitContext, ParamPtr, PluginApi, PluginNoteEvent, PluginState, ProcessContext,
Transport, Vst3Plugin,
};
use super::inner::{Task, WrapperInner}; 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. /// An [`InitContext`] implementation for the wrapper.
/// ///

View file

@ -11,7 +11,7 @@ use vst3_sys as vst3_com;
use super::subcategories::Vst3SubCategory; use super::subcategories::Vst3SubCategory;
use super::util::u16strlcpy; use super::util::u16strlcpy;
use super::wrapper::Wrapper; use super::wrapper::Wrapper;
use crate::plugin::vst3::Vst3Plugin; use crate::prelude::Vst3Plugin;
use crate::wrapper::util::strlcpy; use crate::wrapper::util::strlcpy;
/// The VST3 SDK version this is roughly based on. The bindings include some VST 3.7 things but not /// 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::param_units::ParamUnits;
use super::util::{ObjectPtr, VstPtr, VST3_MIDI_PARAMS_END, VST3_MIDI_PARAMS_START}; use super::util::{ObjectPtr, VstPtr, VST3_MIDI_PARAMS_END, VST3_MIDI_PARAMS_START};
use super::view::WrapperView; 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::event_loop::{EventLoop, MainThreadExecutor, OsEventLoop};
use crate::midi::{MidiConfig, PluginNoteEvent}; use crate::prelude::{
use crate::params::internals::ParamPtr; AsyncExecutor, AudioIOLayout, BufferConfig, Editor, MidiConfig, ParamFlags, ParamPtr, Params,
use crate::params::{ParamFlags, Params}; Plugin, PluginNoteEvent, ProcessMode, ProcessStatus, TaskExecutor, Transport, Vst3Plugin,
use crate::plugin::vst3::Vst3Plugin; };
use crate::plugin::{Plugin, ProcessStatus, TaskExecutor};
use crate::util::permit_alloc; use crate::util::permit_alloc;
use crate::wrapper::state::{self, PluginState}; use crate::wrapper::state::{self, PluginState};
use crate::wrapper::util::buffer_management::BufferManager; use crate::wrapper::util::buffer_management::BufferManager;

View file

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

View file

@ -13,8 +13,8 @@ use vst3_sys::VST3;
use super::inner::{Task, WrapperInner}; use super::inner::{Task, WrapperInner};
use super::util::{ObjectPtr, VstPtr}; use super::util::{ObjectPtr, VstPtr};
use crate::editor::{Editor, ParentWindowHandle};
use crate::plugin::vst3::Vst3Plugin; use crate::plugin::vst3::Vst3Plugin;
use crate::prelude::{Editor, ParentWindowHandle};
// Alias needed for the VST3 attribute macro // Alias needed for the VST3 attribute macro
use vst3_sys as vst3_com; 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::util::{VST3_MIDI_CHANNELS, VST3_MIDI_PARAMS_END};
use super::view::WrapperView; use super::view::WrapperView;
use crate::audio_setup::{AuxiliaryBuffers, BufferConfig, ProcessMode}; use crate::prelude::{
use crate::context::process::Transport; AuxiliaryBuffers, BufferConfig, MidiConfig, NoteEvent, ParamFlags, ProcessMode, ProcessStatus,
use crate::midi::sysex::SysExMessage; SysExMessage, Transport, Vst3Plugin,
use crate::midi::{MidiConfig, NoteEvent}; };
use crate::params::ParamFlags;
use crate::plugin::vst3::Vst3Plugin;
use crate::plugin::ProcessStatus;
use crate::util::permit_alloc; use crate::util::permit_alloc;
use crate::wrapper::state; use crate::wrapper::state;
use crate::wrapper::util::buffer_management::{BufferManager, ChannelPointers}; use crate::wrapper::util::buffer_management::{BufferManager, ChannelPointers};