MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ register_network()

MAYAFLUX_API void MayaFlux::register_network ( const std::shared_ptr< Nodes::Network::NodeNetwork > &  network,
const CreationContext ctx 
)

Definition at line 42 of file Creator.cpp.

43{
44 auto token = get_node_token(ctx.domain.value());
45
46 if (token == Nodes::ProcessingToken::AUDIO_RATE) {
47 if (
48 network->get_output_mode() != Nodes::Network::OutputMode::AUDIO_SINK
49 && network->get_output_mode() != Nodes::Network::OutputMode::AUDIO_COMPUTE) {
50 MF_WARN(Journal::Component::API,
51 Journal::Context::Init,
52 "Registering audio network in AUDIO_RATE domain without AUDIO_SINK or AUDIO_COMPUTE mode. Forcing AUDIO_SINK mode.");
53 network->set_output_mode(Nodes::Network::OutputMode::AUDIO_SINK);
54 }
55 if (ctx.channel.has_value()) {
56 network->add_channel_usage(ctx.channel.value());
57 } else if (ctx.channels.has_value()) {
58 for (uint32_t ch : ctx.channels.value()) {
59 network->add_channel_usage(ch);
60 }
61 }
62 } else if (token == Nodes::ProcessingToken::VISUAL_RATE && network->get_output_mode() != Nodes::Network::OutputMode::GRAPHICS_BIND) {
63 MF_WARN(Journal::Component::API,
64 Journal::Context::Init,
65 "Registering visual network in VISUAL_RATE domain without GRAPHICS_BIND output mode. Forcing GRAPHICS_BIND mode.");
66 network->set_output_mode(Nodes::Network::OutputMode::GRAPHICS_BIND);
67 }
68
69 register_node_network(network, token);
70}
#define MF_WARN(comp, ctx,...)
MAYAFLUX_API Nodes::ProcessingToken get_node_token(Domain domain)
Extracts node processing token from domain.
Definition Domain.hpp:174
void register_node_network(const std::shared_ptr< Nodes::Network::NodeNetwork > &network, const Nodes::ProcessingToken &token)
Registers a node network with the default engine's node graph manager.
Definition Graph.cpp:178
std::optional< uint32_t > channel
Definition Creator.hpp:10
std::optional< std::vector< uint32_t > > channels
Definition Creator.hpp:11
std::optional< Domain > domain
Definition Creator.hpp:9

References MayaFlux::Journal::API, MayaFlux::Nodes::Network::AUDIO_COMPUTE, MayaFlux::Nodes::AUDIO_RATE, MayaFlux::Nodes::Network::AUDIO_SINK, MayaFlux::CreationContext::channel, MayaFlux::CreationContext::channels, MayaFlux::CreationContext::domain, get_node_token(), MayaFlux::Nodes::Network::GRAPHICS_BIND, MayaFlux::Journal::Init, MF_WARN, register_node_network(), and MayaFlux::Nodes::VISUAL_RATE.

Referenced by MayaFlux::CreationHandle< T >::apply_network_context(), and operator|().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: