gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit a2752adbb6351bd1a75d7c014e1e654922b5a848
parent 2014c5eb6f3c69372eddaf0962aad1fc66b70581
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sat, 22 Jun 2024 19:58:04 +0200

update time domain graph from frequency/phase modifications

Diffstat:
Msource/xtJucePlugin/weGraphData.cpp | 29+++++++++++++++++++++++++++++
Msource/xtJucePlugin/weGraphData.h | 1+
2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/source/xtJucePlugin/weGraphData.cpp b/source/xtJucePlugin/weGraphData.cpp @@ -48,6 +48,7 @@ namespace xtJucePlugin if(m_frequencies[_index] == _value) return; m_frequencies[_index] = _value; + updateDataFromFrequenciesAndPhases(); onSourceChanged(m_source); } @@ -56,6 +57,7 @@ namespace xtJucePlugin if(m_phases[_index] == _value) return; m_phases[_index] = _value; + updateDataFromFrequenciesAndPhases(); onSourceChanged(m_source); } @@ -84,4 +86,31 @@ namespace xtJucePlugin // m_phases[i] = 0; } } + + void GraphData::updateDataFromFrequenciesAndPhases() + { + const auto scale = static_cast<float>(m_fft.getSize()>>1); + + for(uint32_t i=0; i<m_frequencies.size(); ++i) + { + const auto re = cos(m_phases[i] * g_pi) * scale * m_frequencies[i]; + const auto im = sin(m_phases[i] * g_pi) * scale * m_frequencies[i]; + + m_fftInData[i].real(re); + m_fftInData[i].imag(im); + + if(!i) + continue; + + m_fftInData[128-i].real(re); + m_fftInData[128-i].imag(-im); + } + + m_fft.perform(m_fftInData.data(), m_fftOutData.data(), true); + + for(uint32_t i=0; i<m_data.size(); ++i) + { + m_data[i] = m_fftOutData[i].real(); + } + } } diff --git a/source/xtJucePlugin/weGraphData.h b/source/xtJucePlugin/weGraphData.h @@ -28,6 +28,7 @@ namespace xtJucePlugin private: void updateFrequenciesAndPhases(); + void updateDataFromFrequenciesAndPhases(); WaveData m_source;