From 7562de0b6e5c71c028e6f48c48e16ad7e41f701d Mon Sep 17 00:00:00 2001 From: aprilnightk Date: Thu, 11 Sep 2025 21:42:17 +0300 Subject: [PATCH] freqampbuffer optimisation --- zigsonnum/freqamp.zig | 24 ++---------------------- zigsonnum/soundnode.zig | 2 +- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/zigsonnum/freqamp.zig b/zigsonnum/freqamp.zig index b55b906..9eb7334 100644 --- a/zigsonnum/freqamp.zig +++ b/zigsonnum/freqamp.zig @@ -1,35 +1,15 @@ const std = @import("std"); const print = std.debug.print; -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; - - pub const FreqAmpBuffer = struct { const buffer_ticks_default = 44100 * 2; - allocator: Allocator, buffer_ticks: u32 = buffer_ticks_default, - current_tick: u32, - current_index: u32, + current_tick: u32 = 0, + current_index: u32 = 0, fal_array: [buffer_ticks_default]f64 = std.mem.zeroes([buffer_ticks_default]f64), - pub fn init(allocator: Allocator) !FreqAmpBuffer { - - return .{ - .allocator = allocator, - .current_tick = 0, - .current_index = 0, - }; - } - - pub fn deinit(self: *FreqAmpBuffer) void { - - //Need to redo this - _ = self; - - } pub fn increment_tick(self: *FreqAmpBuffer) void { diff --git a/zigsonnum/soundnode.zig b/zigsonnum/soundnode.zig index c15c749..a21326d 100644 --- a/zigsonnum/soundnode.zig +++ b/zigsonnum/soundnode.zig @@ -37,7 +37,7 @@ pub const SoundNode = struct { const air_in = ArrayList(*SoundNode).init(allocator); const wire_in = ArrayList(*SoundNode).init(allocator); const activities = ArrayList(*Activity).init(allocator); - const fab = try FreqAmpBuffer.init(allocator); + const fab = FreqAmpBuffer{}; const props = StringHashMap(f64).init(allocator); const sn = try allocator.create(SoundNode);