mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-11 08:07:24 -05:00
WIP - implements tuner source manager to calculate and update the tuner's
center frequency each time we allocate a new DDC/channel. Adds support for broadcasting channel count change source events so that the tuner can accurately convey sourced channel counts via tuner events. Completes changeover of polyphase channel manager to support arbitrary bandwidth channels. The new approach provides greater compatibility across any tuner sample rates. Likewise, all decoders will have to be updated to adapt to any channel sample rate, although channel bandwidths will be at least 12.5 kHz and likely no more than 25.0 kHz, with a 2x oversampling that produces channel sample rates in range 25.0 - 50.0 kHz.
This commit is contained in:
@@ -18,15 +18,17 @@
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.source;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class SourceEvent
|
||||
{
|
||||
public enum Event
|
||||
{
|
||||
NOTIFICATION_CHANNEL_COUNT_CHANGE,
|
||||
NOTIFICATION_CHANNEL_FREQUENCY_CORRECTION_CHANGE,
|
||||
NOTIFICATION_CHANNEL_SAMPLE_RATE_CHANGE,
|
||||
NOTIFICATION_FREQUENCY_CHANGE,
|
||||
NOTIFICATION_FREQUENCY_CORRECTION_CHANGE,
|
||||
NOTIFICATION_POLYPHASE_CHANNEL_COUNT_CHANGE,
|
||||
NOTIFICATION_SAMPLE_RATE_CHANGE,
|
||||
|
||||
REQUEST_CHANNEL_FREQUENCY_CORRECTION_CHANGE,
|
||||
@@ -34,6 +36,11 @@ public class SourceEvent
|
||||
REQUEST_SOURCE_DISPOSE,
|
||||
REQUEST_START_SAMPLE_STREAM,
|
||||
REQUEST_STOP_SAMPLE_STREAM;
|
||||
|
||||
public static EnumSet<Event> NOTIFICATION_EVENTS =
|
||||
EnumSet.range(NOTIFICATION_CHANNEL_COUNT_CHANGE, NOTIFICATION_SAMPLE_RATE_CHANGE);
|
||||
public static EnumSet<Event> REQUEST_EVENTS =
|
||||
EnumSet.range(NOTIFICATION_CHANNEL_COUNT_CHANGE, NOTIFICATION_SAMPLE_RATE_CHANGE);
|
||||
}
|
||||
|
||||
private Event mEvent;
|
||||
@@ -66,6 +73,22 @@ public class SourceEvent
|
||||
return mEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this is a notification event
|
||||
*/
|
||||
public boolean isNotificationEvent()
|
||||
{
|
||||
return Event.NOTIFICATION_EVENTS.contains(mEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this is a request event
|
||||
*/
|
||||
public boolean isRequestEvent()
|
||||
{
|
||||
return Event.REQUEST_EVENTS.contains(mEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Value associated with the event.
|
||||
*/
|
||||
@@ -152,7 +175,7 @@ public class SourceEvent
|
||||
*/
|
||||
public static SourceEvent channelCountChange(int channelCount)
|
||||
{
|
||||
return new SourceEvent(Event.NOTIFICATION_POLYPHASE_CHANNEL_COUNT_CHANGE, channelCount);
|
||||
return new SourceEvent(Event.NOTIFICATION_CHANNEL_COUNT_CHANGE, channelCount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,4 +222,9 @@ public class SourceEvent
|
||||
{
|
||||
return new SourceEvent(Event.REQUEST_SOURCE_DISPOSE, source);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "SOURCE EVENT:" + mEvent + " VALUE:" + (mValue != null ? mValue : "(empty)");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user