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

◆ operator*() [2/2]

void MayaFlux::Nodes::operator* ( 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 28 of file NodeOperators.cpp.

29{
30 if (auto gen = std::dynamic_pointer_cast<Generator::Generator>(node)) {
31 gen->set_amplitude(value);
32 } else {
33 std::cerr << "Error: Cannot multiply non-generator node by a scalar\n."
34 << "Either use one of the set_[params] methods, or use the appropriate node to create BinaryOpNode" << std::endl;
35 }
36}