Skip to content

Commit

Permalink
Changing isFFT and isCentered to not show warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aure committed Feb 3, 2022
1 parent 058688e commit 3afa18b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Sources/AudioKitUI/Visualizations/NodeFFTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ public struct NodeFFTView: ViewRepresentable {
internal var plot: FloatPlot {
nodeTap.start()

let isFFT = false
let isCentered = false
let metalFragmentOrig = """
float sample = waveform.sample(s, \(isFFT ? "(pow(10, in.t.x) - 1.0) / 9.0" : "in.t.x")).x;
float sample = waveform.sample(s, (pow(10, in.t.x) - 1.0) / 9.0).x;
half4 backgroundColor = half4(colorParameters[1]);
half4 foregroundColor = half4(colorParameters[0]);
float y = (in.t.y - \(isCentered ? 0.5 : 1));
float y = (in.t.y - 1);
bool isFilled = parameters[0] != 0;
float d = isFilled ? fmax(fabs(y) - fabs(sample), 0) : fabs(y - sample);
float alpha = \(isFFT ? "fabs(1/(50 * d))" : "smoothstep(0.01, 0.04, d)");
float alpha = fabs(1/(50 * d));
return { mix(foregroundColor, backgroundColor, alpha) };
"""

Expand Down

0 comments on commit 3afa18b

Please sign in to comment.