#36 NBFM squelch control. Updates NBFM decoder to incorporate squelch control. Squelch is a configuration item and also available to adjust at runtime with new 'Channel' tab in Now Playing window. All decoders were updated to produce continuous channel power (dB) measurements that are displayed in the Channel tab's new Power Meter. (#1100)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2021-11-14 06:59:58 -05:00
committed by GitHub
parent 7303e06943
commit 4b806ecfde
40 changed files with 2348 additions and 98 deletions

View File

@@ -34,6 +34,7 @@ public class SourceEvent
{
NOTIFICATION_CHANNEL_COUNT_CHANGE,
NOTIFICATION_CHANNEL_FREQUENCY_CORRECTION_CHANGE,
NOTIFICATION_CHANNEL_POWER,
NOTIFICATION_CHANNEL_SAMPLE_RATE_CHANGE,
NOTIFICATION_FREQUENCY_AND_SAMPLE_RATE_LOCKED,
NOTIFICATION_FREQUENCY_AND_SAMPLE_RATE_UNLOCKED,
@@ -45,6 +46,7 @@ public class SourceEvent
NOTIFICATION_MEASURED_FREQUENCY_ERROR_SYNC_LOCKED,
NOTIFICATION_RECORDING_FILE_LOADED,
NOTIFICATION_SAMPLE_RATE_CHANGE,
NOTIFICATION_SQUELCH_THRESHOLD,
NOTIFICATION_STOP_SAMPLE_STREAM,
NOTIFICATION_ERROR_STATE,
@@ -53,6 +55,8 @@ public class SourceEvent
REQUEST_FREQUENCY_ROTATION,
REQUEST_FREQUENCY_SELECTION,
REQUEST_SOURCE_DISPOSE,
REQUEST_CHANGE_SQUELCH_THRESHOLD,
REQUEST_CURRENT_SQUELCH_THRESHOLD,
REQUEST_START_SAMPLE_STREAM,
REQUEST_STOP_SAMPLE_STREAM;
@@ -421,6 +425,50 @@ public class SourceEvent
return new SourceEvent(Event.NOTIFICATION_FREQUENCY_ROTATION_FAILURE, source, frequency);
}
/**
* Creates a notification of current channel power level
* @param source producing the notification
* @param powerDb of the channel (avg)
* @return new source event
*/
public static SourceEvent channelPowerLevel(Source source, double powerDb)
{
return new SourceEvent(Event.NOTIFICATION_CHANNEL_POWER, source, powerDb);
}
/**
* Creates a squelch threshold change notification
* @param source for the event
* @param thresholdDb setting for the power squelch
* @return new source event
*/
public static SourceEvent squelchThreshold(Source source, double thresholdDb)
{
return new SourceEvent(Event.NOTIFICATION_SQUELCH_THRESHOLD, source, thresholdDb);
}
/**
* Requests the current squelch threshold value
* @param source optional
* @return source event
*/
public static SourceEvent requestCurrentSquelchThreshold(Source source)
{
return new SourceEvent(Event.REQUEST_CURRENT_SQUELCH_THRESHOLD, source, 0);
}
/**
* Creates a new squelch threshold level be applied to the channel's power squelch control
* @param source of the request
* @param thresholdDb setting to apply
* @return new source event
*/
public static SourceEvent requestSquelchThreshold(Source source, double thresholdDb)
{
return new SourceEvent(Event.REQUEST_CHANGE_SQUELCH_THRESHOLD, source, thresholdDb);
}
@Override
public String toString()
{

View File

@@ -71,4 +71,15 @@ public class ChannelSpecification
{
return mStopFrequency;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("Channel Specification - min sample rate: ").append(mMinimumSampleRate);
sb.append(" bandwidth: ").append(mBandwidth);
sb.append(" pass: ").append(mPassFrequency);
sb.append(" stop: ").append(mStopFrequency);
return sb.toString();
}
}

View File

@@ -194,6 +194,10 @@ public abstract class TunerChannelSource extends ComplexSource implements ISourc
break;
case NOTIFICATION_FREQUENCY_ROTATION_FAILURE:
case NOTIFICATION_FREQUENCY_ROTATION_SUCCESS:
case NOTIFICATION_CHANNEL_POWER:
case NOTIFICATION_SQUELCH_THRESHOLD:
case REQUEST_CHANGE_SQUELCH_THRESHOLD:
case REQUEST_CURRENT_SQUELCH_THRESHOLD:
//Ignore
break;
default:

View File

@@ -68,7 +68,12 @@ public class ComplexWaveSource extends ComplexSource implements IControllableFil
{
if(file == null || !file.exists() || !supports(file))
{
throw new IOException("Empty or Unsupported file format");
throw new IOException("Empty or null file");
}
if(!supports(file))
{
throw new IOException("Unsupported file format");
}
mFile = file;