noise-command #5

Merged
luna merged 5 commits from noise-command into master 2019-07-13 22:57:52 +00:00
2 changed files with 10 additions and 3 deletions
Showing only changes of commit 3edca782ac - Show all commits

3
examples/noise.scri Normal file
View file

@ -0,0 +1,3 @@
load :0;
noise 3 1;
quicksave;

View file

@ -5,20 +5,24 @@ const plugins = @import("plugin.zig");
const c = lv2.c;
const RunContext = plugins.RunContext;
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, rctx: *RunContext) void {
rctx.in_buf[0] = f32(2);
pub fn run(self: *RandomNoise, bufs: *RunBuffers) void {
bufs.out[0] = self.r.random.float(f32);
}
};