Hi everyone, I'm back with a (possibly stupid) question...
I'm building an additive synthesizer, and it's working pretty well... generally
The problem is: when I test it in REAPER, for example, I can play a few notes, then the sound crackles and glitches and then stops, and I can't play any more notes. The strange thing is that the VU meter shows actual signal, with the correct envelope and everything.
Can anyone help me sorting this out?
This is the source for the SynthesizerVoice: https://github.com/frabert/dreamscope/blob/master/Source/AdditiveSynth.h
What going on is I have a wavetable and 64 harmonics with separate linear ADSR. I know, it's ugly code, it probably creates a lot of aliasing and lots of other nasty things, but I'd like to solve this issue before polishing the engine.
In line 82 I'm returning because the synth is not playing, so no point filling the buffer with zeroes, I guess...
I'm afraid I didn't understand what you mean by "you are only writing 1 sample to the buffer at startSample": I'm iterating down from numSamples to 0, so that should put numSamples floats into the buffer, right?
I have just noticed that using VSTHost instead of REAPER causes stutter instead of silence: I've come to the conclusion that the cause is CPU overload, basically I'm doing too much in a cycle. I still don't understand why it only happens after a while...