I looked SO2SDR briefly and will install it during the weekend.
I did not find code for " spectrumProcessor" part, is that in one of the included libraries?
Yes, that is where all the peak detection is. It is all in spectrum.h and spectrum.cpp. Look in the function "detectPeaks". Sorry, the code could be a lot clearer and better documented
I do something like this:
1) for each spectrum from the FFT, do some smoothing (a running average in frequency). Also average several recent spectra together in time.
2) look for peaks in the averaged spectrum, computing the center frequency. Store this in a list, along with the number of times this frequency has been found.
3) once a peak has been detected several times with the same (within some delta_frequency) center frequency, count it as an active "signal". Otherwise remove peaks after a certain time interval has elapsed. Keep active signals in the list for somewhat longer.
#3 is important for distinguishing peaks from noise- otherwise it is easy to find peaks in a noisy band. But a CW signal will have a frequency that is constant.