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

◆ couple()

std::pair< double, double > MayaFlux::Nodes::Network::ReedOperator::couple ( double end_pressure,
double interior_flow )
nodiscardoverridevirtual

Advance the end cell and its coupling by one sample.

Parameters
end_pressurePressure of the end cell at the start of the sample
interior_flowVolume velocity leaving the end cell into the duct, from the same sample
Returns
The end pressure after the sample, then the volume velocity entering the duct through the end face

Implements MayaFlux::Nodes::Network::TerminationOperator.

Definition at line 173 of file TerminationOperators.cpp.

174{
175 m_pressure += m_alpha * (m_target_pressure.load(std::memory_order_relaxed) - m_pressure);
176
177 double breath = 0.0;
178 const double noise = m_noise.load(std::memory_order_relaxed);
179 if (noise > 0.0) {
181 breath = noise * std::abs(m_last_flow) * m_noise_scale * m_noise_state;
182 }
183
184 const double resonance = m_resonance.load(std::memory_order_relaxed);
185 double pressure = 0.0;
186 double flow = 0.0;
187 if (resonance > 0.0) {
188 const double lip = std::clamp(m_lip.load(std::memory_order_relaxed), 0.0, 1.0);
189 const auto [dynamic_pressure, dynamic_flow, difference] = Acoustics::dynamic_reed_mouth_step(
190 channel(), resonance * (1.0 + lip_stiffening * lip),
191 m_reed_damping.load(std::memory_order_relaxed) * (1.0 + lip_damping * lip),
192 m_reed_area.load(std::memory_order_relaxed), m_time_step,
193 m_motion, m_end_gain, m_pressure, end_pressure, interior_flow - breath);
194 pressure = dynamic_pressure;
195 flow = dynamic_flow;
196 } else {
197 const auto [static_pressure, static_flow, difference, status] = Acoustics::reed_mouth_step(
198 channel(), m_warm_start, m_end_gain, m_pressure, end_pressure, interior_flow - breath);
199 pressure = static_pressure;
200 flow = static_flow;
201 }
202
203 m_last_flow = flow;
204 return { pressure, flow + breath };
205}
Kinesis::Acoustics::ReedChannel channel() const noexcept

References channel(), m_alpha, m_end_gain, m_last_flow, m_lip, m_motion, m_noise, m_noise_alpha, m_noise_scale, m_noise_state, m_pressure, m_reed_area, m_reed_damping, m_resonance, m_target_pressure, m_time_step, m_warm_start, and next_white().

Here is the call graph for this function: