[package]
name = "nice-plug"
version = "0.1.10"
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
keywords = ["audio", "plugin", "clap", "vst", "vst3"]
categories = ["multimedia::audio"]
description = "An audio plugin development framework that is nice to use :)"
readme = "../../README.md"

# Show documentation with all features enabled on docs.rs
[package.metadata.docs.rs]
all-features = true

[features]
default = ["vst3"]
# Enabling this feature will cause the plugin to terminate when allocations
# occur in the processing function during debug builds. Keep in mind that panics
# may also allocate if they use string formatting, so temporarily disabling this
# feature may be necessary when debugging panics in DSP code.
assert_process_allocs = ["dep:nice-assert-no-alloc", "nice-plug-core/assert_process_allocs"]
# Enables an export target for standalone binaries through the
# `nice_export_standalone()` function. Disabled by default as this requires
# building additional dependencies for audio and MIDI handling.
standalone = [
  "dep:baseview",
  "dep:clap",
  "dep:cpal",
  "dep:jack",
  "dep:midir",
  "dep:rtrb",
  "dep:fixed-resample",
  "dep:audioadapter-buffers"
]
# Enables the `nice_export_vst3!()` macro. Enabled by default.
vst3 = ["dep:vst3", "dep:widestring"]
# Add adapters to the Buffer object for reading the channel data to and from
# `std::simd` vectors. Requires a nightly compiler.
simd = ["nice-plug-core/simd"]
# Compress plugin state using the Zstandard algorithm. Loading uncompressed
# state is still supported so existing state will still load after enabling this
# feature for a plugin, but it can not be disabled again without losing state
# compatibility.
zstd = ["dep:zstd"]
# Enables setting the "flush to zero" CPU flag to avoid denormal numbers when
# processing. This can lead to a significant performance increases in some cases.
#
# HOWEVER, the Rust compiler technically considers this to be undefined behavior,
# so USE AT YOUR OWN RISK! Though if any UB did occur, the only damage will
# likely just be audio glitches, not memory safety issues.
#
# Note, performance issues due to denormal numbers only effect x86 targets (ARM,
# WASM, and RISC-V targets are all unaffected by denormal numbers).
#
# For more information on why this is considered undefined behavior, see:
# https://doc.rust-lang.org/core/arch/x86_64/fn._mm_setcsr.html
#
# There is also currently an open issue to fix the "undefined behavior" status:
# https://github.com/rust-lang/rust/issues/136469
#
# For an explanation on why denormal numbers are a problem, see:
# https://mu.krj.st/denormal/
unsafe_flush_denormals = []

[dependencies]
nice-plug-derive = { path = "../nice-plug-derive", version = "0.1.2" }
nice-plug-core = { path = "../nice-plug-core", version = "0.1.5" }
nice-assert-no-alloc = { version = "1.0", features = ["backtrace", "log"], optional = true }
nice-log = { path = "../nice-log", version = "0.2.4" }
clap-sys = "0.5.0"
# All the claps!
clap = { version = "4.1.8", features = [
  "derive",
  "wrap_help",
], optional = true }
parking_lot.workspace = true
atomic_refcell.workspace = true
crossbeam.workspace = true
anymap3 = "1.0.1"
anyhow.workspace = true
serde_json.workspace = true
backtrace = "0.3.76"
log = "0.4"
raw-window-handle.workspace = true
atomic_float.workspace = true
zstd = { version = "0.13.3", optional = true }
baseview = { workspace = true, optional = true }
cpal = { version = "0.18.1", optional = true }
jack = { version = "0.13.5", optional = true }
midir = { version = "0.11.0", optional = true }
fixed-resample = { version = "0.11.2", default-features = false, features = ["channel"], optional = true }
audioadapter-buffers = { version = "3", optional = true }
rtrb = { workspace = true, optional = true }
# Used for the `vst3` feature
vst3 = { version = "0.3.0", optional = true }
widestring = { version = "1.2.1", optional = true }

[target.'cfg(all(target_family = "unix", not(target_os = "macos")))'.dependencies]
libc = "0.2.124"

[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6.4"
core-foundation = "0.10.1"

[target.'cfg(target_os = "windows")'.dependencies.windows]
workspace = true
features = [
  "Win32_Foundation",
  "Win32_Graphics_Gdi",
  "Win32_UI_WindowsAndMessaging",
  "Win32_System_LibraryLoader",
  "Win32_System_Performance",
]

[dev-dependencies]
approx.workspace = true
