Do not copy and paste

Sometimes you are tempted to copy and paste some of your code.

class Sound : public AlsaParams {
public:
	virtual int asound_fftcopy () = 0;
//
};

int SoundIC7410::asound_fftcopy() {
	/* copy into FFT input buffer */
	if(signal_end - signal_start >= nfft*channels) { /* this should always be true */
		auto p = signal_start;
		for (int i = 0; i < nfft; i++) {
			in[i][0] = *p++ * audio_window[i];
			in[i][1] = 0.0; /* no imaginary part */
		}
		return 0;
	} else { /* should never happen */
		cout << "SoundIC7410::asound_fftcopy((): error " << endl;
		return 1;
	}
}

int SoundSoft66::asound_fftcopy() {
	/* copy into FFT input buffer */
	if(signal_end - signal_start >= nfft*channels) { /* this should always be true */
		auto p = signal_start;
		for (int i = 0; i < nfft; i++) {
			in[i][1] = *p++ * audio_window[i]; /* invert I and Q signals */
			in[i][0] = *p++ * audio_window[i]; /* invert I and Q signals */
		}
		return 0;
	} else { /* should never happen */
		cout << "SoundSoft66::asound_fftcopy((): error " << endl;
		return 1;
	}
}

But, it is almost always a bad idea to do so. So in this particular case, what should I do?

Note that I am using complex one-dimensional DFTs for both cases so that there is more room for refactoring.

cw_decode

Is this decodable?