MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Vruta::routine_promise< RoutineType > Struct Template Reference

Base coroutine promise type for audio processing tasks. More...

#include <Promise.hpp>

+ Inheritance diagram for MayaFlux::Vruta::routine_promise< RoutineType >:
+ Collaboration diagram for MayaFlux::Vruta::routine_promise< RoutineType >:

Public Member Functions

void domain_mismatch_error (const std::string &awaiter_name, const std::string &suggestion)
 
std::suspend_always final_suspend () noexcept
 Determines whether the coroutine suspends before destruction.
 
RoutineType get_return_object ()
 
template<typename T >
T * get_state (const std::string &key)
 Retrieves a value from the state dictionary.
 
std::suspend_never initial_suspend ()
 Determines whether the coroutine suspends immediately upon creation.
 
void return_void ()
 Handles the coroutine's void return.
 
template<typename T >
void set_state (const std::string &key, T value)
 Stores a value in the state dictionary.
 
void unhandled_exception ()
 Handles exceptions thrown from within the coroutine.
 

Public Attributes

bool auto_resume = true
 Flag indicating whether the coroutine should be automatically resumed.
 
uint64_t delay_amount = 0
 Amount of delay requested by the coroutine.
 
const ProcessingToken processing_token { ProcessingToken::ON_DEMAND }
 Token indicating how this coroutine should be processed.
 
bool should_terminate = false
 Flag indicating whether the coroutine should be terminated.
 
std::unordered_map< std::string, std::any > state
 Dictionary for storing arbitrary state data.
 
const bool sync_to_clock = false
 Flag indicating whether the coroutine should synchronize with the audio clock.
 

Detailed Description

template<typename RoutineType>
struct MayaFlux::Vruta::routine_promise< RoutineType >

Base coroutine promise type for audio processing tasks.

This promise_type serves as the base class for all coroutine promises in the MayaFlux engine. It defines the common behavior and interface for coroutines, including lifecycle management, state storage, and execution flags.

The promise_type is a crucial component of C++20 coroutines that defines the behavior of SoundRoutine coroutines. It serves as the control interface between the coroutine machinery and the audio engine, managing:

In the coroutine model, the promise object is created first when a coroutine function is called. It then creates and returns the SoundRoutine object that the caller receives. The promise remains associated with the coroutine frame throughout its lifetime, while the RoutineType provides the external interface to manipulate the coroutine.

Definition at line 34 of file Promise.hpp.


The documentation for this struct was generated from the following file: