I've made a DSP module based on the excellent foobar tutorial by foosion. The only remaining problem I'm experiencing is that the audio clicks and pops when modifying the GUI. I've traced the problem to an equivalent code in the tutorial.
In the on_chunk function, it starts with:
CODE
if (channel_count != m_last_sample.get_size()) {
unsigned channel_count = chunk->get_channels();
...
// number of channels has changed - (re)initialize "history"
m_last_sample.set_size(channel_count);
m_last_sample.fill<audio_sample>(0);
}
unsigned channel_count = chunk->get_channels();
...
// number of channels has changed - (re)initialize "history"
m_last_sample.set_size(channel_count);
m_last_sample.fill<audio_sample>(0);
}
For some reason the size of m_last_sample is 0, when the GUI slider is moved. The scrolling action results in m_dirty = true; and update_display();
Maybe this causes the update_display() function to reset the array, or create a new blank instance?
In my DSP module more samples are stored (2. order IIR filter), so the buffer reset is noticeable. When this mystery is solved, I can finally upload the plugin
I've not been able to locate where the array is reset. Is there any way to avoid this reset?