mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
#39 WIP - changes for testing of the channelizer viewer.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user