From 7b004c8e38eab6a648dcef6812a4debb02e5f88c Mon Sep 17 00:00:00 2001 From: annieversary Date: Thu, 5 Aug 2021 18:04:17 +0200 Subject: [PATCH] idk --- README.md | 6 ++++++ crates/basic_gain/Cargo.toml | 2 ++ crates/sosten/src/lib.rs | 2 +- crates/utils/src/buffers.rs | 7 ++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ffcfcf4..4887452 100644 --- a/README.md +++ b/README.md @@ -261,3 +261,9 @@ issues and prs are welcome, but please open an issue before making any big pr, i gpl3 or something, i need to check which one to use and the add the correct file consider it gpl3 for now + +## naming + +uhhhh yeah cause the plugins are universal or something, but uni is spelled like annie. also sounds like 언니, which is fun + +the plugins are named very lazily, it's just whatever name i could come up with before creating the crate, so yeah many are not good diff --git a/crates/basic_gain/Cargo.toml b/crates/basic_gain/Cargo.toml index 480a8eb..6034eb7 100644 --- a/crates/basic_gain/Cargo.toml +++ b/crates/basic_gain/Cargo.toml @@ -9,3 +9,5 @@ crate-type = ["cdylib"] [dependencies] baseplug = { git = "https://github.com/wrl/baseplug.git", rev = "9cec68f31cca9c0c7a1448379f75d92bbbc782a8" } serde = "1.0.126" + +# utils = { path = "../utils" } diff --git a/crates/sosten/src/lib.rs b/crates/sosten/src/lib.rs index fb69f20..b9267c2 100644 --- a/crates/sosten/src/lib.rs +++ b/crates/sosten/src/lib.rs @@ -140,7 +140,7 @@ impl Plugin for Sosten { let idx = self.buffers.idx.min(len - 1); // Play from Buffer - let (l, r) = self.buffers.read((LEN - len) + idx); + let (l, r) = self.buffers.read_at((LEN - len) + idx); output[0][i] = l; output[1][i] = r; diff --git a/crates/utils/src/buffers.rs b/crates/utils/src/buffers.rs index 28f629c..17399e2 100644 --- a/crates/utils/src/buffers.rs +++ b/crates/utils/src/buffers.rs @@ -47,7 +47,12 @@ impl Buffers { }) } - pub fn read(&self, idx: usize) -> (f32, f32) { + /// Reads buffer, advances idx, returns true if buffer is full + pub fn read(&self) -> (f32, f32) { + (self.l[self.idx], self.r[self.idx]) + } + + pub fn read_at(&self, idx: usize) -> (f32, f32) { let idx = idx % LEN; (self.l[idx], self.r[idx]) }