scritcher/src/custom.zig

29 lines
644 B
Zig
Raw Normal View History

// Custom plugins
const std = @import("std");
const lv2 = @import("lv2_helpers.zig");
const plugins = @import("plugin.zig");
const c = lv2.c;
const RunBuffers = plugins.RunBuffers;
pub const RandomNoise = struct {
allocator: *std.mem.Allocator,
r: std.rand.DefaultPrng,
pub fn init(
allocator: *std.mem.Allocator,
) RandomNoise {
var r = std.rand.DefaultPrng.init(std.time.timestamp());
return RandomNoise{
.allocator = allocator,
.r = r,
};
}
pub fn run(self: *RandomNoise, bufs: *RunBuffers) void {
bufs.out[0] = self.r.random.float(f32);
}
};