1
0
Fork 0

Fix unused/dead code warnings with VST3 disabled

This commit is contained in:
Robbert van der Helm 2023-02-19 13:19:02 +01:00
parent 5ddcc3bc7d
commit 090b4b529f
3 changed files with 6 additions and 5 deletions

View file

@ -13,13 +13,13 @@ mod windows;
pub(crate) use self::background_thread::BackgroundThread;
#[allow(unused_imports)]
#[cfg_attr(not(feature = "vst3"), allow(unused_imports))]
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
pub(crate) use self::linux::LinuxEventLoop as OsEventLoop;
#[allow(unused_imports)]
#[cfg_attr(not(feature = "vst3"), allow(unused_imports))]
#[cfg(target_os = "macos")]
pub(crate) use self::macos::MacOSEventLoop as OsEventLoop;
#[allow(unused_imports)]
#[cfg_attr(not(feature = "vst3"), allow(unused_imports))]
#[cfg(target_os = "windows")]
pub(crate) use self::windows::WindowsEventLoop as OsEventLoop;

View file

@ -598,6 +598,7 @@ impl<S: SysExMessage> NoteEvent<S> {
/// Subtract a sample offset from this event's timing, needed to compensate for the block
/// splitting in the VST3 wrapper implementation because all events have to be read upfront.
#[cfg_attr(not(feature = "vst3"), allow(dead_code))]
pub(crate) fn subtract_timing(&mut self, samples: u32) {
match self {
NoteEvent::NoteOn { timing, .. } => *timing -= samples,

View file

@ -263,12 +263,12 @@ pub trait Vst3Plugin: Plugin {
const PLATFORM_VST3_CLASS_ID: [u8; 16] = swap_vst3_uid_byte_order(Self::VST3_CLASS_ID);
}
#[cfg(not(target_os = "windows"))]
#[cfg(all(feature = "vst3", not(target_os = "windows")))]
const fn swap_vst3_uid_byte_order(uid: [u8; 16]) -> [u8; 16] {
uid
}
#[cfg(target_os = "windows")]
#[cfg(all(feature = "vst3", target_os = "windows"))]
const fn swap_vst3_uid_byte_order(mut uid: [u8; 16]) -> [u8; 16] {
// No mutable references in const functions, so we can't use `uid.swap()`
let original_uid = uid;