freqampbuffer optimisation

This commit is contained in:
aprilnightk 2025-09-11 21:42:17 +03:00
parent 287328624a
commit 7562de0b6e
2 changed files with 3 additions and 23 deletions

View file

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

View file

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