// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown // SPDX-License-Identifier: GPL-3.0-or-later #pragma once // Port of audio/GrainSources.kt: the Grain Cloud's ten built-in sources, // synthesised in code (about six seconds each at RATE, mono, pitched on C). // Generated off the audio thread: prewarm() renders them on a background thread // (once), prewarmBlocking() renders them on the calling thread (tests). get() // never blocks and returns nullptr until a source is ready. #include "Sample.hpp" namespace sizzle::echofield::GrainSources { constexpr int RATE = 24000; constexpr int COUNT = 10; /** The source named [name] (EchofieldDefs SOURCES[0..9]) once rendered, else nullptr. */ const Sample *get(const char *name); /** By index into the built-in list, or nullptr (not ready / out of range). */ const Sample *get(int index); /** Index of the built-in source [name], or -1. */ int indexOf(const char *name); /** Render every source on a detached background thread (once). */ void prewarm(); /** Render every source not yet rendered, now, on this thread. */ void prewarmBlocking(); } // namespace sizzle::echofield::GrainSources