From 673c8a24236b153547367f312dc23402058a600a Mon Sep 17 00:00:00 2001 From: Denny Date: Sat, 27 Jan 2018 15:57:22 -0500 Subject: [PATCH] WIP - two-channel output processor is correctly synthesizing a channel and translating it by -FS/4 to correctly center the synthesized channel. The low-pass filter is currently disabled to better troubleshoot/view the state of the synthesized channel. It appears that the synthesizer is not correctly joining the channel ... instead of down-sampling and then synthesizing the two channels, it appears to be synthesizing and then down-sampling. The synthesized channel has a null in the middle which would render it unusable. --- .../dsp/filter/channelizer/ChannelCalculator.java | 14 ++++++++++---- .../channelizer/output/ChannelOutputProcessor.java | 7 +++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelCalculator.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelCalculator.java index 0f387d8b..a33b2f2b 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelCalculator.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelCalculator.java @@ -521,15 +521,21 @@ public class ChannelCalculator int index = indexes.get(centerIndex); - if(index == getWrapAroundIndex()) + if(indexes.size() % 2 == 0) { - return (long)getIndexCenterFrequency(indexes.get(centerIndex), IndexBoundaryPolicy.ADJUST_NEGATIVE); + return (long)getIndexMaximumFrequency(index, IndexBoundaryPolicy.ADJUST_NEGATIVE); } else { - return (long)getIndexCenterFrequency(indexes.get(centerIndex), IndexBoundaryPolicy.ADJUST_POSITIVE); + if(index == getWrapAroundIndex()) + { + return (long)getIndexCenterFrequency(index, IndexBoundaryPolicy.ADJUST_NEGATIVE); + } + else + { + return (long)getIndexCenterFrequency(index, IndexBoundaryPolicy.ADJUST_POSITIVE); + } } - } /** diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java index f280efbb..c75205a4 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java @@ -68,14 +68,13 @@ public abstract class ChannelOutputProcessor implements IPolyphaseChannelOutputP @Override public void setFrequencyOffset(long frequencyOffset) { - long offset = frequencyOffset; - mLog.debug("Setting frequency offset to: " + offset); -// mFrequencyCorrectionMixer.setFrequency(offset); + mLog.debug("Setting frequency offset to: " + frequencyOffset); + mFrequencyCorrectionMixer.setFrequency(frequencyOffset); mFrequencyCorrectionEnabled = (frequencyOffset != 0); } /** - * Oscillator/mixer to use for frequency correction against incominb sample stream + * Oscillator/mixer to use for frequency correction against incoming sample stream */ protected IOscillator getFrequencyCorrectionMixer() {