1
0
Fork 0

Rename main CLAP plugin wrapper struct to Wrapper

This commit is contained in:
Robbert van der Helm 2022-02-28 20:25:49 +01:00
parent 2750b2a6ad
commit 12075b1a24
3 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,7 @@ use parking_lot::RwLockWriteGuard;
use std::collections::VecDeque;
use std::sync::atomic::Ordering;
use super::plugin::{Plugin, Task};
use super::plugin::{Task, Wrapper};
use crate::context::ProcessContext;
use crate::event_loop::EventLoop;
use crate::plugin::{ClapPlugin, NoteEvent};
@ -11,7 +11,7 @@ use crate::plugin::{ClapPlugin, NoteEvent};
/// to lock guards for event queues. Otherwise reading these events would require constant
/// unnecessary atomic operations to lock the uncontested RwLocks.
pub(crate) struct WrapperProcessContext<'a, P: ClapPlugin> {
pub(super) plugin: &'a Plugin<P>,
pub(super) plugin: &'a Wrapper<P>,
pub(super) input_events_guard: RwLockWriteGuard<'a, VecDeque<NoteEvent>>,
}

View file

@ -6,7 +6,7 @@ use std::os::raw::c_char;
use std::ptr;
use super::descriptor::PluginDescriptor;
use super::plugin::Plugin;
use super::plugin::Wrapper;
use crate::ClapPlugin;
/// The plugin's factory. Initialized using a lazy_static from the entry poiunt's `get_factory()`
@ -60,7 +60,7 @@ impl<P: ClapPlugin> Factory<P> {
if !plugin_id.is_null() && CStr::from_ptr(plugin_id) == factory.plugin_descriptor.clap_id()
{
&Box::leak(Box::new(Plugin::<P>::new(host))).clap_plugin
&Box::leak(Box::new(Wrapper::<P>::new(host))).clap_plugin
} else {
ptr::null()
}

View file

@ -1,6 +1,6 @@
use clap_sys::host::clap_host;
use clap_sys::plugin::clap_plugin;
use clap_sys::process::{clap_process, clap_process_status};
use clap_sys::process::{clap_process, clap_process_status, CLAP_PROCESS_CONTINUE};
use crossbeam::atomic::AtomicCell;
use crossbeam::queue::ArrayQueue;
use parking_lot::RwLock;
@ -18,7 +18,7 @@ use crate::plugin::{BufferConfig, BusConfig, ClapPlugin};
use crate::NoteEvent;
#[repr(C)]
pub struct Plugin<P: ClapPlugin> {
pub struct Wrapper<P: ClapPlugin> {
// Keep the vtable as the first field so we can do a simple pointer cast
pub clap_plugin: clap_plugin,
@ -75,7 +75,7 @@ pub enum Task {
/// Because CLAP has this [clap_host::request_host_callback()] function, we don't need to use
/// `OsEventLoop` and can instead just request a main thread callback directly.
impl<P: ClapPlugin> EventLoop<Task, Plugin<P>> for Plugin<P> {
impl<P: ClapPlugin> EventLoop<Task, Wrapper<P>> for Wrapper<P> {
fn new_and_spawn(_executor: std::sync::Weak<Self>) -> Self {
panic!("What are you doing");
}
@ -102,7 +102,7 @@ impl<P: ClapPlugin> EventLoop<Task, Plugin<P>> for Plugin<P> {
}
}
impl<P: ClapPlugin> MainThreadExecutor<Task> for Plugin<P> {
impl<P: ClapPlugin> MainThreadExecutor<Task> for Wrapper<P> {
unsafe fn execute(&self, task: Task) {
todo!("Implement latency changes for CLAP")
}
@ -111,7 +111,7 @@ impl<P: ClapPlugin> MainThreadExecutor<Task> for Plugin<P> {
unsafe impl Send for HostCallback {}
unsafe impl Sync for HostCallback {}
impl<P: ClapPlugin> Plugin<P> {
impl<P: ClapPlugin> Wrapper<P> {
pub fn new(host_callback: *const clap_host) -> Self {
let plugin_descriptor = Box::new(PluginDescriptor::default());