Fixes #815 - Change usable bandwidth percentage based on Airspy samplerate (#976)

This commit is contained in:
Robert Scullin
2020-10-25 06:33:25 -04:00
committed by GitHub
parent 05c0b51fde
commit c6afb1c133
2 changed files with 27 additions and 0 deletions

View File

@@ -275,6 +275,14 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
return (int)(getBandwidth() * mUsableBandwidthPercentage);
}
/**
* Sets the usable bandwidth percentage -- this can change based on samplerate for some tuners
*/
public void setUsableBandwidthPercentage(double usableBandwidthPercentage)
{
mUsableBandwidthPercentage = usableBandwidthPercentage;
}
/**
* Usable half bandwidth - total bandwidth minus unusable space at either end of the spectrum.
*

View File

@@ -406,6 +406,25 @@ public class AirspyTunerController extends USBTunerController
{
mSampleRate = rate.getRate();
mFrequencyController.setSampleRate(mSampleRate);
// Update the Usable Bandwidth Percentage, as the usable range varies with the sample rate.
// Values below are from https://github.com/DSheirer/sdrtrunk/issues/815#issuecomment-699859590
switch(mSampleRate)
{
default:
case 10000000:
super.setUsableBandwidthPercentage(0.90);
break;
case 6000000:
super.setUsableBandwidthPercentage(0.83);
break;
case 3000000:
super.setUsableBandwidthPercentage(0.66);
break;
case 2500000:
super.setUsableBandwidthPercentage(0.60);
break;
}
}
}
}