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

◆ pluck()

void MayaFlux::Nodes::Network::WaveguideNetwork::pluck ( double  position = 0.5,
double  strength = 1.0 
)

Pluck the string at a normalized position.

Parameters
positionNormalized position along string (0.0 to 1.0)
strengthExcitation amplitude (0.0 to 1.0+)

Fills the delay line with a shaped noise burst. Position affects spectral content: 0.5 = center (warm), near 0/1 = bridge (bright).

Definition at line 208 of file WaveguideNetwork.cpp.

209{
210 position = std::clamp(position, 0.01, 0.99);
211
212 if (m_segments.empty()) {
213 return;
214 }
215
216 auto& seg = m_segments[0];
217 const size_t len = m_delay_length_integer;
218 const auto pluck_sample = static_cast<size_t>(position * static_cast<double>(len));
219
220 seg.p_plus = Memory::HistoryBuffer<double>(seg.p_plus.capacity());
221 seg.p_minus = Memory::HistoryBuffer<double>(seg.p_minus.capacity());
222
223 for (size_t s = 0; s < len; ++s) {
224 double value = 0.0;
225 if (s <= pluck_sample) {
226 value = strength * static_cast<double>(s)
227 / static_cast<double>(pluck_sample);
228 } else {
229 value = strength * static_cast<double>(len - s)
230 / static_cast<double>(len - pluck_sample);
231 }
232 seg.p_plus.push(value);
233 }
234
235 m_exciter_active = false;
237}
glm::vec3 position
std::vector< WaveguideSegment > m_segments

References m_delay_length_integer, m_exciter_active, m_exciter_samples_remaining, m_segments, and position.