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

◆ operator*()

MAYAFLUX_API void MayaFlux::Nodes::Generator::operator* ( const std::shared_ptr< Node > &  node,
double  value 
)

Sets the generator's amplitude.

Parameters
nodeGenerator node to modify
valueNew amplitude value

This operator allows setting the generator's amplitude using a more intuitive syntax, such as:

auto generator = std::make_shared<Sine>(440, 1, 0);
generator * 0.5; // Halves the amplitude

Definition at line 59 of file Generator.cpp.

60{
61 if (auto gen = std::dynamic_pointer_cast<Generator>(node)) {
62 gen->set_amplitude(value);
63 } else {
64 MF_ERROR(Journal::Component::API, Journal::Context::NodeProcessing,
65 "Cannot multiply non-generator node by a scalar. "
66 "Use set_[params] methods or create a BinaryOpNode.");
67 }
68}
#define MF_ERROR(comp, ctx,...)

References MayaFlux::Journal::API, MF_ERROR, and MayaFlux::Journal::NodeProcessing.