Class WindowCache
java.lang.Object
net.paulhertz.pixelaudio.granular.WindowCache
WindowCache
Simple cache for windowFunction.generateCurve(length) results.
Avoids recomputing window curves for the same (WindowFunction class, length) pairs.
Implementation is thread-safe. For strict real-time safety, prewarm curves
during setup, not from the audio thread.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final WindowCacheprivate final Map<WindowCache.Key,float[]> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]getWindowCurve(ddf.minim.analysis.WindowFunction wf, int length) Get a cached window curve for the given WindowFunction and length.float[]prewarm(ddf.minim.analysis.WindowFunction wf, int length) Precompute and cache a window curve.
-
Field Details
-
INSTANCE
-
windowCurves
-
-
Constructor Details
-
WindowCache
private WindowCache()
-
-
Method Details
-
prewarm
public float[] prewarm(ddf.minim.analysis.WindowFunction wf, int length) Precompute and cache a window curve. Call this during setup, not from the audio thread. -
getWindowCurve
public float[] getWindowCurve(ddf.minim.analysis.WindowFunction wf, int length) Get a cached window curve for the given WindowFunction and length. If not cached, this will lazily generate it. For strict real-time safety, prefer calling prewarm(...) ahead of time.
-