mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
wip #34: refactored tuners to take a tuner controller as an argument.
Removed frequency change listener framework from tuner so that the tuner controller handles all frequency change interaction. Updated tuner view to allow selecting tuners for main spectral display and/or launching a new spectral display by clicking in the tuner table cell.
This commit is contained in:
@@ -180,8 +180,8 @@ public class JFrequencyControl extends JPanel implements IFrequencyChangeProcess
|
||||
|
||||
Iterator<IFrequencyChangeProcessor> it = mProcessors.iterator();
|
||||
|
||||
FrequencyChangeEvent event =
|
||||
new FrequencyChangeEvent( Event.NOTIFICATION_FREQUENCY_CHANGE, mFrequency );
|
||||
FrequencyChangeEvent event = new FrequencyChangeEvent(
|
||||
Event.REQUEST_FREQUENCY_CHANGE, mFrequency );
|
||||
|
||||
while( it.hasNext() )
|
||||
{
|
||||
|
||||
@@ -46,11 +46,12 @@ public abstract class MixerTuner extends Tuner implements Listener<ComplexBuffer
|
||||
* to support tuning.
|
||||
*/
|
||||
public MixerTuner( String name,
|
||||
TunerController tunerController,
|
||||
MixerTunerType mixerTunerType,
|
||||
TargetDataLine targetDataLine,
|
||||
ISampleAdapter sampleAdapter )
|
||||
{
|
||||
super( name );
|
||||
super( name, tunerController );
|
||||
|
||||
mMixerTunerType = mixerTunerType;
|
||||
|
||||
@@ -61,11 +62,13 @@ public abstract class MixerTuner extends Tuner implements Listener<ComplexBuffer
|
||||
(Listener<ComplexBuffer>)this );
|
||||
}
|
||||
|
||||
public MixerTuner( String name,
|
||||
public MixerTuner( String name,
|
||||
TunerController tunerController,
|
||||
MixerTunerDataLine mixerTuner,
|
||||
ISampleAdapter sampleAdapter )
|
||||
{
|
||||
this( name,
|
||||
tunerController,
|
||||
mixerTuner.getMixerTunerType(),
|
||||
mixerTuner.getTargetDataLine(),
|
||||
sampleAdapter );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -22,30 +22,25 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceException;
|
||||
import source.tuner.configuration.TunerConfiguration;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||
|
||||
/**
|
||||
* Tuner - provides tuner channel sources, representing a channel frequency
|
||||
*/
|
||||
public abstract class Tuner implements IFrequencyChangeProcessor,
|
||||
ITunerChannelProvider
|
||||
public abstract class Tuner implements ITunerChannelProvider
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( Tuner.class );
|
||||
|
||||
private String mName;
|
||||
|
||||
private TunerController mTunerController;
|
||||
/**
|
||||
* Sample Listeners - these will typically be the DFT processor for spectral
|
||||
* display, or it will be one or more tuner channel sources
|
||||
@@ -53,15 +48,40 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
||||
protected List<Listener<ComplexBuffer>> mSampleListeners =
|
||||
new CopyOnWriteArrayList<>();
|
||||
|
||||
protected List<IFrequencyChangeProcessor> mFrequencyChangeProcessors =
|
||||
new CopyOnWriteArrayList<>();
|
||||
|
||||
protected List<Listener<TunerEvent>> mTunerChangeListeners =
|
||||
new ArrayList<>();
|
||||
|
||||
public Tuner( String name )
|
||||
public Tuner( String name, TunerController tunerController )
|
||||
{
|
||||
mName = name;
|
||||
mTunerController = tunerController;
|
||||
|
||||
//Rebroadcast frequency and sample rate change events as tuner events
|
||||
mTunerController.addListener( new IFrequencyChangeProcessor()
|
||||
{
|
||||
@Override
|
||||
public void frequencyChanged( FrequencyChangeEvent event )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case NOTIFICATION_FREQUENCY_CHANGE:
|
||||
broadcast( new TunerEvent( Tuner.this,
|
||||
source.tuner.TunerEvent.Event.FREQUENCY ));
|
||||
break;
|
||||
case NOTIFICATION_SAMPLE_RATE_CHANGE:
|
||||
broadcast( new TunerEvent( Tuner.this,
|
||||
source.tuner.TunerEvent.Event.SAMPLE_RATE ));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public TunerController getTunerController()
|
||||
{
|
||||
return mTunerController;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
@@ -72,7 +92,6 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
||||
public void dispose()
|
||||
{
|
||||
mSampleListeners.clear();
|
||||
mFrequencyChangeProcessors.clear();
|
||||
}
|
||||
|
||||
public void setName( String name )
|
||||
@@ -189,32 +208,6 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the frequency change listener to receive frequency and/or bandwidth
|
||||
* change events
|
||||
*/
|
||||
public void addFrequencyChangeProcessor( IFrequencyChangeProcessor processor )
|
||||
{
|
||||
mFrequencyChangeProcessors.add( processor );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the frequency change listener
|
||||
*/
|
||||
public void removeFrequencyChangeProcessor( IFrequencyChangeProcessor processor )
|
||||
{
|
||||
mFrequencyChangeProcessors.remove( processor );
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a frequency change event to all registered listeners
|
||||
*/
|
||||
public void broadcastFrequencyChange( long frequency )
|
||||
{
|
||||
broadcastFrequencyChangeEvent(
|
||||
new FrequencyChangeEvent( Event.NOTIFICATION_FREQUENCY_CHANGE, frequency ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the listener
|
||||
*/
|
||||
@@ -241,51 +234,4 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
||||
listener.receive( event );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a sample rate change event to all registered listeners
|
||||
*/
|
||||
public void broadcastSampleRateChange( int sampleRate )
|
||||
{
|
||||
broadcastFrequencyChangeEvent(
|
||||
new FrequencyChangeEvent( Event.NOTIFICATION_SAMPLE_RATE_CHANGE, sampleRate ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts actual sample rate change event to all registered listeners
|
||||
*/
|
||||
public void broadcastActualSampleRateChange( int actualSampleRate )
|
||||
{
|
||||
broadcastFrequencyChangeEvent(
|
||||
new FrequencyChangeEvent( Event.NOTIFICATION_SAMPLE_RATE_CHANGE, actualSampleRate ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a frequency change event to all registered listeners
|
||||
*/
|
||||
public void broadcastFrequencyChangeEvent( FrequencyChangeEvent event )
|
||||
{
|
||||
for( IFrequencyChangeProcessor processor: mFrequencyChangeProcessors )
|
||||
{
|
||||
processor.frequencyChanged( event );
|
||||
}
|
||||
|
||||
if( event.getEvent() == Event.NOTIFICATION_FREQUENCY_CHANGE )
|
||||
{
|
||||
broadcast( new TunerEvent( this, TunerEvent.Event.FREQUENCY ) );
|
||||
}
|
||||
else if( event.getEvent() == Event.NOTIFICATION_SAMPLE_RATE_CHANGE )
|
||||
{
|
||||
broadcast( new TunerEvent( this, TunerEvent.Event.SAMPLE_RATE ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Frequency change listener method. We receive change events from the
|
||||
* controller and rebroadcast them to all registered listeners.
|
||||
*/
|
||||
public void frequencyChanged( FrequencyChangeEvent event )
|
||||
{
|
||||
broadcastFrequencyChangeEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class TunerChannelSource extends ComplexSource
|
||||
throws RejectedExecutionException, SourceException
|
||||
{
|
||||
mTuner = tuner;
|
||||
mTuner.addListener( this );
|
||||
mTuner.getTunerController().addListener( (IFrequencyChangeProcessor)this );
|
||||
|
||||
mTunerChannel = tunerChannel;
|
||||
|
||||
@@ -172,7 +172,7 @@ public class TunerChannelSource extends ComplexSource
|
||||
if( !mRunning.get() )
|
||||
{
|
||||
/* Tell the tuner to release/unregister our resources */
|
||||
mTuner.removeFrequencyChangeProcessor( this );
|
||||
mTuner.getTunerController().removeListener( this );
|
||||
mTuner = null;
|
||||
mTunerChannel = null;
|
||||
mBuffer = null;
|
||||
|
||||
@@ -26,12 +26,13 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import source.SourceException;
|
||||
import source.tuner.configuration.TunerConfiguration;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||
import source.tuner.frequency.FrequencyController;
|
||||
import source.tuner.frequency.FrequencyController.Tunable;
|
||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||
import controller.ThreadPoolManager;
|
||||
|
||||
public abstract class TunerController implements Tunable
|
||||
public abstract class TunerController implements Tunable, IFrequencyChangeProcessor
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( TunerController.class );
|
||||
@@ -73,8 +74,27 @@ public abstract class TunerController implements Tunable
|
||||
*/
|
||||
public abstract void apply( TunerConfiguration config )
|
||||
throws SourceException;
|
||||
|
||||
public int getBandwidth()
|
||||
|
||||
/**
|
||||
* Responds to requests to set the frequency
|
||||
*/
|
||||
@Override
|
||||
public void frequencyChanged( FrequencyChangeEvent event )
|
||||
{
|
||||
if( event.getEvent() == Event.REQUEST_FREQUENCY_CHANGE )
|
||||
{
|
||||
try
|
||||
{
|
||||
setFrequency( event.getValue().longValue() );
|
||||
}
|
||||
catch ( SourceException e )
|
||||
{
|
||||
mLog.error( "Error setting frequency from external controller", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getBandwidth()
|
||||
{
|
||||
return mFrequencyController.getBandwidth();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import source.SourceException;
|
||||
import source.tuner.configuration.TunerConfiguration;
|
||||
import source.tuner.configuration.TunerConfigurationModel;
|
||||
|
||||
@@ -33,7 +34,6 @@ public class TunerEditor extends Editor<Tuner>
|
||||
private TunerConfigurationModel mTunerConfigurationModel;
|
||||
private JTable mTunerConfigurationTable;
|
||||
private TableRowSorter<TunerConfigurationModel> mRowSorter;
|
||||
private ConfigurationRowFilter mRowFilter = new ConfigurationRowFilter();
|
||||
private JFrequencyControl mFrequencyControl = new JFrequencyControl();
|
||||
|
||||
public TunerEditor( TunerConfigurationModel tunerConfigurationModel )
|
||||
@@ -51,14 +51,8 @@ public class TunerEditor extends Editor<Tuner>
|
||||
"[grow,fill]", "[][][grow,fill][]" ) );
|
||||
listPanel.add( mFrequencyControl );
|
||||
|
||||
// mFrequencyControl.addListener( this );
|
||||
// /* Add frequency control as frequency change listener. */
|
||||
// mController.addListener( mFrequencyControl );
|
||||
// mFrequencyControl.setFrequency( mController.getFrequency(), false );
|
||||
|
||||
mTunerConfigurationTable = new JTable( mTunerConfigurationModel );
|
||||
mRowSorter = new TableRowSorter<>( mTunerConfigurationModel );
|
||||
mRowSorter.setRowFilter( mRowFilter );
|
||||
mTunerConfigurationTable.setRowSorter( mRowSorter );
|
||||
|
||||
listPanel.add( new JLabel( "Tuner Configurations" ) );
|
||||
@@ -95,16 +89,25 @@ public class TunerEditor extends Editor<Tuner>
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
//Unused
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem( Tuner tuner )
|
||||
{
|
||||
//Cleanup previously selected tuner
|
||||
if( hasItem() )
|
||||
{
|
||||
Tuner previous = getItem();
|
||||
previous.getTunerController().removeListener( mFrequencyControl );
|
||||
mFrequencyControl.removeListener( previous.getTunerController() );
|
||||
}
|
||||
|
||||
super.setItem( tuner );
|
||||
|
||||
if( hasItem() )
|
||||
{
|
||||
mRowFilter.setTunerType( tuner.getTunerType() );
|
||||
mRowSorter.setRowFilter( new ConfigurationRowFilter( tuner.getTunerType() ) );
|
||||
|
||||
TunerConfiguration assigned = mTunerConfigurationModel
|
||||
.getTunerConfiguration( tuner.getTunerType(), tuner.getUniqueID() );
|
||||
@@ -113,31 +116,43 @@ public class TunerEditor extends Editor<Tuner>
|
||||
|
||||
if( modelIndex >= 0 )
|
||||
{
|
||||
int viewIndex = mTunerConfigurationTable.convertRowIndexToView( modelIndex );
|
||||
int viewIndex = mTunerConfigurationTable
|
||||
.convertRowIndexToView( modelIndex );
|
||||
|
||||
if( viewIndex >= 0 )
|
||||
{
|
||||
mTunerConfigurationTable.setRowSelectionInterval( viewIndex, viewIndex );
|
||||
mTunerConfigurationTable
|
||||
.setRowSelectionInterval( viewIndex, viewIndex );
|
||||
}
|
||||
}
|
||||
|
||||
//Link frequency control to the tuner
|
||||
mFrequencyControl.addListener( tuner.getTunerController() );
|
||||
|
||||
//Link tuner to frequency control
|
||||
tuner.getTunerController().addListener( mFrequencyControl );
|
||||
|
||||
//Set the displayed frequency without adjusting the tuner's frequency
|
||||
try
|
||||
{
|
||||
mFrequencyControl.setFrequency( tuner.getFrequency(), false );
|
||||
}
|
||||
catch( SourceException e )
|
||||
{
|
||||
mLog.debug( "Couldn't get frequency from tuner: " + tuner.getUniqueID() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mRowFilter.setTunerType( null );
|
||||
mRowSorter.setRowFilter( null );
|
||||
}
|
||||
|
||||
mRowSorter.setRowFilter( mRowFilter );
|
||||
}
|
||||
|
||||
public class ConfigurationRowFilter extends RowFilter<TunerConfigurationModel,Integer>
|
||||
{
|
||||
private TunerType mTunerType;
|
||||
|
||||
public ConfigurationRowFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public void setTunerType( TunerType type )
|
||||
public ConfigurationRowFilter( TunerType type )
|
||||
{
|
||||
mTunerType = type;
|
||||
}
|
||||
@@ -146,22 +161,10 @@ public class TunerEditor extends Editor<Tuner>
|
||||
public boolean include( javax.swing.RowFilter.Entry<? extends TunerConfigurationModel,
|
||||
? extends Integer> entry )
|
||||
{
|
||||
if( mTunerType == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TunerConfigurationModel model = entry.getModel();
|
||||
TunerConfiguration config = model.getTunerConfiguration( entry.getIdentifier() );
|
||||
|
||||
if( config != null )
|
||||
{
|
||||
return config.getTunerType() == mTunerType;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
TunerConfiguration config = entry.getModel()
|
||||
.getTunerConfiguration( entry.getIdentifier() );
|
||||
|
||||
return config != null && config.getTunerType() == mTunerType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@ public class TunerEvent
|
||||
FREQUENCY,
|
||||
SAMPLE_RATE,
|
||||
REQUEST_MAIN_SPECTRAL_DISPLAY,
|
||||
REQUEST_SECONDARY_SPECTRAL_DISPLAY;
|
||||
REQUEST_NEW_SPECTRAL_DISPLAY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -25,16 +27,17 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
|
||||
|
||||
private final static Logger mLog = LoggerFactory.getLogger( TunerModel.class );
|
||||
|
||||
private static final int TUNER_CLASS = 0;
|
||||
private static final int TUNER_TYPE = 1;
|
||||
private static final int SAMPLE_RATE = 2;
|
||||
private static final int FREQUENCY = 3;
|
||||
private static final int CHANNEL_COUNT = 4;
|
||||
private static final int SPECTRAL_DISPLAY = 5;
|
||||
public static final int TUNER_CLASS = 0;
|
||||
public static final int TUNER_TYPE = 1;
|
||||
public static final int SAMPLE_RATE = 2;
|
||||
public static final int FREQUENCY = 3;
|
||||
public static final int CHANNEL_COUNT = 4;
|
||||
public static final int SPECTRAL_DISPLAY_MAIN = 5;
|
||||
public static final int SPECTRAL_DISPLAY_NEW = 6;
|
||||
|
||||
private static final String MHZ = " MHz";
|
||||
private static final String[] COLUMNS =
|
||||
{ "Class", "Type", "Sample Rate", "Frequency", "Channels", "Spectrum" };
|
||||
{ "Class", "Type", "Sample Rate", "Frequency", "Channels", "Spectral", "Display" };
|
||||
|
||||
private List<Tuner> mTuners = new ArrayList<>();
|
||||
private List<Listener<TunerEvent>> mTunerEventListeners = new ArrayList<>();
|
||||
@@ -183,7 +186,7 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
|
||||
fireTableCellUpdated( index, SAMPLE_RATE );
|
||||
break;
|
||||
case REQUEST_MAIN_SPECTRAL_DISPLAY:
|
||||
fireTableCellUpdated( index, SPECTRAL_DISPLAY );
|
||||
fireTableCellUpdated( index, SPECTRAL_DISPLAY_MAIN );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -202,7 +205,7 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
|
||||
@Override
|
||||
public int getColumnCount()
|
||||
{
|
||||
return 6;
|
||||
return COLUMNS.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,8 +238,10 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
|
||||
}
|
||||
case CHANNEL_COUNT:
|
||||
return tuner.getChannelCount();
|
||||
case SPECTRAL_DISPLAY:
|
||||
return "TBD";
|
||||
case SPECTRAL_DISPLAY_MAIN:
|
||||
return "Main";
|
||||
case SPECTRAL_DISPLAY_NEW:
|
||||
return "New";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TunerSpectralDisplayManager implements Listener<TunerEvent>
|
||||
case REQUEST_MAIN_SPECTRAL_DISPLAY:
|
||||
mSpectralDisplayPanel.showTuner( event.getTuner() );
|
||||
break;
|
||||
case REQUEST_SECONDARY_SPECTRAL_DISPLAY:
|
||||
case REQUEST_NEW_SPECTRAL_DISPLAY:
|
||||
final SpectrumFrame frame = new SpectrumFrame( mChannelModel,
|
||||
mChannelProcessingManager, mSettingsManager, event.getTuner() );
|
||||
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
package source.tuner;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import source.tuner.TunerEvent.Event;
|
||||
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
|
||||
public class TunerViewPanel extends JPanel
|
||||
@@ -23,7 +32,6 @@ public class TunerViewPanel extends JPanel
|
||||
|
||||
private TunerModel mTunerModel;
|
||||
private JTable mTunerTable;
|
||||
|
||||
private JideSplitPane mSplitPane;
|
||||
private TunerEditor mTunerEditor;
|
||||
|
||||
@@ -55,6 +63,46 @@ public class TunerViewPanel extends JPanel
|
||||
}
|
||||
}
|
||||
} );
|
||||
mTunerTable.addMouseListener( new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mouseClicked( MouseEvent e )
|
||||
{
|
||||
int column = mTunerTable.columnAtPoint( e.getPoint() );
|
||||
|
||||
if( column == TunerModel.SPECTRAL_DISPLAY_MAIN )
|
||||
{
|
||||
int tableRow = mTunerTable.rowAtPoint( e.getPoint() );
|
||||
int modelRow = mTunerTable.convertRowIndexToModel( tableRow );
|
||||
|
||||
Tuner tuner = mTunerModel.getTuner( modelRow );
|
||||
|
||||
if( tuner != null )
|
||||
{
|
||||
mTunerModel.broadcast( new TunerEvent( tuner,
|
||||
Event.REQUEST_MAIN_SPECTRAL_DISPLAY ) );
|
||||
}
|
||||
}
|
||||
else if( column == TunerModel.SPECTRAL_DISPLAY_NEW )
|
||||
{
|
||||
int tableRow = mTunerTable.rowAtPoint( e.getPoint() );
|
||||
int modelRow = mTunerTable.convertRowIndexToModel( tableRow );
|
||||
|
||||
Tuner tuner = mTunerModel.getTuner( modelRow );
|
||||
|
||||
if( tuner != null )
|
||||
{
|
||||
mTunerModel.broadcast( new TunerEvent( tuner,
|
||||
Event.REQUEST_NEW_SPECTRAL_DISPLAY ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
TableCellRenderer renderer = new LinkCellRenderer();
|
||||
|
||||
mTunerTable.getColumnModel().getColumn( 5 ).setCellRenderer( renderer );
|
||||
mTunerTable.getColumnModel().getColumn( 6 ).setCellRenderer( renderer );
|
||||
|
||||
JScrollPane listScroller = new JScrollPane( mTunerTable );
|
||||
listScroller.setPreferredSize( new Dimension( 400, 20 ) );
|
||||
@@ -70,5 +118,30 @@ public class TunerViewPanel extends JPanel
|
||||
add( mSplitPane );
|
||||
}
|
||||
|
||||
|
||||
public class LinkCellRenderer extends DefaultTableCellRenderer
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent( JTable table,
|
||||
Object value, boolean isSelected, boolean hasFocus, int row,
|
||||
int column )
|
||||
{
|
||||
JLabel label = (JLabel)super.getTableCellRendererComponent( table,
|
||||
value, isSelected, hasFocus, row, column );
|
||||
|
||||
label.setForeground( Color.BLUE.brighter() );
|
||||
|
||||
if( column == TunerModel.SPECTRAL_DISPLAY_MAIN )
|
||||
{
|
||||
label.setToolTipText( "Show this tuner in the main spectral display" );
|
||||
}
|
||||
else if( column == TunerModel.SPECTRAL_DISPLAY_NEW )
|
||||
{
|
||||
label.setToolTipText( "Show this tuner in a new spectral display" );
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,20 +19,17 @@ package source.tuner.airspy;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceException;
|
||||
import source.tuner.Tuner;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.TunerClass;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerType;
|
||||
import source.tuner.airspy.AirspyTunerController.BoardID;
|
||||
import source.tuner.configuration.TunerConfiguration;
|
||||
@@ -41,28 +38,20 @@ public class AirspyTuner extends Tuner
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( AirspyTuner.class );
|
||||
|
||||
AirspyTunerController mController;
|
||||
|
||||
public AirspyTuner( AirspyTunerController controller )
|
||||
{
|
||||
super( "Airspy" );
|
||||
|
||||
mController = controller;
|
||||
|
||||
/* Register for frequency/sample rate changes so that we can rebroadcast
|
||||
* to any registered listeners */
|
||||
mController.addListener( this );
|
||||
super( "Airspy", controller );
|
||||
}
|
||||
|
||||
public AirspyTunerController getController()
|
||||
{
|
||||
return mController;
|
||||
return (AirspyTunerController)getTunerController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply( TunerConfiguration config ) throws SourceException
|
||||
{
|
||||
mController.apply( config );
|
||||
getController().apply( config );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +59,7 @@ public class AirspyTuner extends Tuner
|
||||
{
|
||||
try
|
||||
{
|
||||
return mController.getDeviceInfo().getSerialNumber();
|
||||
return getController().getDeviceInfo().getSerialNumber();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -99,7 +88,7 @@ public class AirspyTuner extends Tuner
|
||||
|
||||
try
|
||||
{
|
||||
rate = mController.getCurrentSampleRate();
|
||||
rate = getController().getCurrentSampleRate();
|
||||
}
|
||||
catch ( SourceException e )
|
||||
{
|
||||
@@ -118,7 +107,7 @@ public class AirspyTuner extends Tuner
|
||||
@Override
|
||||
public long getFrequency() throws SourceException
|
||||
{
|
||||
return mController.getFrequency();
|
||||
return getController().getFrequency();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,7 +121,7 @@ public class AirspyTuner extends Tuner
|
||||
//Consider implementing a fractional resampler to get a correct 48 kHz
|
||||
//output sample rate
|
||||
|
||||
TunerChannelSource source = mController.getChannel( this, channel );
|
||||
TunerChannelSource source = getController().getChannel( this, channel );
|
||||
|
||||
if( source != null )
|
||||
{
|
||||
@@ -147,7 +136,7 @@ public class AirspyTuner extends Tuner
|
||||
@Override
|
||||
public int getChannelCount()
|
||||
{
|
||||
return mController.getChannelCount();
|
||||
return getController().getChannelCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,19 +148,19 @@ public class AirspyTuner extends Tuner
|
||||
/* Tell the controller to release the channel and cleanup */
|
||||
if( source != null )
|
||||
{
|
||||
mController.releaseChannel( source );
|
||||
getController().releaseChannel( source );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener( Listener<ComplexBuffer> listener )
|
||||
{
|
||||
mController.addListener( listener );
|
||||
getController().addListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener( Listener<ComplexBuffer> listener )
|
||||
{
|
||||
mController.removeListener( listener );
|
||||
getController().removeListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class AirspyTunerEditorPanel extends JPanel
|
||||
|
||||
/* Add frequency control as frequency change listener. This creates a
|
||||
* feedback loop, so the control does not rebroadcast the event */
|
||||
mTuner.addFrequencyChangeProcessor( mFrequencyControl );
|
||||
mTuner.getTunerController().addListener( mFrequencyControl );
|
||||
|
||||
mFrequencyControl.setFrequency( mController.getFrequency(), false );
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class B100Tuner extends Tuner
|
||||
//TODO: this should extend a USBTuner class, so that we can push the
|
||||
//complex sample listener and the frequency change listener up to that class
|
||||
|
||||
super( "Ettus B100 with WBX Tuner" );
|
||||
super( "Ettus B100 with WBX Tuner", null );
|
||||
|
||||
mDevice = device;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -19,71 +19,64 @@ package source.tuner.fcd;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import sample.Listener;
|
||||
import sample.adapter.ShortAdapter;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceException;
|
||||
import source.tuner.MixerTuner;
|
||||
import source.tuner.MixerTunerDataLine;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.TunerClass;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerType;
|
||||
import source.tuner.configuration.TunerConfiguration;
|
||||
|
||||
public class FCDTuner extends MixerTuner
|
||||
{
|
||||
private FCDTunerController mController;
|
||||
|
||||
public FCDTuner( MixerTunerDataLine mixerTDL,
|
||||
FCDTunerController controller )
|
||||
{
|
||||
super( controller.getConfiguration().toString(),
|
||||
super( controller.getConfiguration().toString(),
|
||||
controller,
|
||||
mixerTDL,
|
||||
new ShortAdapter() );
|
||||
|
||||
mController = controller;
|
||||
mController.addListener( this );
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
//TODO: release the mixer tuner data line as well
|
||||
|
||||
mController.dispose();
|
||||
getController().dispose();
|
||||
}
|
||||
|
||||
public FCDTunerController getController()
|
||||
{
|
||||
return mController;
|
||||
return (FCDTunerController)getTunerController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerClass getTunerClass()
|
||||
{
|
||||
return mController.getTunerClass();
|
||||
return getController().getTunerClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
return mController.getTunerType();
|
||||
return getController().getTunerType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueID()
|
||||
{
|
||||
return mController.getUSBAddress();
|
||||
return getController().getUSBAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply( TunerConfiguration config )throws SourceException
|
||||
{
|
||||
mController.apply( config );
|
||||
getController().apply( config );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,14 +94,14 @@ public class FCDTuner extends MixerTuner
|
||||
@Override
|
||||
public long getFrequency() throws SourceException
|
||||
{
|
||||
return mController.getFrequency();
|
||||
return getController().getFrequency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerChannelSource getChannel( TunerChannel tunerChannel )
|
||||
throws RejectedExecutionException, SourceException
|
||||
{
|
||||
TunerChannelSource source = mController.getChannel( this, tunerChannel );
|
||||
TunerChannelSource source = getController().getChannel( this, tunerChannel );
|
||||
|
||||
if( source != null )
|
||||
{
|
||||
@@ -121,7 +114,7 @@ public class FCDTuner extends MixerTuner
|
||||
@Override
|
||||
public int getChannelCount()
|
||||
{
|
||||
return mController.getChannelCount();
|
||||
return getController().getChannelCount();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,7 +131,7 @@ public class FCDTuner extends MixerTuner
|
||||
|
||||
/* Tell the controller to release the channel and cleanup */
|
||||
/* This will release the channel as a frequency change listener */
|
||||
mController.releaseChannel( source );
|
||||
getController().releaseChannel( source );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class FCD1TunerEditorPanel extends JPanel implements IFrequencyChangeProc
|
||||
/* Add frequency control as listener to tuner to get frequency changes
|
||||
* that are invoked elsewhere, to keep the control in sync with the
|
||||
* frequency */
|
||||
mTuner.addFrequencyChangeProcessor( mFrequencyControl );
|
||||
mTuner.getController().addListener( mFrequencyControl );
|
||||
|
||||
mFrequencyControl.setFrequency( mController.getFrequency(), false );
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class FCD2TunerEditorPanel extends JPanel implements IFrequencyChangeProc
|
||||
|
||||
/* Add frequency control as frequency change listener. This creates a
|
||||
* feedback loop, so the control does not rebroadcast the event */
|
||||
mTuner.addFrequencyChangeProcessor( mFrequencyControl );
|
||||
mTuner.getController().addListener( mFrequencyControl );
|
||||
|
||||
mFrequencyControl.setFrequency( mController.getFrequency(), false );
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ public class FrequencyChangeEvent
|
||||
NOTIFICATION_FREQUENCY_CORRECTION_CHANGE,
|
||||
NOTIFICATION_CHANNEL_FREQUENCY_CORRECTION_CHANGE,
|
||||
NOTIFICATION_SAMPLE_RATE_CHANGE,
|
||||
|
||||
|
||||
REQUEST_FREQUENCY_CHANGE,
|
||||
REQUEST_CHANNEL_FREQUENCY_CORRECTION_CHANGE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -19,20 +19,17 @@ package source.tuner.hackrf;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceException;
|
||||
import source.tuner.Tuner;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.TunerClass;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerType;
|
||||
import source.tuner.configuration.TunerConfiguration;
|
||||
import source.tuner.hackrf.HackRFTunerController.BoardID;
|
||||
@@ -41,16 +38,14 @@ public class HackRFTuner extends Tuner
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( HackRFTuner.class );
|
||||
|
||||
private HackRFTunerController mController;
|
||||
|
||||
public HackRFTuner( HackRFTunerController controller ) throws SourceException
|
||||
{
|
||||
super( "HackRF" );
|
||||
|
||||
mController = controller;
|
||||
|
||||
/* Register for frequency/sample rate changes */
|
||||
mController.addListener( this );
|
||||
super( "HackRF", controller );
|
||||
}
|
||||
|
||||
public HackRFTunerController getController()
|
||||
{
|
||||
return (HackRFTunerController)getTunerController();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -58,11 +53,6 @@ public class HackRFTuner extends Tuner
|
||||
//TODO: dispose of something here
|
||||
}
|
||||
|
||||
public HackRFTunerController getController()
|
||||
{
|
||||
return mController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerClass getTunerClass()
|
||||
{
|
||||
@@ -78,13 +68,13 @@ public class HackRFTuner extends Tuner
|
||||
@Override
|
||||
public void apply( TunerConfiguration config ) throws SourceException
|
||||
{
|
||||
mController.apply( config );
|
||||
getController().apply( config );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSampleRate()
|
||||
{
|
||||
return mController.getSampleRate();
|
||||
return getController().getSampleRate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,14 +86,14 @@ public class HackRFTuner extends Tuner
|
||||
@Override
|
||||
public long getFrequency() throws SourceException
|
||||
{
|
||||
return mController.getFrequency();
|
||||
return getController().getFrequency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerChannelSource getChannel( TunerChannel channel )
|
||||
throws RejectedExecutionException, SourceException
|
||||
{
|
||||
TunerChannelSource source = mController.getChannel( this, channel );
|
||||
TunerChannelSource source = getController().getChannel( this, channel );
|
||||
|
||||
if( source != null )
|
||||
{
|
||||
@@ -116,7 +106,7 @@ public class HackRFTuner extends Tuner
|
||||
@Override
|
||||
public int getChannelCount()
|
||||
{
|
||||
return mController.getChannelCount();
|
||||
return getController().getChannelCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,7 +118,7 @@ public class HackRFTuner extends Tuner
|
||||
/* Tell the controller to release the channel and cleanup */
|
||||
if( source != null )
|
||||
{
|
||||
mController.releaseChannel( source );
|
||||
getController().releaseChannel( source );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +127,7 @@ public class HackRFTuner extends Tuner
|
||||
{
|
||||
try
|
||||
{
|
||||
return mController.getSerial().getSerialNumber();
|
||||
return getController().getSerial().getSerialNumber();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -150,12 +140,12 @@ public class HackRFTuner extends Tuner
|
||||
@Override
|
||||
public void addListener( Listener<ComplexBuffer> listener )
|
||||
{
|
||||
mController.addListener( listener );
|
||||
getController().addListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener( Listener<ComplexBuffer> listener )
|
||||
{
|
||||
mController.removeListener( listener );
|
||||
getController().removeListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class HackRFTunerEditorPanel extends JPanel implements IFrequencyChangePr
|
||||
|
||||
/* Add frequency control as frequency change listener. This creates a
|
||||
* feedback loop, so the control does not rebroadcast the event */
|
||||
mTuner.addFrequencyChangeProcessor( mFrequencyControl );
|
||||
mTuner.getController().addListener( mFrequencyControl );
|
||||
|
||||
mFrequencyControl.setFrequency( mController.getFrequency(), false );
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -19,26 +19,21 @@ package source.tuner.rtl;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.usb4java.LibUsbException;
|
||||
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceException;
|
||||
import source.tuner.Tuner;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.TunerClass;
|
||||
import source.tuner.TunerEvent;
|
||||
import source.tuner.TunerType;
|
||||
import source.tuner.configuration.TunerConfiguration;
|
||||
import source.tuner.frequency.IFrequencyChangeListener;
|
||||
import source.tuner.rtl.RTL2832TunerController.SampleRate;
|
||||
import controller.ThreadPoolManager;
|
||||
|
||||
public class RTL2832Tuner extends Tuner
|
||||
{
|
||||
@@ -46,7 +41,6 @@ public class RTL2832Tuner extends Tuner
|
||||
LoggerFactory.getLogger( RTL2832Tuner.class );
|
||||
|
||||
private TunerClass mTunerClass;
|
||||
protected RTL2832TunerController mController;
|
||||
|
||||
public RTL2832Tuner( TunerClass tunerClass,
|
||||
RTL2832TunerController controller )
|
||||
@@ -54,11 +48,9 @@ public class RTL2832Tuner extends Tuner
|
||||
{
|
||||
super( tunerClass.getVendorDeviceLabel() + "/" +
|
||||
controller.getTunerType().getLabel() + " #" +
|
||||
controller.getUniqueID() );
|
||||
controller.getUniqueID(), controller );
|
||||
|
||||
mTunerClass = tunerClass;
|
||||
mController = controller;
|
||||
mController.addListener( this );
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -68,13 +60,13 @@ public class RTL2832Tuner extends Tuner
|
||||
|
||||
public RTL2832TunerController getController()
|
||||
{
|
||||
return mController;
|
||||
return (RTL2832TunerController)getTunerController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueID()
|
||||
{
|
||||
return mController.getUniqueID();
|
||||
return getController().getUniqueID();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,13 +78,13 @@ public class RTL2832Tuner extends Tuner
|
||||
@Override
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
return mController.getTunerType();
|
||||
return getController().getTunerType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply( TunerConfiguration config ) throws SourceException
|
||||
{
|
||||
mController.apply( config );
|
||||
getController().apply( config );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +92,7 @@ public class RTL2832Tuner extends Tuner
|
||||
{
|
||||
try
|
||||
{
|
||||
return mController.getCurrentSampleRate();
|
||||
return getController().getCurrentSampleRate();
|
||||
}
|
||||
catch( SourceException e )
|
||||
{
|
||||
@@ -114,7 +106,7 @@ public class RTL2832Tuner extends Tuner
|
||||
{
|
||||
try
|
||||
{
|
||||
mController.setSampleRate( sampleRate );
|
||||
getController().setSampleRate( sampleRate );
|
||||
}
|
||||
catch( LibUsbException e )
|
||||
{
|
||||
@@ -134,12 +126,12 @@ public class RTL2832Tuner extends Tuner
|
||||
@Override
|
||||
public long getFrequency() throws SourceException
|
||||
{
|
||||
return mController.getFrequency();
|
||||
return getController().getFrequency();
|
||||
}
|
||||
|
||||
public void setFrequency( int frequency ) throws SourceException
|
||||
{
|
||||
mController.setFrequency( frequency );
|
||||
getController().setFrequency( frequency );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,7 +143,7 @@ public class RTL2832Tuner extends Tuner
|
||||
|
||||
try
|
||||
{
|
||||
source = mController.getChannel( this, channel );
|
||||
source = getController().getChannel( this, channel );
|
||||
|
||||
if( source != null )
|
||||
{
|
||||
@@ -169,7 +161,7 @@ public class RTL2832Tuner extends Tuner
|
||||
@Override
|
||||
public int getChannelCount()
|
||||
{
|
||||
return mController.getChannelCount();
|
||||
return getController().getChannelCount();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,19 +177,19 @@ public class RTL2832Tuner extends Tuner
|
||||
/* Tell the controller to release the channel and cleanup */
|
||||
if( source != null )
|
||||
{
|
||||
mController.releaseChannel( source );
|
||||
getController().releaseChannel( source );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener( Listener<ComplexBuffer> listener )
|
||||
{
|
||||
mController.addListener( listener );
|
||||
getController().addListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener( Listener<ComplexBuffer> listener )
|
||||
{
|
||||
mController.removeListener( listener );
|
||||
getController().removeListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ public class SpectralDisplayPanel extends JPanel
|
||||
if( mTuner != null )
|
||||
{
|
||||
//Register to receive frequency change events
|
||||
mTuner.addFrequencyChangeProcessor( this );
|
||||
mTuner.getTunerController().addListener( this );
|
||||
|
||||
//Register the dft processor to receive samples from the tuner
|
||||
mTuner.addListener( (Listener<ComplexBuffer>)mDFTProcessor );
|
||||
@@ -471,7 +471,7 @@ public class SpectralDisplayPanel extends JPanel
|
||||
if( mTuner != null )
|
||||
{
|
||||
//Deregister for frequency change events from the tuner
|
||||
mTuner.removeFrequencyChangeProcessor( this );
|
||||
mTuner.getTunerController().removeListener( this );
|
||||
|
||||
//Deregister the dft processor from receiving samples
|
||||
mTuner.removeListener( (Listener<ComplexBuffer>)mDFTProcessor );
|
||||
|
||||
Reference in New Issue
Block a user