Rewrite the draft word on the producer lane, without submitting it.
233{
236 }
239 }
240 if (steps == 0) {
242 }
243
244 try {
246 const std::shared_ptr<const void> held =
m_hold ?
m_hold() : nullptr;
248
249 for (uint64_t step = 0; step < steps; ++step) {
250 const auto& [symbols, generation] = *current;
251 std::vector<Symbol> next_symbols;
253 bool overflow {};
254
257 overflow = true;
258 return false;
259 }
260 next_symbols.push_back(next);
261 return true;
262 };
263
264 for (size_t position = 0; position < symbols.size(); ++position) {
265 const auto& symbol = symbols[position];
267 .inputs = inputs,
268 .word = symbols,
269 .position = position,
270 .held = held.get(),
272 };
273
275 replacement->successor(symbol, environment, emit);
276 } else {
277 emit(symbol);
278 }
279
280 if (overflow) {
282 "RewriteOperator generation exceeds max_word_length or symbol parameter limit");
284 }
285 }
286
287 current = std::make_shared<const Word>(
Word {
288 .symbols = std::move(next_symbols),
289 .generation = generation + 1 });
290 }
291
294
295 } catch (const std::exception& exception) {
296
298 "RewriteOperator replacement failed: {}", exception.what());
299 } catch (...) {
300
302 "RewriteOperator replacement failed with an unknown exception");
303 }
304
306}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
void refresh_controls()
Read node sources into their controls.
std::function< bool(Symbol)> EmitSymbol
Append a symbol; false on a bound violation.
std::function< std::shared_ptr< const void >()> m_hold
static constexpr size_t max_symbol_parameters
uint64_t m_max_generations
std::shared_ptr< const Word > m_draft
const Replacement * select_replacement(const Symbol &symbol, const Environment &environment)
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager).
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
What a replacement sees: the caller's inputs, the word with the symbol's position in it,...