MCPcopy Create free account
hub / github.com/LabSound/LabSound / PeriodicWave

Method PeriodicWave

src/core/PeriodicWave.cpp:32–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30using namespace VectorMath;
31
32PeriodicWave::PeriodicWave(const float sampleRate, OscillatorType basicWaveform)
33 : m_centsPerRange(CentsPerRange)
34 , m_sampleRate(sampleRate)
35{
36 float nyquist = 0.5f * m_sampleRate;
37 m_lowestFundamentalFrequency = nyquist / maxNumberOfPartials();
38 m_rateScale = periodicWaveSize() / m_sampleRate;
39
40 // Compute the number of ranges needed to cover the entire frequency range, assuming
41 // kNumberOfOctaveBands per octave.
42 m_numberOfRanges = static_cast<int>(0.5f + kNumberOfOctaveBands * log2f(static_cast<float>(periodicWaveSize())));
43
44 generateBasicWaveform(basicWaveform);
45}
46
47PeriodicWave::PeriodicWave(const float sampleRate, OscillatorType basicWaveform, std::vector<float> & real, std::vector<float> & imag)
48 : m_centsPerRange(CentsPerRange)

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected