6#include "dsp/graph_builder.h"
7#include "dsp/graph_scheduler.h"
8#include "dsp/hardware_audio_interface.h"
9#include "utils/rt_thread_id.h"
10#include "utils/types.h"
25class DspGraphDispatcher final
28 using RunFunctionWithEngineLock = std::function<void (std::function<
void ()>)>;
31 std::unique_ptr<graph::IGraphBuilder> graph_builder,
32 std::vector<graph::IProcessable *> terminal_processables,
34 RunFunctionWithEngineLock run_function_with_engine_lock,
56 bool realtime_context,
57 const dsp::TempoMap &tempo_map)
noexcept [[clang::nonblocking]];
71 return process_kickoff_thread_.has_value ()
72 ? current_thread_id.get () == process_kickoff_thread_.value ()
82 static thread_local bool have_result =
false;
85 if (have_result) [[likely]]
90 if (!scheduler_) [[unlikely]]
97 if (scheduler_->contains_thread (current_thread_id.get ()))
117 return scheduler_->get_nodes ().trigger_nodes_;
138 [[clang::nonblocking]];
141 std::unique_ptr<graph::IGraphBuilder> graph_builder_;
148 RunFunctionWithEngineLock run_function_with_engine_lock_;
153 std::vector<graph::IProcessable *> terminal_processables_;
155 std::unique_ptr<graph::GraphScheduler> scheduler_;
158 nframes_t max_route_playback_latency_ = 0;
171 std::optional<unsigned int> process_kickoff_thread_;
auto & current_trigger_nodes() const
Accessor for currently active trigger nodes.
bool is_processing_kickoff_thread() const
Returns whether this is the thread that kicks off processing (thread that calls router_start_cycle())...
bool is_processing_thread() const
Returns if the current thread is a processing thread.
void recalc_graph(bool soft)
Recalculates the process acyclic directed graph.
nframes_t get_max_route_playback_latency()
Returns the max playback latency of the trigger nodes.
void start_cycle(const dsp::ITransport ¤t_transport_state, EngineProcessTimeInfo time_nfo, nframes_t remaining_latency_preroll, bool realtime_context, const dsp::TempoMap &tempo_map) noexcept
Starts a new cycle.
Abstraction for hardware audio interface.
std::function< void(std::function< void()>)> RunOnMainThreadFunc
Request for a function to run on the main thread (blocking).
uint32_t nframes_t
Frame count.
Common struct to pass around during processing to avoid repeating the data in function arguments.