Remove macOS specific debugging code

This commit is contained in:
Ebu
2025-12-02 13:20:54 +01:00
parent c730cc1b62
commit 80c522095c
7 changed files with 18 additions and 66 deletions

15
Cargo.lock generated
View File

@@ -324,10 +324,7 @@ dependencies = [
name = "ebu-dsp"
version = "0.1.0"
dependencies = [
"crossbeam",
"log",
"nih_plug",
"simplelog",
]
[[package]]
@@ -339,7 +336,6 @@ dependencies = [
"ebu-dsp",
"femtovg",
"image",
"log",
"nih_plug",
"parking_lot",
"serde",
@@ -944,17 +940,6 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]]
name = "simplelog"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16257adbfaef1ee58b1363bdc0664c9b8e1e30aed86049635fb5f147d065a9c0"
dependencies = [
"log",
"termcolor",
"time",
]
[[package]]
name = "slotmap"
version = "1.0.7"

View File

@@ -15,7 +15,6 @@ crossbeam = "0.8.4"
femtovg = "0.18.1"
serde = { version = "1.0.228", features = ["derive"] }
image = { version = "0.25.9", default-features = false, features = ["png"] }
log = "0.4.28"
[workspace]
members = ["ebu-dsp"]

View File

@@ -5,6 +5,3 @@ edition = "2024"
[dependencies]
nih_plug = { git = "https://github.com/robbert-vdh/nih-plug", version = "0.0.0", default-features = false }
log = "0.4.28"
simplelog = "0.12.2"
crossbeam = "0.8.4"

View File

@@ -1,4 +1,4 @@
use crate::{BiquadFilter, BiquadFilterState, Processor};
use crate::{BiquadFilter, Processor};
#[derive(Debug, Default, Clone)]
pub struct EqualizerState {

View File

@@ -10,19 +10,15 @@ mod smoother;
mod traits;
use std::{
fmt::Debug, ops::Add, panic, time::Duration
fmt::Debug, ops::Add, time::Duration
};
pub use amplitude::Amplitude;
pub use biquad::{BiquadFilter, BiquadFilterState, FilterMode, Slope};
pub use comp::{Compressor, CompressorState};
use crossbeam::atomic::AtomicCell;
pub use decibel::Decibel;
pub use eq::{Equalizer, EqualizerState};
pub use freq_split::{FreqSplitter, FreqSplitterState};
use log::{error, info};
use nih_plug::{nih_error, util::permit_alloc};
use simplelog::{CombinedLogger, Config, SimpleLogger, WriteLogger};
pub use traits::{FloatFormatter, IntFormatter, Lerp, Processor};
pub struct Rect<T> {
@@ -199,26 +195,3 @@ pub fn rms<const N: usize>(sample_buffer: &RingBuffer<f64, N>, last_rms: f64) ->
+ (1.0 / N as f64) * (sample_buffer[0].powf(2.0) - sample_buffer[N - 1].powf(2.0))
}
static LOGGER: AtomicCell<Option<Box<CombinedLogger>>> = AtomicCell::new(None);
pub fn init() {
permit_alloc(|| {
let log_file = std::fs::File::create("airfreshener.log").unwrap();
let term_log = SimpleLogger::new(log::LevelFilter::Debug, Config::default());
let file_log = WriteLogger::new(log::LevelFilter::Debug, Config::default(), log_file);
LOGGER.store(Some(simplelog::CombinedLogger::new(vec![
term_log, file_log,
])));
info!("Log check");
panic::set_hook(Box::new(|info| {
if let Some(str) = info.payload().downcast_ref::<String>() {
error!("Panic! {str}\n{:?}", info.location());
nih_error!("Panic! {str}\n{:?}", info.location());
}
else {
error!("Panic! No info provided.\n{:?}", info.location());
nih_error!("Panic! No info provided.\n{:?}", info.location());
}
}));
});
}

View File

@@ -5,7 +5,7 @@ use baseview::{
use ebu_dsp::Rect;
use femtovg::{Canvas, Color, FontId, ImageFlags, ImageId, Paint, Path, renderer::OpenGl};
use nih_plug::prelude::*;
use std::{fmt::Debug, sync::Arc};
use std::sync::Arc;
const DROID_SANS_FONT: &'static [u8] = include_bytes!("../assets/DroidSans.ttf");
@@ -25,12 +25,12 @@ pub struct PluginGui {
_gui_context: Arc<dyn GuiContext>,
scaling_factor: f32,
freshener_bounds: Rect<f32>,
freshener_image: Result<ImageId, String>,
not_so_fresh_image: Result<ImageId, String>,
fresh_dumbledore_image: Result<ImageId, String>,
freshener_bounds: Rect<f32>,
dirty: bool,
mouse_position: (f32, f32),
drag_start_mouse_pos: (f32, f32),
@@ -72,12 +72,7 @@ impl PluginGui {
freshener_image: Err("Not loaded".to_owned()),
fresh_dumbledore_image: Err("Not loaded".to_owned()),
not_so_fresh_image: Err("Not loaded".to_owned()),
freshener_bounds: Rect {
x: 120.0,
y: 20.0,
width: FRESHENER_FRAME_WIDTH,
height: FRESHENER_FRAME_HEIGHT,
},
freshener_bounds: Rect::default()
};
if let Some(context) = window.gl_context() {
@@ -134,6 +129,14 @@ impl WindowHandler for PluginGui {
//return;
}
let font_size = 12.0 * self.scaling_factor;
self.freshener_bounds = Rect {
x: 120.0 * self.scaling_factor,
y: 20.0 * self.scaling_factor,
width: FRESHENER_FRAME_WIDTH * self.scaling_factor,
height: FRESHENER_FRAME_HEIGHT * self.scaling_factor,
};
let context = match window.gl_context() {
None => {
nih_error!("No OpenGL context");
@@ -149,12 +152,7 @@ impl WindowHandler for PluginGui {
canvas.clear_rect(0, 0, width, height, Color::rgbaf(0.5, 0.5, 0.6, 1.0));
let mut full_window_path = Path::new();
full_window_path.rect(
0.0,
0.0,
EditorWindow::WINDOW_SIZE.0 as f32,
EditorWindow::WINDOW_SIZE.1 as f32,
);
full_window_path.rect(0.0, 0.0, width as f32, height as f32);
let mut freshener_path = Path::new();
freshener_path.rect(
@@ -229,11 +227,11 @@ impl WindowHandler for PluginGui {
str,
&Paint::color(Color::white())
.with_font(&[font])
.with_font_size(12.0)
.with_font_size(font_size)
.with_text_baseline(Baseline::Top),
)
.ok();
y += 12.0;
y += font_size;
};
print("Debug version");

View File

@@ -1,7 +1,7 @@
use std::sync::{Arc, atomic::Ordering};
use baseview::{Window, WindowOpenOptions, WindowScalePolicy, gl::GlConfig};
use crossbeam::atomic::AtomicCell;
use nih_plug::{editor::Editor, nih_error, plugin::Plugin};
use nih_plug::{editor::Editor, plugin::Plugin};
use crate::{AirFreshener, editor::EditorHandle, parameters::PluginParams, gui::PluginGui};
pub struct EditorWindow {