55 uint16_t* currentMixer =
nullptr;
58 uint16_t* currentSummer =
nullptr;
61 uint16_t* currentResonance =
nullptr;
64 uint16_t* currentVolume =
nullptr;
90 bool voice3off =
false;
130 inline unsigned int getFC()
const {
return static_cast<unsigned int>(fc); }
132 virtual void restartIntegrators() = 0;
134 inline int32_t getNormalizedVoice(
float v, uint8_t env)
const
136 return m_fmc.getNormalizedVoice(v, env);
139 virtual int32_t getNormalizedMixerVoice(
float v, uint8_t env)
const = 0;
142 Filter(
const FilterModelConfig& fmc,
143 const Integrator& hpIntegrator,
144 const Integrator& bpIntegrator);
146 virtual ~Filter() =
default;
156 uint16_t
clock(Voice& voice1, Voice& voice2, Voice& voice3);
205 void restart() { restartIntegrators(); Vhp = 0; Vlp = 0; Vbp = 0; }
219 const float wav1 = voice1.
output();
220 const float wav2 = voice2.
output();
221 const float wav3 = voice3.
output();
224 const uint8_t env1 = voice1.envelope()->
output();
225 const uint8_t env2 = voice2.envelope()->
output();
226 const uint8_t env3 = voice3.envelope()->
output();
230 Vsum += filt1 ? getNormalizedVoice(wav1, env1) : 0;
231 Vsum += filt2 ? getNormalizedVoice(wav2, env2) : 0;
232 Vsum += filt3 ? getNormalizedVoice(wav3, env3) : 0;
233 Vsum += filtE ? getNormalizedVoice(extin, 0) : 0;
235 Vsum += currentResonance[Vbp];
238 Vhp = currentSummer[Vsum];
239 Vbp = m_hpIntegrator.solve(Vhp);
240 Vlp = m_bpIntegrator.solve(Vbp);
243 if (lp) Vfilt += Vlp;
244 if (bp) Vfilt += Vbp;
245 if (hp) Vfilt += Vhp;
249 Vmix += filt1 ? 0 : getNormalizedMixerVoice(wav1, env1);
250 Vmix += filt2 ? 0 : getNormalizedMixerVoice(wav2, env2);
252 Vmix += (filt3 || voice3off) ? 0 : getNormalizedMixerVoice(wav3, env3);
253 Vmix += filtE ? 0 : getNormalizedMixerVoice(extin, 0);
256 return currentVolume[currentMixer[Vmix]];