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,11 +186,12 @@ void SpectrumVisualProcessor::process() {
if (is_view.load()) {
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) {
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));
@ -202,6 +203,7 @@ void SpectrumVisualProcessor::process() {
}
}
}
}
if (shiftBuffer.size() != desired_input_size) {
if (shiftBuffer.capacity() < desired_input_size) {

View File

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