#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 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); long frequency = baseFrequency + (x * CHANNEL_BANDWIDTH);

View File

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

View File

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

View File

@@ -152,17 +152,26 @@ public class ScheduledBufferProcessor<E> implements Listener<E>
@Override @Override
public void run() public void run()
{ {
mQueue.drainTo(mBuffers, mMaxBuffersPerInterval); try
if(mListener != null)
{ {
for(E buffer: mBuffers) mQueue.drainTo(mBuffers, mMaxBuffersPerInterval);
{
mListener.receive(buffer);
}
}
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);
}
} }
} }
} }