More zoom tweaks, fix half-band tuner step

This commit is contained in:
Charles J. Cliffe 2015-12-13 14:09:04 -05:00
parent d448f6dfc4
commit be8cde6ce3
2 changed files with 14 additions and 12 deletions

View File

@ -186,17 +186,19 @@ void SpectrumVisualProcessor::process() {
if (is_view.load()) { if (is_view.load()) {
long freqDiff = shiftFrequency - lastShiftFrequency; long freqDiff = shiftFrequency - lastShiftFrequency;
double binPerHz = double(bandwidth) / double(fftSizeInternal); if (lastBandwidth!=0) {
double binPerHz = double(lastBandwidth) / double(fftSizeInternal);
int numShift = round(double(abs(freqDiff)) / binPerHz); int numShift = floor(double(abs(freqDiff)) / binPerHz);
if (numShift < fftSizeInternal/2) { if (numShift < fftSizeInternal/2 && numShift) {
if (freqDiff > 0) { if (freqDiff > 0) {
memmove(&fft_result_ma[0], &fft_result_ma[numShift], (fftSizeInternal-numShift) * sizeof(double)); memmove(&fft_result_ma[0], &fft_result_ma[numShift], (fftSizeInternal-numShift) * sizeof(double));
memmove(&fft_result_maa[0], &fft_result_maa[numShift], (fftSizeInternal-numShift) * sizeof(double)); memmove(&fft_result_maa[0], &fft_result_maa[numShift], (fftSizeInternal-numShift) * sizeof(double));
} else { } else {
memmove(&fft_result_ma[numShift], &fft_result_ma[0], (fftSizeInternal-numShift) * sizeof(double)); memmove(&fft_result_ma[numShift], &fft_result_ma[0], (fftSizeInternal-numShift) * sizeof(double));
memmove(&fft_result_maa[numShift], &fft_result_maa[0], (fftSizeInternal-numShift) * sizeof(double)); memmove(&fft_result_maa[numShift], &fft_result_maa[0], (fftSizeInternal-numShift) * sizeof(double));
}
} }
} }
} }

View File

@ -162,7 +162,7 @@ void TuningCanvas::StepTuner(ActiveState state, int exponent, bool up) {
double exp = pow(10, exponent); double exp = pow(10, exponent);
long long amount = up?exp:-exp; long long amount = up?exp:-exp;
if (halfBand && exp == 1) { if (halfBand) {
amount *= 2; amount *= 2;
} }