Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
graph_renderer.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/graph_node.h"
7#include "utils/units.h"
8
9#include <QPromise>
10
11#include <juce_wrapper.h>
12
13namespace zrythm::dsp
14{
16{
17public:
18 using SampleRange = std::pair<units::sample_t, units::sample_t>;
19 using RunOnMainThread = std::function<void (std::function<void ()>)>;
20
22 {
23 units::sample_rate_t sample_rate_;
24 units::sample_t block_length_;
25 unsigned int num_threads_ =
26 std::max (5u, std::thread::hardware_concurrency ()) - 4;
27 };
28
39 static QFuture<juce::AudioSampleBuffer> render_async (
40 RenderOptions options,
42 RunOnMainThread run_on_main_thread,
43 SampleRange range);
44
45private:
52 static void render (
53 QPromise<juce::AudioSampleBuffer> &promise,
54 RenderOptions options,
56 RunOnMainThread run_on_main_thread,
57 SampleRange range);
58};
59}
static QFuture< juce::AudioSampleBuffer > render_async(RenderOptions options, graph::GraphNodeCollection &&nodes, RunOnMainThread run_on_main_thread, SampleRange range)
Executes render() asynchronously and returns a QFuture to control the task.
Manages the collection of graph nodes.
Definition graph_node.h:298