30 lines
532 B
Zig
30 lines
532 B
Zig
const std = @import("std");
|
|
const print = std.debug.print;
|
|
|
|
pub const tau: f64 = 2 * 3.1415926535897932384626433832795028841971;
|
|
pub const corrected_tau: f64 = tau / 44100;
|
|
|
|
const debug: bool = true;
|
|
|
|
pub fn dbg(s: []const u8) void {
|
|
if (debug) {
|
|
print("{s}\n", .{s});
|
|
}
|
|
|
|
}
|
|
|
|
pub fn idbg(s: anytype) void {
|
|
if (debug) {
|
|
print("{d}\n", .{s});
|
|
}
|
|
|
|
}
|
|
|
|
pub fn prnt(s: []const u8) void {
|
|
print("{s}\n", .{s});
|
|
}
|
|
|
|
pub fn interpolate(x: f64, x0: f64, x1: f64, y0: f64, y1: f64) f64 {
|
|
return y0 + ((y1-y0)*(x-x0) / (x1-x0));
|
|
}
|
|
|