diff --git a/CHANGELOG.md b/CHANGELOG.md index 6296cf1b..2995f8d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/audio_setup.rs b/src/audio_setup.rs index 1c271aa4..bc746aa0 100644 --- a/src/audio_setup.rs +++ b/src/audio_setup.rs @@ -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. diff --git a/src/context/gui.rs b/src/context/gui.rs index 173f9b05..35d7d159 100644 --- a/src/context/gui.rs +++ b/src/context/gui.rs @@ -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 diff --git a/src/context/init.rs b/src/context/init.rs index bd896d96..e1934b57 100644 --- a/src/context/init.rs +++ b/src/context/init.rs @@ -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()]. diff --git a/src/context/process.rs b/src/context/process.rs index 0a6ca372..47dd384d 100644 --- a/src/context/process.rs +++ b/src/context/process.rs @@ -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 diff --git a/src/editor.rs b/src/editor.rs index 9ef87e18..79c126f9 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -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 { diff --git a/src/midi.rs b/src/midi.rs index de84c503..01835bd7 100644 --- a/src/midi.rs +++ b/src/midi.rs @@ -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; diff --git a/src/plugin.rs b/src/plugin.rs index 4aa56f30..8e57f260 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -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")] diff --git a/src/plugin/clap.rs b/src/plugin/clap.rs index 52eb99e7..b1e7d9b6 100644 --- a/src/plugin/clap.rs +++ b/src/plugin/clap.rs @@ -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 { diff --git a/src/plugin/vst3.rs b/src/plugin/vst3.rs index e1d92dd8..04ebe152 100644 --- a/src/plugin/vst3.rs +++ b/src/plugin/vst3.rs @@ -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 { diff --git a/src/prelude.rs b/src/prelude.rs index 0e0cd563..d67cb1ee 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -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; diff --git a/src/wrapper/clap/context.rs b/src/wrapper/clap/context.rs index 488e38e5..2e5e87a8 100644 --- a/src/wrapper/clap/context.rs +++ b/src/wrapper/clap/context.rs @@ -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. /// diff --git a/src/wrapper/clap/descriptor.rs b/src/wrapper/clap/descriptor.rs index 31985bdc..22200e9f 100644 --- a/src/wrapper/clap/descriptor.rs +++ b/src/wrapper/clap/descriptor.rs @@ -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. diff --git a/src/wrapper/clap/factory.rs b/src/wrapper/clap/factory.rs index 39b1a487..528d906f 100644 --- a/src/wrapper/clap/factory.rs +++ b/src/wrapper/clap/factory.rs @@ -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. diff --git a/src/wrapper/clap/wrapper.rs b/src/wrapper/clap/wrapper.rs index d7e0cef3..1436c96a 100644 --- a/src/wrapper/clap/wrapper.rs +++ b/src/wrapper/clap/wrapper.rs @@ -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}; diff --git a/src/wrapper/standalone.rs b/src/wrapper/standalone.rs index 3ac3b4fd..17bf84c8 100644 --- a/src/wrapper/standalone.rs +++ b/src/wrapper/standalone.rs @@ -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; diff --git a/src/wrapper/standalone/backend.rs b/src/wrapper/standalone/backend.rs index 77b8001e..9fbfb441 100644 --- a/src/wrapper/standalone/backend.rs +++ b/src/wrapper/standalone/backend.rs @@ -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; diff --git a/src/wrapper/standalone/backend/cpal.rs b/src/wrapper/standalone/backend/cpal.rs index 99b2f962..79823b64 100644 --- a/src/wrapper/standalone/backend/cpal.rs +++ b/src/wrapper/standalone/backend/cpal.rs @@ -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; diff --git a/src/wrapper/standalone/backend/dummy.rs b/src/wrapper/standalone/backend/dummy.rs index 7dd78c50..f99154cd 100644 --- a/src/wrapper/standalone/backend/dummy.rs +++ b/src/wrapper/standalone/backend/dummy.rs @@ -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 diff --git a/src/wrapper/standalone/backend/jack.rs b/src/wrapper/standalone/backend/jack.rs index 70fffa2c..036671ec 100644 --- a/src/wrapper/standalone/backend/jack.rs +++ b/src/wrapper/standalone/backend/jack.rs @@ -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}; diff --git a/src/wrapper/standalone/config.rs b/src/wrapper/standalone/config.rs index d75d40a0..2c163271 100644 --- a/src/wrapper/standalone/config.rs +++ b/src/wrapper/standalone/config.rs @@ -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)] diff --git a/src/wrapper/standalone/context.rs b/src/wrapper/standalone/context.rs index 7ce8b185..5c851a58 100644 --- a/src/wrapper/standalone/context.rs +++ b/src/wrapper/standalone/context.rs @@ -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
> { diff --git a/src/wrapper/standalone/wrapper.rs b/src/wrapper/standalone/wrapper.rs index 0f870676..5480bcea 100644 --- a/src/wrapper/standalone/wrapper.rs +++ b/src/wrapper/standalone/wrapper.rs @@ -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; diff --git a/src/wrapper/state.rs b/src/wrapper/state.rs index 22707465..b9bad7f7 100644 --- a/src/wrapper/state.rs +++ b/src/wrapper/state.rs @@ -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 diff --git a/src/wrapper/util/buffer_management.rs b/src/wrapper/util/buffer_management.rs index ea44e56c..d3814dc0 100644 --- a/src/wrapper/util/buffer_management.rs +++ b/src/wrapper/util/buffer_management.rs @@ -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 diff --git a/src/wrapper/vst3/context.rs b/src/wrapper/vst3/context.rs index 6f9d0878..75b5b503 100644 --- a/src/wrapper/vst3/context.rs +++ b/src/wrapper/vst3/context.rs @@ -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. /// diff --git a/src/wrapper/vst3/factory.rs b/src/wrapper/vst3/factory.rs index cd442308..ffd1a278 100644 --- a/src/wrapper/vst3/factory.rs +++ b/src/wrapper/vst3/factory.rs @@ -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 diff --git a/src/wrapper/vst3/inner.rs b/src/wrapper/vst3/inner.rs index 8394e971..f911d308 100644 --- a/src/wrapper/vst3/inner.rs +++ b/src/wrapper/vst3/inner.rs @@ -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; diff --git a/src/wrapper/vst3/note_expressions.rs b/src/wrapper/vst3/note_expressions.rs index d5e1c4e1..810a7af4 100644 --- a/src/wrapper/vst3/note_expressions.rs +++ b/src/wrapper/vst3/note_expressions.rs @@ -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; diff --git a/src/wrapper/vst3/view.rs b/src/wrapper/vst3/view.rs index 12065089..e40ce80a 100644 --- a/src/wrapper/vst3/view.rs +++ b/src/wrapper/vst3/view.rs @@ -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; diff --git a/src/wrapper/vst3/wrapper.rs b/src/wrapper/vst3/wrapper.rs index fca55a33..322355f7 100644 --- a/src/wrapper/vst3/wrapper.rs +++ b/src/wrapper/vst3/wrapper.rs @@ -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};