Creates new HeterodyneChannelSourceManager that uses frequency translation

and CIC decimation for each channel provided by the tuner.
This commit is contained in:
Denny
2018-09-04 08:16:57 -04:00
parent f963d821a1
commit b8a46af836
26 changed files with 1568 additions and 137 deletions

View File

@@ -63,6 +63,29 @@ public class ReusableComplexBufferAssembler
mListener = null;
}
/**
* Adds the samples to this assembler. As each buffer is assembled, it will be dispatched to the registered
* listener.
*
* @param inphase sample to assemble
* @param quadrature sample to assemble
*/
public void receive(float inphase, float quadrature)
{
if(mBuffer.remaining() >= 2)
{
mBuffer.put(inphase);
mBuffer.put(quadrature);
mTimestampManager.increment(1);
if(!mBuffer.hasRemaining())
{
flush();
}
}
}
/**
* Adds the samples to this assembler. As each buffer is assembled, it will be dispatched to the registered
* listener.

View File

@@ -1,58 +1,75 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 Dennis Sheirer
*
* 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 the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
package io.github.dsheirer.sample.decimator;
import io.github.dsheirer.sample.complex.ComplexSampleListener;
/**
* Decimator for complex samples
*/
public class ComplexDecimator implements ComplexSampleListener
{
private ComplexSampleListener mListener;
private int mCounter = 0;
private int mDecimationRate;
private ComplexSampleListener mListener;
private int mCounter = 0;
private int mDecimationRate;
/**
* Constructs a new Decimator object with the specified decimation rate.
*/
public ComplexDecimator( int rate )
{
mDecimationRate = rate;
}
public void dispose()
{
mListener = null;
}
/**
* Sets a new decimation rate. Rate can be changed after this object
* is constructed.
*/
public synchronized void setDecimationRate( int rate )
{
mDecimationRate = rate;
}
/**
* Receives samples allowing only 1 of every (rate) sample to go on
* to the registered listener
*/
@Override
public void receive( float i, float q )
/**
* Constructs a new Decimator object with the specified decimation rate.
*/
public ComplexDecimator(int rate)
{
mCounter++;
if( mCounter >= mDecimationRate )
{
mListener.receive( i, q );
mCounter = 0;
}
mDecimationRate = rate;
}
public void dispose()
{
mListener = null;
}
/**
* Sets a new decimation rate. Rate can be changed after this object
* is constructed.
*/
public synchronized void setDecimationRate(int rate)
{
mDecimationRate = rate;
}
/**
* Receives samples allowing only 1 of every (rate) sample to go on
* to the registered listener
*/
@Override
public void receive(float i, float q)
{
mCounter++;
if(mCounter >= mDecimationRate)
{
mListener.receive(i, q);
mCounter = 0;
}
}
/**
* Sets the decimated output listener
*/
public void setListener(ComplexSampleListener listener)
{
mListener = listener;
}
/**
* Sets the decimated output listener
*/
public void setListener( ComplexSampleListener listener )
{
mListener = listener;
}
}