MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Chronie.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace MayaFlux {
7
8namespace Core {
9 class Window;
10 struct NetworkMessage;
11 struct EndpointInfo;
12}
13
14namespace Nodes {
15 class Node;
16}
17
18namespace Vruta {
19 class TaskScheduler;
20 class EventManager;
21 class SoundRoutine;
22 class GraphicsRoutine;
23 class FreeRoutine;
24 class NetworkSource;
25}
26
27namespace IO {
28 class IOManager;
29}
30
31namespace Kriya {
32 class BufferPipeline;
33}
34
35/**
36 * @brief Gets the task scheduler from the default engine
37 * @return Shared pointer to the centrally managed TaskScheduler
38 *
39 * Returns the scheduler that's managed by the default engine instance.
40 * All scheduled tasks using the convenience functions will use this scheduler.
41 */
42MAYAFLUX_API std::shared_ptr<Vruta::TaskScheduler> get_scheduler();
43
44/**
45 * @brief Gets the event manager from the default engine
46 * @return Shared pointer to the centrally managed EventManager
47 *
48 * Returns the event manager that's managed by the default engine instance.
49 * Used for handling windowing and input events.
50 */
51MAYAFLUX_API std::shared_ptr<Vruta::EventManager> get_event_manager();
52
53/**
54 * @brief Creates a metronome task and addes it to the default scheduler list for evaluation
55 * @param interval_seconds Time between calls in seconds
56 * @param callback Function to call on each tick
57 * @param name Name of the metronome task (optional but recommended).
58 If not provided, a default name will be generated.
59 * @param token Processing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE)
60 *
61 * Uses the task scheduler from the default engine.
62 */
63MAYAFLUX_API void schedule_metro(double interval_seconds, std::function<void()> callback, std::string name = "", Vruta::ProcessingToken token = Vruta::ProcessingToken::SAMPLE_ACCURATE);
64
65/**
66 * @brief Creates a sequence task that calls functions at specified times
67 * and addes it to the default scheduler list for evaluation
68 * @param sequence Vector of (time, function) pairs
69 * @param name Name of the metronome task (optional but recommended).
70 If not provided, a default name will be generated.
71 * @param token Processing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE)
72 *
73 * Uses the task scheduler from the default engine.
74 */
75MAYAFLUX_API void schedule_sequence(std::vector<std::pair<double, std::function<void()>>> sequence, std::string name = "", Vruta::ProcessingToken token = Vruta::ProcessingToken::SAMPLE_ACCURATE);
76
77/**
78 * @brief Creates a line generator that interpolates between values over time and schedules it for evaluation
79 * @param start_value Starting value
80 * @param end_value Ending value
81 * @param duration_seconds Total duration in seconds
82 * @param step_duration Time between steps in seconds
83 * @param retain Whether the coroutine should stay alive for potential restarts (default: true)
84 * @param name Name of the line task (optional but recommended).
85 If not provided, a default name will be generated.
86 * @return shared_ptr to SoundRoutine object representing the line generator
87 *
88 * Uses the task scheduler from the default engine.
89 */
90MAYAFLUX_API std::shared_ptr<Vruta::SoundRoutine> schedule_line(float start_value, float end_value, float duration_seconds, uint32_t step_duration = 5, bool retain = true, std::string name = "");
91
92/**
93 * @brief Schedules a pattern generator whose steps are spaced by a list of durations
94 * @param pattern_func Function that generates pattern values based on step index
95 * @param callback Function to call with each pattern value
96 * @param durations Seconds to wait after each step, stepped through in order and repeated
97 * @param name Name of the pattern task (optional but recommended).
98 If not provided, a default name will be generated.
99 * @param token Processing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE)
100 *
101 * A single interval is a list of one. Uses the task scheduler from the default engine.
102 */
103MAYAFLUX_API void schedule_pattern(std::function<std::any(uint64_t)> pattern_func, std::function<void(std::any)> callback, std::vector<double> durations, std::string name = "", Vruta::ProcessingToken token = Vruta::ProcessingToken::SAMPLE_ACCURATE);
104
105/**
106 * @brief Schedules a pattern generator with one interval between steps
107 * @param pattern_func Function that generates pattern values based on step index
108 * @param callback Function to call with each pattern value
109 * @param interval_seconds Time between pattern steps
110 * @param name Name of the pattern task (optional but recommended).
111 If not provided, a default name will be generated.
112 * @param token Processing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE)
113 * @deprecated Pass a list of durations instead, with the interval as a list of one.
114 *
115 * Forwards to the durations overload. Uses the task scheduler from the default engine.
116 */
117[[deprecated("Pass a std::vector<double> of durations; a single interval is a list of one")]]
118MAYAFLUX_API void schedule_pattern(std::function<std::any(uint64_t)> pattern_func, std::function<void(std::any)> callback, double interval_seconds, std::string name = "", Vruta::ProcessingToken token = Vruta::ProcessingToken::SAMPLE_ACCURATE);
119
120/**
121 * @brief Gets a pointer to a task's current value
122 * @param name Name of the task
123 * @return Pointer to the float value, or nullptr if not found
124 */
125MAYAFLUX_API float* get_line_value(const std::string& name);
126
127/**
128 * @brief Schedules a new sound routine task
129 * @param name Unique name for the task
130 * @param task The sound routine to schedule
131 * @param initialize Whether to initialize the task immediately
132 */
133MAYAFLUX_API void schedule_task(const std::string& name, Vruta::SoundRoutine&& task, bool initialize = false);
134
135/**
136 * @brief Schedules a new sound routine task
137 * @param name Unique name for the task
138 * @param task The sound routine to schedule
139 * @param initialize Whether to initialize the task immediately
140 */
141MAYAFLUX_API void schedule_task(const std::string& name, Vruta::GraphicsRoutine&& task, bool initialize = false);
142
143/**
144 * @brief Schedules a new free routine conditional task
145 * @param name Unique name for the task
146 * @param task The sound routine to schedule
147 * @param initialize Whether to initialize the task immediately
148 */
149MAYAFLUX_API void schedule_task(const std::string& name, Vruta::FreeRoutine&& task, bool initialize = false);
150
151/**
152 * @brief Schedules a routine of any type that is already held by a shared_ptr
153 * @param name Unique name for the task. If empty, the scheduler generates one.
154 * @param task The routine to schedule, for example the result of Kriya::pattern; a null routine is reported and ignored
155 * @param initialize Whether to initialize the task immediately
156 *
157 * Covers every routine type, including cross routines, which have no rvalue overload.
158 */
159MAYAFLUX_API void schedule_task(const std::string& name, const std::shared_ptr<Vruta::Routine>& task, bool initialize = false);
160
161/**
162 * @brief Schedules a typed pattern whose steps are spaced by a list of durations
163 * @tparam Index Step index type, default uint64_t
164 * @param generator Callable from the step index to any value
165 * @param callback Callable that takes the generated value
166 * @param durations Seconds to wait after each step, stepped through in order and repeated
167 * @param name Name of the pattern task (optional but recommended)
168 * @param token Processing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE)
169 *
170 * The value type is whatever the generator returns, so no std::any is involved.
171 * `schedule_pattern(gen, cb, { 0.25, 0.5 })` selects this overload.
172 */
173template <std::incrementable Index = uint64_t, typename Generator, typename Callback>
176void schedule_pattern(Generator generator, Callback callback, std::vector<double> durations, std::string name = "", Vruta::ProcessingToken token = Vruta::ProcessingToken::SAMPLE_ACCURATE)
177{
178 schedule_task(name, Kriya::pattern<Index>(std::move(generator), std::move(callback), std::move(durations), token));
179}
180
181/**
182 * @brief Schedules a typed pattern driven by a condition or by a durations function
183 * @tparam Index Step index type, default uint64_t
184 * @param generator Callable from the step index to any value
185 * @param callback Callable that takes the generated value
186 * @param third A condition returning bool for the step index, or a function from a pass number to a range of seconds
187 * @param name Name of the pattern task (optional but recommended)
188 * @param token Processing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE)
189 *
190 * Forwards to Kriya::pattern, which describes both forms. A condition runs a step each time it holds;
191 * a durations function is asked once per pass and ends the pattern on an empty array.
192 */
193template <std::incrementable Index = uint64_t, typename Generator, typename Callback, typename Third>
194 requires Kriya::PatternGenerator<Generator, Index>
195 && Kriya::PatternCallback<Callback, typename Kriya::PatternTraits<Generator, Index>::value_type>
196 && (Kriya::PatternCondition<Third, Index> || Kriya::PatternDurationSource<Third>)
197void schedule_pattern(Generator generator, Callback callback, Third third, std::string name = "", Vruta::ProcessingToken token = Vruta::ProcessingToken::SAMPLE_ACCURATE)
198{
199 schedule_task(name, Kriya::pattern<Index>(std::move(generator), std::move(callback), std::move(third), token));
200}
201
202/**
203 * @brief Cancels a scheduled task
204 * @param name Name of the task to cancel
205 * @return true if task was found and canceled, false otherwise
206 */
207MAYAFLUX_API bool cancel_task(const std::string& name);
208
209/**
210 * @brief Restarts a scheduled task
211 * @param name Name of the task to restart
212 * @return true if task was found and restarted, false otherwise
213 */
214MAYAFLUX_API bool restart_task(const std::string& name);
215
216/**
217 * @brief Updates parameters of a scheduled task
218 * @tparam Args Parameter types
219 * @param name Name of the task to update
220 * @param args New parameter values
221 * @return true if task was found and updated, false otherwise
222 */
223template <typename... Args>
224MAYAFLUX_API bool update_task_params(const std::string& name, Args... args);
225
226/**
227 * @brief Creates a new buffer pipeline instance
228 * @return Shared pointer to the created BufferPipeline
229 *
230 * Uses the task scheduler from the default engine.
231 */
232MAYAFLUX_API std::shared_ptr<Kriya::BufferPipeline> create_buffer_pipeline();
233
234/**
235 * @brief Creates a buffer pipeline that can reach an IOManager
236 * @param io_manager IOManager the pipeline uses to display stream routes
237 * @return Shared pointer to the created BufferPipeline
238 *
239 * Needed only for operations that open a display on a video stream, such as
240 * route_to_container with a render config. Pipelines made without it, audio
241 * ones included, carry no IOManager.
242 */
243MAYAFLUX_API std::shared_ptr<Kriya::BufferPipeline> create_buffer_pipeline(std::shared_ptr<IO::IOManager> io_manager);
244
245/**
246 * @brief Schedule a key press handler
247 * @param window Window to listen to
248 * @param key Key to wait for
249 * @param callback Function to call on key press
250 * @param name Optional name for the event handler
251 *
252 * Example:
253 * @code
254 * MayaFlux::on_key_pressed(window, MayaFlux::IO::Keys::Escape, []() {
255 * // Handle Escape key press
256 * }, "escape_handler");
257 * @endcode
258 */
259MAYAFLUX_API void on_key_pressed(
260 const std::shared_ptr<Core::Window>& window,
261 IO::Keys key,
262 std::function<void()> callback,
263 std::string name = "");
264
265/**
266 * @brief Schedule a key release handler
267 * @param window Window to listen to
268 * @param key Key to wait for
269 * @param callback Function to call on key release
270 * @param name Optional name for the event handler
271 *
272 * Example:
273 * @code
274 * MayaFlux::on_key_released(window, MayaFlux::IO::Keys::Enter, []() {
275 * // Handle Enter key release
276 * }, "enter_release_handler");
277 * @endcode
278 */
279MAYAFLUX_API void on_key_released(
280 const std::shared_ptr<Core::Window>& window,
281 IO::Keys key,
282 std::function<void()> callback,
283 std::string name = "");
284
285/**
286 * @brief Schedule a handler for any key press
287 * @param window Window to listen to
288 * @param callback Function to call with key code when any key is pressed
289 * @param name Optional name for the event handler
290 *
291 * Example:
292 * @code
293 * MayaFlux::on_any_key(window, [](MayaFlux::IO::Keys key) {
294 * // Handle any key press, key code in 'key'
295 * }, "any_key_handler");
296 * @endcode
297 */
298MAYAFLUX_API void on_any_key(
299 const std::shared_ptr<Core::Window>& window,
300 std::function<void(IO::Keys)> callback,
301 std::string name = "");
302
303/**
304 * @brief Schedule a mouse button press handler
305 * @param window Window to listen to
306 * @param button Mouse button to wait for
307 * @param callback Function to call on button press (x, y)
308 * @param name Optional name for the event handler
309 *
310 * Example:
311 * @code
312 * MayaFlux::on_mouse_pressed(window, MayaFlux::IO::MouseButtons::Left, [](double x, double y) {
313 * // Handle left mouse button press at (x, y)
314 * }, "mouse_left_press_handler");
315 * @endcode
316 */
317MAYAFLUX_API void on_mouse_pressed(
318 const std::shared_ptr<Core::Window>& window,
319 IO::MouseButtons button,
320 std::function<void(double, double)> callback,
321 std::string name = "");
322
323/**
324 * @brief Schedule a mouse button release handler
325 * @param window Window to listen to
326 * @param button Mouse button to wait for
327 * @param callback Function to call on button release (x, y)
328 * @param name Optional name for the event handler
329 *
330 * Example:
331 * @code
332 * MayaFlux::on_mouse_released(window, MayaFlux::IO::MouseButtons::Right, [](double x, double y) {
333 * // Handle right mouse button release at (x, y)
334 * }, "mouse_right_release_handler");
335 * @endcode
336 */
337MAYAFLUX_API void on_mouse_released(
338 const std::shared_ptr<Core::Window>& window,
339 IO::MouseButtons button,
340 std::function<void(double, double)> callback,
341 std::string name = "");
342
343/**
344 * @brief Schedule a mouse movement handler
345 * @param window Window to listen to
346 * @param callback Function to call on mouse move (x, y)
347 * @param name Optional name for the event handler
348 *
349 * Example:
350 * @code
351 * MayaFlux::on_mouse_move(window, [](double x, double y) {
352 * // Handle mouse move at (x, y)
353 * }, "mouse_move_handler");
354 * @endcode
355 */
356MAYAFLUX_API void on_mouse_move(
357 const std::shared_ptr<Core::Window>& window,
358 std::function<void(double, double)> callback,
359 std::string name = "");
360
361/**
362 * @brief Schedule a mouse drag handler
363 * @param window Window to listen to
364 * @param button Mouse button that must be held for dragging
365 * @param callback Function to call on mouse drag (x, y)
366 * @param name Optional name for the event handler
367 *
368 * Example:
369 * @code
370 * MayaFlux::on_mouse_drag(window, MayaFlux::IO::MouseButtons::Left, [](double x, double y) {
371 * // Handle mouse drag with left button at (x, y)
372 * }, "mouse_left_drag_handler");
373 * @endcode
374 */
375MAYAFLUX_API void on_mouse_drag(
376 const std::shared_ptr<Core::Window>& window,
377 IO::MouseButtons button,
378 std::function<void(double, double)> callback,
379 std::string name = "");
380
381/**
382 * @brief Schedule a mouse scroll handler
383 * @param window Window to listen to
384 * @param callback Function to call on scroll (xoffset, yoffset)
385 * @param name Optional name for the event handler
386 *
387 * Example:
388 * @code
389 * MayaFlux::on_scroll(window, [](double xoffset, double yoffset) {
390 * // Handle mouse scroll with offsets
391 * }, "mouse_scroll_handler");
392 * @endcode
393 */
394MAYAFLUX_API void on_scroll(
395 const std::shared_ptr<Core::Window>& window,
396 std::function<void(double, double)> callback,
397 std::string name = "");
398
399/**
400 * @brief Cancel an event handler by name
401 * @param name Event handler name
402 * @return True if cancelled successfully
403 */
404MAYAFLUX_API bool cancel_event_handler(const std::string& name);
405
406/**
407 * @brief Converts a time duration in seconds to the equivalent number of audio samples
408 * @param seconds Time duration in seconds
409 * @return Equivalent number of audio samples based on the current sample rate
410 *
411 * This function uses the sample rate from the default engine to calculate how many
412 * audio samples correspond to the given time duration in seconds. It's useful for
413 * scheduling tasks or processing buffers based on time intervals.
414 */
415MAYAFLUX_API uint64_t seconds_to_samples(double seconds);
416
417/**
418 * @brief Converts a time duration in seconds to the equivalent number of processing blocks
419 * @param seconds Time duration in seconds
420 * @return Equivalent number of blocks based on current sample rate and block size
421 *
422 * Uses the sample rate and block size from the default engine. Falls back to
423 * 48kHz/512 samples if engine is not running.
424 */
425MAYAFLUX_API uint64_t seconds_to_blocks(double seconds);
426
427/**
428 * @brief Converts samples to blocks based on current block size
429 * @param samples Number of samples
430 * @return Number of blocks
431 */
432MAYAFLUX_API uint64_t samples_to_blocks(uint64_t samples);
433
434/**
435 * @brief Converts a number of audio samples to the equivalent time duration in seconds
436 * @param samples Number of audio samples
437 * @return Time duration in seconds based on the current sample rate
438 */
439MAYAFLUX_API double samples_to_seconds(uint64_t samples);
440
441/**
442 * @brief Schedule an on_message handler with an existing NetworkSource
443 * @param source Shared NetworkSource; coroutine frame takes co-ownership
444 * @param callback Invoked with each received message
445 * @param name Optional name for the event handler
446 *
447 * @code
448 * auto src = std::make_shared<Vruta::NetworkSource>(
449 * Core::EndpointInfo{ .transport = Core::NetworkTransport::UDP, .local_port = 8000 });
450 * MayaFlux::on_network_message(src, [](const Core::NetworkMessage& msg) { });
451 * @endcode
452 */
453MAYAFLUX_API void on_network_message(
454 std::shared_ptr<Vruta::NetworkSource> source,
455 std::function<void(const Core::NetworkMessage&)> callback,
456 std::string name = "");
457
458/**
459 * @brief Schedule an on_message handler, constructing the NetworkSource from config
460 * @param info Endpoint configuration used to open the source
461 * @param callback Invoked with each received message
462 * @param name Optional name for the event handler
463 * @return Shared pointer to the opened NetworkSource (caller owns lifetime anchor)
464 *
465 * @code
466 * auto src = MayaFlux::on_network_message(
467 * Core::EndpointInfo{ .transport = Core::NetworkTransport::UDP, .local_port = 8000 },
468 * [](const Core::NetworkMessage& msg) { });
469 * @endcode
470 */
471MAYAFLUX_API std::shared_ptr<Vruta::NetworkSource> on_network_message(
472 const Core::EndpointInfo& info,
473 std::function<void(const Core::NetworkMessage&)> callback,
474 std::string name = "");
475
476/**
477 * @brief Schedule an on_message_from handler with an existing NetworkSource
478 * @param source Shared NetworkSource
479 * @param sender_address Sender IP address to filter on
480 * @param callback Invoked with each matching message
481 * @param name Optional name for the event handler
482 */
483MAYAFLUX_API void on_network_message_from(
484 std::shared_ptr<Vruta::NetworkSource> source,
485 std::string sender_address,
486 std::function<void(const Core::NetworkMessage&)> callback,
487 std::string name = "");
488
489/**
490 * @brief Schedule an on_message_from handler, constructing the NetworkSource from config
491 * @param info Endpoint configuration used to open the source
492 * @param sender_address Sender IP address to filter on
493 * @param callback Invoked with each matching message
494 * @param name Optional name for the event handler
495 * @return Shared pointer to the opened NetworkSource
496 */
497MAYAFLUX_API std::shared_ptr<Vruta::NetworkSource> on_network_message_from(
498 const Core::EndpointInfo& info,
499 std::string sender_address,
500 std::function<void(const Core::NetworkMessage&)> callback,
501 std::string name = "");
502
503/**
504 * @brief Schedule an on_message_matching handler with an existing NetworkSource
505 * @param source Shared NetworkSource
506 * @param predicate Filter; only matching messages invoke callback
507 * @param callback Invoked with each matching message
508 * @param name Optional name for the event handler
509 */
510MAYAFLUX_API void on_network_message_matching(
511 std::shared_ptr<Vruta::NetworkSource> source,
512 std::function<bool(const Core::NetworkMessage&)> predicate,
513 std::function<void(const Core::NetworkMessage&)> callback,
514 std::string name = "");
515
516/**
517 * @brief Schedule an on_message_matching handler, constructing the NetworkSource from config
518 * @param info Endpoint configuration used to open the source
519 * @param predicate Filter; only matching messages invoke callback
520 * @param callback Invoked with each matching message
521 * @param name Optional name for the event handler
522 * @return Shared pointer to the opened NetworkSource
523 */
524MAYAFLUX_API std::shared_ptr<Vruta::NetworkSource> on_network_message_matching(
525 const Core::EndpointInfo& info,
526 std::function<bool(const Core::NetworkMessage&)> predicate,
527 std::function<void(const Core::NetworkMessage&)> callback,
528 std::string name = "");
529
530}
PickCallback callback
Definition Picker.cpp:22
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
std::string name
Definition VKDevice.cpp:123
Platform-agnostic window wrapper.
Definition Window.hpp:22
Optional orchestration layer for IO reader lifetime and IOService dispatch.
Coroutine-based execution engine for composable, multi-strategy buffer processing.
Base interface for all computational processing nodes.
Definition Node.hpp:126
Coroutine resumed when a caller-supplied condition becomes true.
Definition Routine.hpp:779
A C++20 coroutine-based graphics processing task with frame-accurate timing.
Definition Routine.hpp:512
Awaitable broadcast message stream for a network endpoint.
A C++20 coroutine-based audio processing task with sample-accurate timing.
Definition Routine.hpp:327
Token-based multimodal task scheduling system for unified coroutine processing.
Definition Scheduler.hpp:51
A callable that accepts what the generator returns.
Definition Pattern.hpp:36
A callable from a step index to a value.
Definition Pattern.hpp:16
void initialize()
Definition main.cpp:10
MouseButtons
Enumeration for mouse buttons.
Definition Keys.hpp:147
@ SAMPLE_ACCURATE
Coroutine is sample-accurate.
bool cancel_event_handler(const std::string &name)
Cancel an event handler by name.
Definition Chronie.cpp:280
void on_mouse_move(const std::shared_ptr< Core::Window > &window, std::function< void(double, double)> callback, std::string name)
Schedule a mouse movement handler.
Definition Chronie.cpp:231
bool update_task_params(const std::string &name, Args... args)
Updates parameters of a scheduled task.
Definition Chronie.cpp:33
void on_scroll(const std::shared_ptr< Core::Window > &window, std::function< void(double, double)> callback, std::string name)
Schedule a mouse scroll handler.
Definition Chronie.cpp:264
void on_mouse_drag(const std::shared_ptr< Core::Window > &window, IO::MouseButtons button, std::function< void(double, double)> callback, std::string name)
Schedule a mouse drag handler.
Definition Chronie.cpp:247
std::shared_ptr< Vruta::EventManager > get_event_manager()
Gets the event manager from the default engine.
Definition Chronie.cpp:27
bool restart_task(const std::string &name)
Restarts a scheduled task.
Definition Chronie.cpp:132
void schedule_metro(double interval_seconds, std::function< void()> callback, std::string name, Vruta::ProcessingToken token)
Creates a metronome task and addes it to the default scheduler list for evaluation.
Definition Chronie.cpp:38
void schedule_sequence(std::vector< std::pair< double, std::function< void()> > > seq, std::string name, Vruta::ProcessingToken token)
Creates a sequence task that calls functions at specified times and addes it to the default scheduler...
Definition Chronie.cpp:49
uint64_t seconds_to_samples(double seconds)
Converts a time duration in seconds to the equivalent number of audio samples.
Definition Chronie.cpp:285
void on_mouse_pressed(const std::shared_ptr< Core::Window > &window, IO::MouseButtons button, std::function< void(double, double)> callback, std::string name)
Schedule a mouse button press handler.
Definition Chronie.cpp:197
void schedule_task(const std::string &name, Vruta::SoundRoutine &&task, bool initialize)
Schedules a new sound routine task.
Definition Chronie.cpp:104
float * get_line_value(const std::string &name)
Gets a pointer to a task's current value.
Definition Chronie.cpp:89
void schedule_pattern(std::function< std::any(uint64_t)> pattern_func, std::function< void(std::any)> callback, std::vector< double > durations, std::string name, Vruta::ProcessingToken token)
Schedules a pattern generator whose steps are spaced by a list of durations.
Definition Chronie.cpp:74
uint64_t seconds_to_blocks(double seconds)
Converts a time duration in seconds to the equivalent number of processing blocks.
Definition Chronie.cpp:294
void on_key_released(const std::shared_ptr< Core::Window > &window, IO::Keys key, std::function< void()> callback, std::string name)
Schedule a key release handler.
Definition Chronie.cpp:164
std::shared_ptr< Kriya::BufferPipeline > create_buffer_pipeline()
Creates a new buffer pipeline instance.
Definition Chronie.cpp:137
std::shared_ptr< Vruta::SoundRoutine > schedule_line(float start_value, float end_value, float duration_seconds, uint32_t step_duration, bool retain, std::string name)
Creates a line generator that interpolates between values over time and schedules it for evaluation.
Definition Chronie.cpp:61
bool cancel_task(const std::string &name)
Cancels a scheduled task.
Definition Chronie.cpp:127
void on_network_message_from(std::shared_ptr< Vruta::NetworkSource > source, std::string sender_address, std::function< void(const Core::NetworkMessage &)> callback, std::string name)
Schedule an on_message_from handler with an existing NetworkSource.
Definition Chronie.cpp:352
double samples_to_seconds(uint64_t samples)
Converts a number of audio samples to the equivalent time duration in seconds.
Definition Chronie.cpp:318
void on_mouse_released(const std::shared_ptr< Core::Window > &window, IO::MouseButtons button, std::function< void(double, double)> callback, std::string name)
Schedule a mouse button release handler.
Definition Chronie.cpp:214
void on_network_message(std::shared_ptr< Vruta::NetworkSource > source, std::function< void(const Core::NetworkMessage &)> callback, std::string name)
Schedule an on_message handler with an existing NetworkSource.
Definition Chronie.cpp:328
void on_network_message_matching(std::shared_ptr< Vruta::NetworkSource > source, std::function< bool(const Core::NetworkMessage &)> predicate, std::function< void(const Core::NetworkMessage &)> callback, std::string name)
Schedule an on_message_matching handler with an existing NetworkSource.
Definition Chronie.cpp:379
uint64_t samples_to_blocks(uint64_t samples)
Converts samples to blocks based on current block size.
Definition Chronie.cpp:307
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler from the default engine.
Definition Chronie.cpp:22
void on_any_key(const std::shared_ptr< Core::Window > &window, std::function< void(IO::Keys)> callback, std::string name)
Schedule a handler for any key press.
Definition Chronie.cpp:181
void on_key_pressed(const std::shared_ptr< Core::Window > &window, IO::Keys key, std::function< void()> callback, std::string name)
Schedule a key press handler.
Definition Chronie.cpp:147
Main namespace for the Maya Flux audio engine.
Definition Runtime.cpp:12
Describes one logical send/receive endpoint managed by a backend.
A received datagram or framed message with sender metadata.