mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 10:37:26 -05:00
#90 [WIP] Resolves issue with MPT-1327 decoder which has apparently been broken for a long time.
This commit is contained in:
@@ -20,11 +20,15 @@ package channel.metadata;
|
|||||||
|
|
||||||
import channel.state.State;
|
import channel.state.State;
|
||||||
import module.decode.DecoderType;
|
import module.decode.DecoderType;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import sample.Broadcaster;
|
import sample.Broadcaster;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
|
|
||||||
public class MutableMetadata extends Metadata implements Listener<AttributeChangeRequest>
|
public class MutableMetadata extends Metadata implements Listener<AttributeChangeRequest>
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger(MutableMetadata.class);
|
||||||
|
|
||||||
private Broadcaster<MutableMetadataChangeEvent> mMetadataChangeEventBroadcaster = new Broadcaster<>();
|
private Broadcaster<MutableMetadataChangeEvent> mMetadataChangeEventBroadcaster = new Broadcaster<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -121,8 +121,6 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder
|
|||||||
{
|
{
|
||||||
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
|
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
|
||||||
|
|
||||||
mMutableMetadata.resetTemporalAttributes();
|
|
||||||
|
|
||||||
mState = State.IDLE;
|
mState = State.IDLE;
|
||||||
mMutableMetadata.receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
mMutableMetadata.receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
||||||
}
|
}
|
||||||
@@ -475,6 +473,7 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder
|
|||||||
*/
|
*/
|
||||||
public void configureAsTrafficChannel(TrafficChannelManager manager, CallEvent callEvent)
|
public void configureAsTrafficChannel(TrafficChannelManager manager, CallEvent callEvent)
|
||||||
{
|
{
|
||||||
|
mLog.debug("Configuring for traffic channel: " + callEvent.toCSV());
|
||||||
mTrafficChannelEndListener = manager;
|
mTrafficChannelEndListener = manager;
|
||||||
|
|
||||||
mTrafficChannelCallEvent = callEvent;
|
mTrafficChannelCallEvent = callEvent;
|
||||||
@@ -487,30 +486,32 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder
|
|||||||
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL, channel));
|
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL, channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long frequency = mTrafficChannelCallEvent.getFrequency();
|
||||||
|
|
||||||
|
if(frequency > 0)
|
||||||
|
{
|
||||||
|
mMutableMetadata.receive(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, frequency));
|
||||||
|
}
|
||||||
|
|
||||||
mMutableMetadata.receive(new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
|
mMutableMetadata.receive(new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
|
||||||
mTrafficChannelCallEvent.getDecoderType()));
|
mTrafficChannelCallEvent.getDecoderType()));
|
||||||
|
|
||||||
String details = mTrafficChannelCallEvent.getDetails();
|
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC"));
|
||||||
|
|
||||||
String from = mTrafficChannelCallEvent.getFromID();
|
String from = mTrafficChannelCallEvent.getFromID();
|
||||||
|
|
||||||
if(from != null)
|
if(from != null)
|
||||||
{
|
{
|
||||||
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, from));
|
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, from,
|
||||||
|
mTrafficChannelCallEvent.getFromIDAlias()));
|
||||||
}
|
}
|
||||||
|
|
||||||
String to = mTrafficChannelCallEvent.getToID();
|
String to = mTrafficChannelCallEvent.getToID();
|
||||||
|
|
||||||
if(to != null)
|
if(to != null)
|
||||||
{
|
{
|
||||||
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, to));
|
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, to,
|
||||||
}
|
mTrafficChannelCallEvent.getToIDAlias()));
|
||||||
|
|
||||||
long frequency = mTrafficChannelCallEvent.getFrequency();
|
|
||||||
|
|
||||||
if(frequency > 0)
|
|
||||||
{
|
|
||||||
mMutableMetadata.receive(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, frequency));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rebroadcast the allocation event so that the internal decoder states
|
/* Rebroadcast the allocation event so that the internal decoder states
|
||||||
|
|||||||
@@ -194,8 +194,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
|
|
||||||
if(processingChain == null)
|
if(processingChain == null)
|
||||||
{
|
{
|
||||||
processingChain = new ProcessingChain(channel.getName(),
|
processingChain = new ProcessingChain(channel.getName(), channel.getChannelType());
|
||||||
channel.getChannelType());
|
|
||||||
|
|
||||||
/* Register global listeners */
|
/* Register global listeners */
|
||||||
for(Listener<AudioPacket> listener : mAudioPacketListeners)
|
for(Listener<AudioPacket> listener : mAudioPacketListeners)
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
package controller.channel.map;
|
package controller.channel.map;
|
||||||
|
|
||||||
|
import controller.channel.map.ChannelMapEvent.Event;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sample.Broadcaster;
|
||||||
|
import sample.Listener;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.AbstractListModel;
|
|
||||||
|
|
||||||
import controller.channel.map.ChannelMapEvent.Event;
|
|
||||||
import sample.Broadcaster;
|
|
||||||
import sample.Listener;
|
|
||||||
|
|
||||||
public class ChannelMapModel extends AbstractListModel<ChannelMap>
|
public class ChannelMapModel extends AbstractListModel<ChannelMap>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger(ChannelMapModel.class);
|
||||||
|
|
||||||
private List<ChannelMap> mChannelMaps = new ArrayList<>();
|
private List<ChannelMap> mChannelMaps = new ArrayList<>();
|
||||||
private Broadcaster<ChannelMapEvent> mEventBroadcaster = new Broadcaster<>();
|
private Broadcaster<ChannelMapEvent> mEventBroadcaster = new Broadcaster<>();
|
||||||
|
|||||||
@@ -22,16 +22,18 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package dsp.filter;
|
package dsp.filter;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import dsp.filter.Window.WindowType;
|
||||||
import java.util.Set;
|
import dsp.filter.cic.ComplexPrimeCICDecimate;
|
||||||
import java.util.TreeSet;
|
import dsp.filter.design.FilterDesignException;
|
||||||
|
import dsp.filter.fir.FIRFilterSpecification;
|
||||||
|
import dsp.filter.fir.remez.RemezFIRFilterDesigner;
|
||||||
import org.jtransforms.fft.FloatFFT_1D;
|
import org.jtransforms.fft.FloatFFT_1D;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import dsp.filter.Window.WindowType;
|
import java.util.Arrays;
|
||||||
import dsp.filter.cic.ComplexPrimeCICDecimate;
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
public class FilterFactory
|
public class FilterFactory
|
||||||
{
|
{
|
||||||
@@ -40,6 +42,7 @@ public class FilterFactory
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates coefficients for a unity-gain, windowed low-pass filter
|
* Generates coefficients for a unity-gain, windowed low-pass filter
|
||||||
|
*
|
||||||
* @param sampleRate - hertz
|
* @param sampleRate - hertz
|
||||||
* @param frequency - cutoff in hertz
|
* @param frequency - cutoff in hertz
|
||||||
* @param length - filter length
|
* @param length - filter length
|
||||||
@@ -89,6 +92,7 @@ public class FilterFactory
|
|||||||
/**
|
/**
|
||||||
* Normalizes all filter coefficients to achieve unity (1) gain, by ensuring
|
* Normalizes all filter coefficients to achieve unity (1) gain, by ensuring
|
||||||
* that the sum of the absolute value of all coefficients adds up to 1.
|
* that the sum of the absolute value of all coefficients adds up to 1.
|
||||||
|
*
|
||||||
* @param coefficients
|
* @param coefficients
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -568,8 +572,8 @@ public class FilterFactory
|
|||||||
* Assumes that the pass band is 1/4 of the output sample rate.
|
* Assumes that the pass band is 1/4 of the output sample rate.
|
||||||
*
|
*
|
||||||
* Assumes the stop band is: pass + (pass * .25).
|
* Assumes the stop band is: pass + (pass * .25).
|
||||||
|
*
|
||||||
* @param outputSampleRate
|
* @param outputSampleRate
|
||||||
* @param stageCount
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static float[] getCICCleanupFilter(int outputSampleRate,
|
public static float[] getCICCleanupFilter(int outputSampleRate,
|
||||||
@@ -661,7 +665,6 @@ public class FilterFactory
|
|||||||
* @param samplesPerSymbol - number of samples per symbol
|
* @param samplesPerSymbol - number of samples per symbol
|
||||||
* @param symbols - number of symbols - must be even
|
* @param symbols - number of symbols - must be even
|
||||||
* @param alpha - roll-off factor
|
* @param alpha - roll-off factor
|
||||||
*
|
|
||||||
* @return - filter coefficients
|
* @return - filter coefficients
|
||||||
*/
|
*/
|
||||||
public static float[] getRootRaisedCosine(int samplesPerSymbol,
|
public static float[] getRootRaisedCosine(int samplesPerSymbol,
|
||||||
@@ -736,4 +739,23 @@ public class FilterFactory
|
|||||||
|
|
||||||
return coefficients;
|
return coefficients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a filter from the filter specification
|
||||||
|
*
|
||||||
|
* @param specification
|
||||||
|
* @return
|
||||||
|
* @throws FilterDesignException if the filter cannot be designed
|
||||||
|
*/
|
||||||
|
public static float[] getTaps(FIRFilterSpecification specification) throws FilterDesignException
|
||||||
|
{
|
||||||
|
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
||||||
|
|
||||||
|
if(designer.isValid())
|
||||||
|
{
|
||||||
|
return designer.getImpulseResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,26 +51,26 @@ public class FilterViewer extends Application
|
|||||||
// .stopBandRipple( 0.027 )
|
// .stopBandRipple( 0.027 )
|
||||||
// .build();
|
// .build();
|
||||||
|
|
||||||
FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
// FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
||||||
.sampleRate( 8000 )
|
// .sampleRate( 8000 )
|
||||||
.stopBandCutoff( 250 )
|
// .stopBandCutoff( 250 )
|
||||||
.stopBandAmplitude( 0.0 )
|
// .stopBandAmplitude( 0.0 )
|
||||||
.stopBandRipple( 0.01 )
|
// .stopBandRipple( 0.01 )
|
||||||
.passBandStart( 300 )
|
// .passBandStart( 300 )
|
||||||
.passBandAmplitude( 1.0 )
|
// .passBandAmplitude( 1.0 )
|
||||||
.passBandRipple( 0.01 )
|
// .passBandRipple( 0.01 )
|
||||||
.build();
|
|
||||||
|
|
||||||
// FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
|
||||||
// .sampleRate( 48000 )
|
|
||||||
// .stopFrequency1( 150 )
|
|
||||||
// .passFrequencyBegin( 200 )
|
|
||||||
// .passFrequencyEnd( 3950 )
|
|
||||||
// .stopFrequency2( 4000 )
|
|
||||||
// .stopRipple( 0.0005 )
|
|
||||||
// .passRipple( 0.003)
|
|
||||||
// .build();
|
// .build();
|
||||||
|
|
||||||
|
FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
||||||
|
.sampleRate( 48000 )
|
||||||
|
.stopFrequency1( 200 )
|
||||||
|
.passFrequencyBegin( 400 )
|
||||||
|
.passFrequencyEnd( 3200 )
|
||||||
|
.stopFrequency2( 3400 )
|
||||||
|
.stopRipple( 0.0003 )
|
||||||
|
.passRipple( 0.008)
|
||||||
|
.build();
|
||||||
|
|
||||||
float[] taps = null;
|
float[] taps = null;
|
||||||
|
|
||||||
// taps = FilterFactory.getLowPass( 16000, 2400, 73, WindowType.HANNING );
|
// taps = FilterFactory.getLowPass( 16000, 2400, 73, WindowType.HANNING );
|
||||||
|
|||||||
@@ -17,21 +17,22 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package dsp.fsk;
|
package dsp.fsk;
|
||||||
|
|
||||||
|
import buffer.BooleanAveragingBuffer;
|
||||||
|
import dsp.symbol.SymbolEvent;
|
||||||
|
import dsp.symbol.SymbolEvent.Shift;
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
import instrument.tap.TapGroup;
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.SymbolEventTap;
|
import instrument.tap.stream.SymbolEventTap;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sample.Listener;
|
||||||
|
import sample.real.RealBuffer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
import sample.real.RealBuffer;
|
|
||||||
import buffer.BooleanAveragingBuffer;
|
|
||||||
import dsp.symbol.SymbolEvent;
|
|
||||||
import dsp.symbol.SymbolEvent.Shift;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binary Frequency Shift Keying (FSK) decoder. Implements a BFSK correlation
|
* Binary Frequency Shift Keying (FSK) decoder. Implements a BFSK correlation
|
||||||
* decoder. Provides normal or inverted decoded output. Requires the symbol
|
* decoder. Provides normal or inverted decoded output. Requires the symbol
|
||||||
@@ -54,7 +55,12 @@ import dsp.symbol.SymbolEvent.Shift;
|
|||||||
*/
|
*/
|
||||||
public class FSK2Decoder implements Instrumentable, Listener<RealBuffer>
|
public class FSK2Decoder implements Instrumentable, Listener<RealBuffer>
|
||||||
{
|
{
|
||||||
public enum Output{ NORMAL, INVERTED };
|
private final static Logger mLog = LoggerFactory.getLogger(FSK2Decoder.class);
|
||||||
|
|
||||||
|
public enum Output
|
||||||
|
{
|
||||||
|
NORMAL, INVERTED
|
||||||
|
}
|
||||||
|
|
||||||
/* Instrumentation taps */
|
/* Instrumentation taps */
|
||||||
private static final String INSTRUMENT_DECISION =
|
private static final String INSTRUMENT_DECISION =
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ public class SDRTrunk implements Listener<TunerEvent>
|
|||||||
if(mBroadcastStatusPanel == null)
|
if(mBroadcastStatusPanel == null)
|
||||||
{
|
{
|
||||||
mBroadcastStatusPanel = new BroadcastStatusPanel(mBroadcastModel);
|
mBroadcastStatusPanel = new BroadcastStatusPanel(mBroadcastModel);
|
||||||
mBroadcastStatusPanel.setPreferredSize(new Dimension(880, 100));
|
mBroadcastStatusPanel.setPreferredSize(new Dimension(880, 70));
|
||||||
mBroadcastStatusPanel.getTable().setEnabled(false);
|
mBroadcastStatusPanel.getTable().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import controller.channel.ChannelModel;
|
|||||||
import controller.channel.ChannelProcessingManager;
|
import controller.channel.ChannelProcessingManager;
|
||||||
import controller.channel.map.ChannelMap;
|
import controller.channel.map.ChannelMap;
|
||||||
import controller.channel.map.ChannelMapModel;
|
import controller.channel.map.ChannelMapModel;
|
||||||
|
import dsp.filter.FilterFactory;
|
||||||
|
import dsp.filter.fir.FIRFilterSpecification;
|
||||||
import filter.AllPassFilter;
|
import filter.AllPassFilter;
|
||||||
import filter.FilterSet;
|
import filter.FilterSet;
|
||||||
import filter.IFilter;
|
import filter.IFilter;
|
||||||
@@ -89,12 +91,34 @@ import module.decode.tait.Tait1200DecoderState;
|
|||||||
import module.demodulate.am.AMDemodulatorModule;
|
import module.demodulate.am.AMDemodulatorModule;
|
||||||
import module.demodulate.audio.DemodulatedAudioFilterModule;
|
import module.demodulate.audio.DemodulatedAudioFilterModule;
|
||||||
import module.demodulate.fm.FMDemodulatorModule;
|
import module.demodulate.fm.FMDemodulatorModule;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DecoderFactory
|
public class DecoderFactory
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger(DecoderFactory.class);
|
||||||
|
|
||||||
|
private static final FIRFilterSpecification MPT1327_FILTER_SPECIFICATION = FIRFilterSpecification.bandPassBuilder()
|
||||||
|
.sampleRate(48000).stopFrequency1(200).passFrequencyBegin(400).passFrequencyEnd(3200)
|
||||||
|
.stopFrequency2(3400).stopRipple(0.0003).passRipple(0.008).build();
|
||||||
|
|
||||||
|
private static float[] MPT1327_BANDPASS_FILTER;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MPT1327_BANDPASS_FILTER = FilterFactory.getTaps(MPT1327_FILTER_SPECIFICATION);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
mLog.error("Couldn't design MPT1327 bandpass filter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final boolean NO_REMOVE_DC = false;
|
public static final boolean NO_REMOVE_DC = false;
|
||||||
public static final boolean REMOVE_DC = true;
|
public static final boolean REMOVE_DC = true;
|
||||||
|
|
||||||
@@ -197,7 +221,7 @@ public class DecoderFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
modules.add(new DemodulatedAudioFilterModule(MPT1327_BANDPASS_FILTER, 2.0f));
|
||||||
modules.add(new AudioModule(metadata));
|
modules.add(new AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
case PASSPORT:
|
case PASSPORT:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,49 +14,44 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.mpt1327;
|
package module.decode.mpt1327;
|
||||||
|
|
||||||
|
import alias.AliasList;
|
||||||
|
import bits.MessageFramer;
|
||||||
|
import bits.SyncPattern;
|
||||||
|
import dsp.filter.Filters;
|
||||||
|
import dsp.filter.dc.DCRemovalFilterLyons;
|
||||||
|
import dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
||||||
|
import dsp.filter.halfband.real.HalfBandFilter_RB_RB;
|
||||||
|
import dsp.fsk.FSK2Decoder;
|
||||||
|
import dsp.fsk.FSK2Decoder.Output;
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
import instrument.tap.TapGroup;
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.FloatBufferTap;
|
import instrument.tap.stream.FloatBufferTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
|
|
||||||
import module.decode.Decoder;
|
import module.decode.Decoder;
|
||||||
import module.decode.DecoderType;
|
import module.decode.DecoderType;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sample.Broadcaster;
|
import sample.Broadcaster;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.real.IFilteredRealBufferListener;
|
import sample.real.IFilteredRealBufferListener;
|
||||||
import sample.real.RealBuffer;
|
import sample.real.RealBuffer;
|
||||||
import alias.AliasList;
|
|
||||||
import bits.MessageFramer;
|
import java.util.ArrayList;
|
||||||
import bits.SyncPattern;
|
import java.util.List;
|
||||||
import dsp.filter.FilterFactory;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import dsp.filter.Filters;
|
|
||||||
import dsp.filter.Window.WindowType;
|
|
||||||
import dsp.filter.dc.DCRemovalFilterLyons;
|
|
||||||
import dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
|
||||||
import dsp.filter.halfband.real.HalfBandFilter_RB_RB;
|
|
||||||
import dsp.fsk.FSK2Decoder;
|
|
||||||
import dsp.fsk.FSK2Decoder.Output;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MPT1327 Decoder - 1200 baud 2FSK decoder that can process 48k sample rate
|
* MPT1327 Decoder - 1200 baud 2FSK decoder that can process 48k sample rate
|
||||||
* complex or floating point samples and output fully framed MPT1327 control and
|
* complex or floating point samples and output fully framed MPT1327 control and
|
||||||
* traffic messages.
|
* traffic messages.
|
||||||
*/
|
*/
|
||||||
public class MPT1327Decoder extends Decoder
|
public class MPT1327Decoder extends Decoder implements IFilteredRealBufferListener, Instrumentable
|
||||||
implements IFilteredRealBufferListener, Instrumentable
|
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(MPT1327Decoder.class);
|
private final static Logger mLog = LoggerFactory.getLogger(MPT1327Decoder.class);
|
||||||
|
|
||||||
@@ -90,21 +85,8 @@ public class MPT1327Decoder extends Decoder
|
|||||||
|
|
||||||
public MPT1327Decoder(AliasList aliasList, Sync sync)
|
public MPT1327Decoder(AliasList aliasList, Sync sync)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Decimation filter - 48000 / 2 = 24000 output */
|
/* Decimation filter - 48000 / 2 = 24000 output */
|
||||||
mDecimationFilter = new HalfBandFilter_RB_RB(
|
mDecimationFilter = new HalfBandFilter_RB_RB(Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0002f, true);
|
||||||
Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0002f, true );
|
|
||||||
|
|
||||||
/* Low pass filter: 2kHz to pass the 1200 & 1800 Hz FSK */
|
|
||||||
mLowPassFilter = new RealFIRFilter_RB_RB(
|
|
||||||
FilterFactory.getLowPass( 24000, //sampleRate,
|
|
||||||
2000, //passFrequency,
|
|
||||||
4000, //stopFrequency,
|
|
||||||
60, //attenuation,
|
|
||||||
WindowType.HANNING, //windowType,
|
|
||||||
true ) //forceOddLength
|
|
||||||
, 2.0f ); //Gain
|
|
||||||
mDecimationFilter.setListener( mLowPassFilter );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normal: 2FSK Decoder with inverted output
|
* Normal: 2FSK Decoder with inverted output
|
||||||
@@ -122,21 +104,18 @@ public class MPT1327Decoder extends Decoder
|
|||||||
{
|
{
|
||||||
throw new IllegalArgumentException("MPT1327 Decoder - unrecognized Sync type");
|
throw new IllegalArgumentException("MPT1327 Decoder - unrecognized Sync type");
|
||||||
}
|
}
|
||||||
mLowPassFilter.setListener( mFSKDecoder );
|
|
||||||
|
mDecimationFilter.setListener(mFSKDecoder);
|
||||||
|
|
||||||
mSymbolBroadcaster = new Broadcaster<Boolean>();
|
mSymbolBroadcaster = new Broadcaster<Boolean>();
|
||||||
mFSKDecoder.setListener(mSymbolBroadcaster);
|
mFSKDecoder.setListener(mSymbolBroadcaster);
|
||||||
|
|
||||||
/* Message framer for control channel messages */
|
/* Message framer for control channel messages */
|
||||||
mControlMessageFramer =
|
mControlMessageFramer = new MessageFramer(sync.getControlSyncPattern().getPattern(), sMESSAGE_LENGTH);
|
||||||
new MessageFramer( sync.getControlSyncPattern().getPattern(),
|
|
||||||
sMESSAGE_LENGTH );
|
|
||||||
mSymbolBroadcaster.addListener(mControlMessageFramer);
|
mSymbolBroadcaster.addListener(mControlMessageFramer);
|
||||||
|
|
||||||
/* Message framer for traffic channel massages */
|
/* Message framer for traffic channel massages */
|
||||||
mTrafficMessageFramer =
|
mTrafficMessageFramer = new MessageFramer(sync.getTrafficSyncPattern().getPattern(), sMESSAGE_LENGTH);
|
||||||
new MessageFramer( sync.getTrafficSyncPattern().getPattern(),
|
|
||||||
sMESSAGE_LENGTH );
|
|
||||||
mSymbolBroadcaster.addListener(mTrafficMessageFramer);
|
mSymbolBroadcaster.addListener(mTrafficMessageFramer);
|
||||||
|
|
||||||
/* Fully decoded and framed messages processor */
|
/* Fully decoded and framed messages processor */
|
||||||
@@ -195,12 +174,9 @@ public class MPT1327Decoder extends Decoder
|
|||||||
|
|
||||||
TapGroup group = new TapGroup("MPT-1327 Decoder");
|
TapGroup group = new TapGroup("MPT-1327 Decoder");
|
||||||
|
|
||||||
group.add(
|
group.add(new FloatTap(INSTRUMENT_HB1_FILTER_TO_LOW_PASS, 0, 0.5f));
|
||||||
new FloatTap( INSTRUMENT_HB1_FILTER_TO_LOW_PASS, 0, 0.5f ) );
|
group.add(new FloatTap(INSTRUMENT_LOW_PASS_TO_DECODER, 0, 0.5f));
|
||||||
group.add(
|
group.add(new BinaryTap(INSTRUMENT_DECODER_TO_FRAMER, 0, 0.025f));
|
||||||
new FloatTap( INSTRUMENT_LOW_PASS_TO_DECODER, 0, 0.5f ) );
|
|
||||||
group.add(
|
|
||||||
new BinaryTap( INSTRUMENT_DECODER_TO_FRAMER, 0, 0.025f ) );
|
|
||||||
|
|
||||||
mAvailableTaps.add(group);
|
mAvailableTaps.add(group);
|
||||||
|
|
||||||
@@ -258,20 +234,14 @@ public class MPT1327Decoder extends Decoder
|
|||||||
|
|
||||||
public enum Sync
|
public enum Sync
|
||||||
{
|
{
|
||||||
NORMAL( "Normal",
|
NORMAL("Normal", SyncPattern.MPT1327_CONTROL, SyncPattern.MPT1327_TRAFFIC),
|
||||||
SyncPattern.MPT1327_CONTROL,
|
FRENCH("French", SyncPattern.MPT1327_CONTROL_FRENCH, SyncPattern.MPT1327_TRAFFIC_FRENCH);
|
||||||
SyncPattern.MPT1327_TRAFFIC ),
|
|
||||||
FRENCH( "French",
|
|
||||||
SyncPattern.MPT1327_CONTROL_FRENCH,
|
|
||||||
SyncPattern.MPT1327_TRAFFIC_FRENCH );
|
|
||||||
|
|
||||||
private String mLabel;
|
private String mLabel;
|
||||||
private SyncPattern mControlSyncPattern;
|
private SyncPattern mControlSyncPattern;
|
||||||
private SyncPattern mTrafficSyncPattern;
|
private SyncPattern mTrafficSyncPattern;
|
||||||
|
|
||||||
private Sync( String label,
|
private Sync(String label, SyncPattern controlPattern, SyncPattern trafficPattern)
|
||||||
SyncPattern controlPattern,
|
|
||||||
SyncPattern trafficPattern )
|
|
||||||
{
|
{
|
||||||
mLabel = label;
|
mLabel = label;
|
||||||
mControlSyncPattern = controlPattern;
|
mControlSyncPattern = controlPattern;
|
||||||
@@ -310,13 +280,11 @@ public class MPT1327Decoder extends Decoder
|
|||||||
public void start(ScheduledExecutorService executor)
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,32 +14,31 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.demodulate.audio;
|
package module.demodulate.audio;
|
||||||
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
|
|
||||||
import module.Module;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
import sample.real.IFilteredRealBufferProvider;
|
|
||||||
import sample.real.IUnFilteredRealBufferListener;
|
|
||||||
import sample.real.RealBuffer;
|
|
||||||
import dsp.filter.FilterFactory;
|
import dsp.filter.FilterFactory;
|
||||||
import dsp.filter.Window.WindowType;
|
import dsp.filter.Window.WindowType;
|
||||||
import dsp.filter.dc.DCRemovalFilter_RealBuffer;
|
import dsp.filter.dc.DCRemovalFilter_RealBuffer;
|
||||||
import dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
import dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
||||||
|
import module.Module;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sample.Listener;
|
||||||
|
import sample.real.IFilteredRealBufferProvider;
|
||||||
|
import sample.real.IUnFilteredRealBufferListener;
|
||||||
|
import sample.real.RealBuffer;
|
||||||
|
|
||||||
public class DemodulatedAudioFilterModule extends Module
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
implements IUnFilteredRealBufferListener, IFilteredRealBufferProvider
|
|
||||||
|
public class DemodulatedAudioFilterModule extends Module implements IUnFilteredRealBufferListener, IFilteredRealBufferProvider
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(DemodulatedAudioFilterModule.class);
|
private final static Logger mLog = LoggerFactory.getLogger(DemodulatedAudioFilterModule.class);
|
||||||
|
|
||||||
private DCRemovalFilter_RealBuffer mDCFilter = new DCRemovalFilter_RealBuffer();
|
private DCRemovalFilter_RealBuffer mDCFilter;
|
||||||
private RealFIRFilter_RB_RB mBandPassFilter;
|
private RealFIRFilter_RB_RB mBandPassFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters demodulated audio and removes any DC component from the buffer
|
* Filters demodulated audio and removes any DC component from the buffer
|
||||||
*
|
*
|
||||||
@@ -50,6 +49,8 @@ public class DemodulatedAudioFilterModule extends Module
|
|||||||
{
|
{
|
||||||
assert (stop > pass);
|
assert (stop > pass);
|
||||||
|
|
||||||
|
mDCFilter = new DCRemovalFilter_RealBuffer();
|
||||||
|
|
||||||
//TODO: change this to a band pass filter
|
//TODO: change this to a band pass filter
|
||||||
mBandPassFilter = new RealFIRFilter_RB_RB(FilterFactory.getLowPass(48000, pass, stop, 60,
|
mBandPassFilter = new RealFIRFilter_RB_RB(FilterFactory.getLowPass(48000, pass, stop, 60,
|
||||||
WindowType.HANNING, true), 1.0f);
|
WindowType.HANNING, true), 1.0f);
|
||||||
@@ -57,6 +58,14 @@ public class DemodulatedAudioFilterModule extends Module
|
|||||||
mDCFilter.setListener(mBandPassFilter);
|
mDCFilter.setListener(mBandPassFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a demodulated audio filter using the filter taps and gain provided
|
||||||
|
*/
|
||||||
|
public DemodulatedAudioFilterModule(float[] taps, float gain)
|
||||||
|
{
|
||||||
|
mBandPassFilter = new RealFIRFilter_RB_RB(taps, gain);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
@@ -96,7 +105,14 @@ public class DemodulatedAudioFilterModule extends Module
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Listener<RealBuffer> getUnFilteredRealBufferListener()
|
public Listener<RealBuffer> getUnFilteredRealBufferListener()
|
||||||
|
{
|
||||||
|
if(mDCFilter != null)
|
||||||
{
|
{
|
||||||
return mDCFilter;
|
return mDCFilter;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mBandPassFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,25 +17,22 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.demodulate.fm;
|
package module.demodulate.fm;
|
||||||
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import dsp.filter.FilterFactory;
|
||||||
|
import dsp.filter.Window.WindowType;
|
||||||
|
import dsp.filter.fir.complex.ComplexFIRFilter_CB_CB;
|
||||||
|
import dsp.fm.FMDemodulator_CB;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.complex.ComplexBuffer;
|
import sample.complex.ComplexBuffer;
|
||||||
import sample.complex.IComplexBufferListener;
|
import sample.complex.IComplexBufferListener;
|
||||||
import sample.real.IUnFilteredRealBufferProvider;
|
import sample.real.IUnFilteredRealBufferProvider;
|
||||||
import sample.real.RealBuffer;
|
import sample.real.RealBuffer;
|
||||||
import dsp.filter.FilterFactory;
|
|
||||||
import dsp.filter.Window.WindowType;
|
|
||||||
import dsp.filter.fir.complex.ComplexFIRFilter_CB_CB;
|
|
||||||
import dsp.fm.FMDemodulator_CB;
|
|
||||||
|
|
||||||
public class FMDemodulatorModule extends Module
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
implements IComplexBufferListener, IUnFilteredRealBufferProvider
|
|
||||||
|
public class FMDemodulatorModule extends Module implements IComplexBufferListener, IUnFilteredRealBufferProvider
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(FMDemodulatorModule.class);
|
private final static Logger mLog = LoggerFactory.getLogger(FMDemodulatorModule.class);
|
||||||
|
|
||||||
@@ -52,7 +49,6 @@ public class FMDemodulatorModule extends Module
|
|||||||
* frequency should be half of the signal bandwidth since the filter will
|
* frequency should be half of the signal bandwidth since the filter will
|
||||||
* be applied against each of the inphase and quadrature signals and the
|
* be applied against each of the inphase and quadrature signals and the
|
||||||
* combined pass bandwidth will be twice this value.
|
* combined pass bandwidth will be twice this value.
|
||||||
*
|
|
||||||
* @param stop - stop frequency for IQ filtering prior to demodulation.
|
* @param stop - stop frequency for IQ filtering prior to demodulation.
|
||||||
*/
|
*/
|
||||||
public FMDemodulatorModule(int pass, int stop)
|
public FMDemodulatorModule(int pass, int stop)
|
||||||
|
|||||||
@@ -166,9 +166,11 @@ public class PlaylistManager implements ChannelEventListener
|
|||||||
|
|
||||||
mAliasModel.addAliases(playlist.getAliases());
|
mAliasModel.addAliases(playlist.getAliases());
|
||||||
mBroadcastModel.addBroadcastConfigurations(playlist.getBroadcastConfigurations());
|
mBroadcastModel.addBroadcastConfigurations(playlist.getBroadcastConfigurations());
|
||||||
mChannelModel.addChannels(playlist.getChannels());
|
|
||||||
mChannelMapModel.addChannelMaps(playlist.getChannelMaps());
|
mChannelMapModel.addChannelMaps(playlist.getChannelMaps());
|
||||||
|
|
||||||
|
//Channel model has to be loaded last since it will auto-start channels that are enabled
|
||||||
|
mChannelModel.addChannels(playlist.getChannels());
|
||||||
|
|
||||||
mPlaylistLoading = false;
|
mPlaylistLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user