This commit is contained in:
annieversary 2021-08-05 18:04:17 +02:00
parent ca16d2e27e
commit 7b004c8e38
4 changed files with 15 additions and 2 deletions

View file

@ -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

View file

@ -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" }

View file

@ -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;

View file

@ -47,7 +47,12 @@ impl<const LEN: usize> Buffers<LEN> {
})
}
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])
}