| 101 | } |
| 102 | |
| 103 | void PhaseLockFFTProcessor::doMorphTransition(PolarVector &out) { |
| 104 | if(m_transitionMagState.shouldStartTransition() && m_transitionPhaseState.shouldStartTransition()) { |
| 105 | m_targetMags.clear(); |
| 106 | m_targetPhases.clear(); |
| 107 | for(auto& input : out) { |
| 108 | m_targetMags.push_back(input.m_mag); |
| 109 | m_targetPhases.push_back(input.m_phase); |
| 110 | } |
| 111 | } |
| 112 | else if(m_transitionMagState.shouldStartTransition()) { |
| 113 | m_targetMags.clear(); |
| 114 | for(auto& input : out) { |
| 115 | m_targetMags.push_back(input.m_mag); |
| 116 | } |
| 117 | } |
| 118 | else if(m_transitionPhaseState.shouldStartTransition()) { |
| 119 | m_targetPhases.clear(); |
| 120 | for(auto& input : out) { |
| 121 | m_targetPhases.push_back(input.m_phase); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | if(!m_transitionMagState.isOff() && !m_transitionPhaseState.isOff()) { |
| 126 | const float phaseInterpolateFactor = m_transitionPhaseState.next(); //std::min<float>(1.f, m_transitionPhaseCounter / m_transitionPhaseEnd); |
| 127 | const float magInterpolateFactor = m_transitionMagState.next(); //std::min<float>(1.f, m_transitionMagCounter / m_transitionMagEnd); |
| 128 | |
| 129 | for(size_t i=0; i < m_targetMags.size(); ++i) { |
| 130 | out[i].m_mag = utilities::interp_lin_normalised<float>(out[i].m_mag, m_targetMags[i], magInterpolateFactor); |
| 131 | out[i].m_phase = utilities::interp_lin_normalised<float>(out[i].m_phase, m_targetPhases[i], phaseInterpolateFactor); |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | bool PhaseLockFFTProcessor::setFFTSize(const int newSize) { |
| 137 | const size_t newVectorSize = static_cast<size_t>(newSize); |
nothing calls this directly
no test coverage detected