#39 WIP - changes for testing of the channelizer viewer.

This commit is contained in:
Denny
2018-01-14 08:40:34 -05:00
parent d4761be00a
commit a7a0c26b38
4 changed files with 51 additions and 30 deletions

View File

@@ -194,7 +194,7 @@ public class ChannelizerViewer extends JFrame
long baseFrequency = 100006250; //100.006250 MHz
for(int x = 0; x < mChannelCount; x++)
for(int x = 0; x < mChannelCount - 1; x++)
{
long frequency = baseFrequency + (x * CHANNEL_BANDWIDTH);

View File

@@ -40,7 +40,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
private int mBlockSize;
private FloatFFT_1D mFFT;
private PolyphaseChannelResultsBuffer mChannelResultsBuffer;
private int mChannelResultsBufferSize;
private int mChannelResultsBufferSize = 2500;
private SampleTimestampManager mTimestampManager;
/**
@@ -55,14 +55,11 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
* @param sampleRate of the incoming sample stream
* @param channelCount - number of filters/channels to output. Since this filter bank oversamples each filter
* output, this number must be even (divisible by the 2x oversample rate).
* @param bufferSize for the channel results buffers produced by this channelizer
*/
public ComplexPolyphaseChannelizerM2(float[] taps, int sampleRate, int channelCount, int bufferSize)
public ComplexPolyphaseChannelizerM2(float[] taps, int sampleRate, int channelCount)
{
super(sampleRate, channelCount);
mChannelResultsBufferSize = bufferSize;
if(channelCount % 2 != 0)
{
throw new IllegalArgumentException("Channel count must be an even multiple of the over-sample rate (2x)");
@@ -92,6 +89,9 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
float[] filterTaps = FilterFactory.getSincChannelizer(getChannelSampleRate(), getChannelCount(),
tapsPerFilter, WindowType.BLACKMAN_HARRIS_7, true);
double oversampledChannelSampleRate = getChannelSampleRate() * 2.0;
mTimestampManager = new SampleTimestampManager(oversampledChannelSampleRate);
init(filterTaps);
}

View File

@@ -470,33 +470,45 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
*/
public void receive(SourceEvent event)
{
mLog.debug("Got a source event: " + event.toString());
mQueuedSourceEvents.offer(event);
}
@Override
public void receive(ComplexBuffer complexBuffer)
{
//Process any queued source events before processing the buffer
SourceEvent queuedSourceEvent = mQueuedSourceEvents.poll();
while(queuedSourceEvent != null)
try
{
switch(queuedSourceEvent.getEvent())
//Process any queued source events before processing the buffer
SourceEvent queuedSourceEvent = mQueuedSourceEvents.poll();
while(queuedSourceEvent != null)
{
case NOTIFICATION_FREQUENCY_CHANGE:
updateOutputProcessors(queuedSourceEvent);
break;
case NOTIFICATION_SAMPLE_RATE_CHANGE:
updateChannelizerSampleRate(queuedSourceEvent.getValue().intValue());
break;
switch(queuedSourceEvent.getEvent())
{
case NOTIFICATION_FREQUENCY_CHANGE:
mLog.debug("******Frequency change event");
updateOutputProcessors(queuedSourceEvent);
break;
case NOTIFICATION_SAMPLE_RATE_CHANGE:
mLog.debug("******Sample Rate change event");
updateChannelizerSampleRate(queuedSourceEvent.getValue().intValue());
break;
}
mLog.debug("****** Source event processed ... continuing");
queuedSourceEvent = mQueuedSourceEvents.poll();
}
queuedSourceEvent = mQueuedSourceEvents.poll();
if(mPolyphaseChannelizer != null)
{
mPolyphaseChannelizer.receive(complexBuffer);
}
}
if(mPolyphaseChannelizer != null)
catch(Throwable throwable)
{
mPolyphaseChannelizer.receive(complexBuffer);
mLog.error("Error", throwable);
}
}
}

View File

@@ -152,17 +152,26 @@ public class ScheduledBufferProcessor<E> implements Listener<E>
@Override
public void run()
{
mQueue.drainTo(mBuffers, mMaxBuffersPerInterval);
if(mListener != null)
try
{
for(E buffer: mBuffers)
{
mListener.receive(buffer);
}
}
mQueue.drainTo(mBuffers, mMaxBuffersPerInterval);
mBuffers.clear();
mLog.debug("Dispatching buffers: " + mBuffers.size());
if(mListener != null)
{
for(E buffer: mBuffers)
{
mListener.receive(buffer);
}
}
mLog.debug("Finished Dispatching buffers");
mBuffers.clear();
}
catch(Throwable throwable)
{
mLog.error("Error while dispatching buffers to listeners", throwable);
}
}
}
}