60 friend class GraphThread;
61 using GraphThreadPtr = std::unique_ptr<GraphThread>;
62 static constexpr int MAX_GRAPH_THREADS = 128;
81 std::optional<juce::Thread::RealtimeOptions> realtime_options = std::nullopt,
82 std::optional<juce::AudioWorkgroup> thread_workgroup = std::nullopt);
119 auto &get_nodes () {
return graph_nodes_; }
137 auto get_time_nfo ()
const {
return time_nfo_; }
138 auto get_remaining_preroll_frames ()
const
140 return remaining_preroll_frames_;
151 assert (current_transport_.has_value ());
152 return current_transport_->get ();
159 [[gnu::hot]]
void trigger_node (
GraphNode &node);
165 void prepare_nodes_for_processing ();
171 void release_node_resources ();
174 boost::concurrent_flat_set<GraphThreadPtr> threads_;
175 GraphThreadPtr main_thread_;
185 std::optional<std::reference_wrapper<const dsp::ITransport>> current_transport_;
193 moodycamel::LightweightSemaphore callback_start_sem_{ 0 };
194 moodycamel::LightweightSemaphore callback_done_sem_{ 0 };
197 std::atomic<int> idle_thread_cnt_ = 0;
201 moodycamel::LightweightSemaphore trigger_sem_{ 0 };
204 MPMCQueue<GraphNode *> trigger_queue_;
209 GraphNodeCollection graph_nodes_;
212 std::atomic<int> terminal_refcnt_ = 0;
218 juce::Thread::RealtimeOptions realtime_thread_options_;
221 std::optional<juce::AudioWorkgroup> thread_workgroup_;
GraphScheduler(sample_rate_t sample_rate, nframes_t max_block_length, std::optional< juce::Thread::RealtimeOptions > realtime_options=std::nullopt, std::optional< juce::AudioWorkgroup > thread_workgroup=std::nullopt)
Construct a new Graph Scheduler.
void run_cycle(EngineProcessTimeInfo time_nfo, nframes_t remaining_preroll_frames, const dsp::ITransport &transport)
To be called repeatedly by a system audio callback thread.