mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
IQ recording file playback partial checkin.
NOTE: only the gui components and settings handling have been implemented. Actual recording playback is not yet implemented. Partial checkin of initial P25 decoder development. NOTE: P25 decoder is not yet functional.
This commit is contained in:
108
src/source/recording/Recording.java
Normal file
108
src/source/recording/Recording.java
Normal file
@@ -0,0 +1,108 @@
|
||||
package source.recording;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import source.SourceException;
|
||||
import source.tuner.FrequencyChangeListener;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelProvider;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import controller.ResourceManager;
|
||||
import controller.ThreadPoolManager;
|
||||
|
||||
public class Recording implements Comparable<Recording>,
|
||||
FrequencyChangeListener,
|
||||
TunerChannelProvider
|
||||
{
|
||||
private ResourceManager mResourceManager;
|
||||
private RecordingConfiguration mConfiguration;
|
||||
|
||||
private ArrayList<TunerChannelSource> mTunerChannels =
|
||||
new ArrayList<TunerChannelSource>();
|
||||
|
||||
private long mCenterFrequency;
|
||||
|
||||
public Recording( ResourceManager resourceManager,
|
||||
RecordingConfiguration configuration )
|
||||
{
|
||||
mResourceManager = resourceManager;
|
||||
mConfiguration = configuration;
|
||||
mCenterFrequency = mConfiguration.getCenterFrequency();
|
||||
}
|
||||
|
||||
public void setAlias( String alias )
|
||||
{
|
||||
mConfiguration.setAlias( alias );
|
||||
mResourceManager.getSettingsManager().save();
|
||||
}
|
||||
|
||||
public void setRecordingFile( File file ) throws SourceException
|
||||
{
|
||||
if( hasChannels() )
|
||||
{
|
||||
throw new SourceException( "Recording source - can't change "
|
||||
+ "recording file while channels are enabled against the "
|
||||
+ "current recording." );
|
||||
}
|
||||
|
||||
mConfiguration.setFilePath( file.getAbsolutePath() );
|
||||
mResourceManager.getSettingsManager().save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this recording is currently playing/providing samples to
|
||||
* tuner channel sources
|
||||
*/
|
||||
public boolean hasChannels()
|
||||
{
|
||||
return mTunerChannels.size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
||||
TunerChannel channel ) throws RejectedExecutionException,
|
||||
SourceException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseChannel( TunerChannelSource source )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public RecordingConfiguration getRecordingConfiguration()
|
||||
{
|
||||
return mConfiguration;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return mConfiguration.getAlias();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void frequencyChanged( long frequency, int bandwidth )
|
||||
{
|
||||
mConfiguration.setCenterFrequency( frequency );
|
||||
mResourceManager.getSettingsManager().save();
|
||||
|
||||
mCenterFrequency = frequency;
|
||||
|
||||
for( TunerChannelSource channel: mTunerChannels )
|
||||
{
|
||||
channel.frequencyChanged( frequency, bandwidth );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( Recording other )
|
||||
{
|
||||
return getRecordingConfiguration().getAlias()
|
||||
.compareTo( other.getRecordingConfiguration().getAlias() );
|
||||
}
|
||||
}
|
||||
87
src/source/recording/RecordingConfiguration.java
Normal file
87
src/source/recording/RecordingConfiguration.java
Normal file
@@ -0,0 +1,87 @@
|
||||
package source.recording;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
public class RecordingConfiguration
|
||||
{
|
||||
private File mRecording;
|
||||
private String mFilePath;
|
||||
private String mAlias;
|
||||
private long mCenterFrequency;
|
||||
|
||||
public RecordingConfiguration()
|
||||
{
|
||||
mAlias = "New Recording";
|
||||
}
|
||||
|
||||
public RecordingConfiguration( String filePath,
|
||||
String alias,
|
||||
long centerFrequency )
|
||||
{
|
||||
mFilePath = filePath;
|
||||
mAlias = alias;
|
||||
mCenterFrequency = centerFrequency;
|
||||
|
||||
updateFile();
|
||||
}
|
||||
|
||||
private void updateFile()
|
||||
{
|
||||
if( mFilePath != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
mRecording = new File( mFilePath );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
throw new IllegalArgumentException( "There was an error while "
|
||||
+ "accessing the recording source [" + mFilePath + "]", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public File getRecording()
|
||||
{
|
||||
return mRecording;
|
||||
}
|
||||
|
||||
@XmlAttribute( name = "file_path" )
|
||||
public String getFilePath()
|
||||
{
|
||||
return mFilePath;
|
||||
}
|
||||
|
||||
public void setFilePath( String filePath )
|
||||
{
|
||||
mFilePath = filePath;
|
||||
|
||||
updateFile();
|
||||
}
|
||||
|
||||
@XmlAttribute( name = "alias" )
|
||||
public String getAlias()
|
||||
{
|
||||
return mAlias;
|
||||
}
|
||||
|
||||
public void setAlias( String alias )
|
||||
{
|
||||
mAlias = alias;
|
||||
}
|
||||
|
||||
@XmlAttribute( name = "center_frequency" )
|
||||
public long getCenterFrequency()
|
||||
{
|
||||
return mCenterFrequency;
|
||||
}
|
||||
|
||||
public void setCenterFrequency( long frequency )
|
||||
{
|
||||
mCenterFrequency = frequency;
|
||||
}
|
||||
}
|
||||
120
src/source/recording/RecordingEditor.java
Normal file
120
src/source/recording/RecordingEditor.java
Normal file
@@ -0,0 +1,120 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 source.recording;
|
||||
|
||||
import gui.control.JFrequencyControl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import source.SourceEditor;
|
||||
import source.config.SourceConfigRecording;
|
||||
import source.config.SourceConfigTuner;
|
||||
import source.config.SourceConfiguration;
|
||||
import controller.ResourceManager;
|
||||
|
||||
public class RecordingEditor extends SourceEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JComboBox<Recording> mComboRecordings;
|
||||
private JFrequencyControl mFrequencyControl;
|
||||
|
||||
public RecordingEditor( ResourceManager resourceManager,
|
||||
SourceConfiguration config )
|
||||
{
|
||||
super( resourceManager, config );
|
||||
|
||||
initGUI();
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
mFrequencyControl.setFrequency(
|
||||
((SourceConfigTuner)mConfig).getFrequency(), false );
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
SourceConfigRecording config = (SourceConfigRecording)mConfig;
|
||||
|
||||
Recording selected = (Recording)mComboRecordings.getSelectedItem();
|
||||
|
||||
if( selected != null )
|
||||
{
|
||||
config.setRecordingAlias( selected
|
||||
.getRecordingConfiguration().getAlias() );
|
||||
}
|
||||
|
||||
config.setFrequency( mFrequencyControl.getFrequency() );
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
add( new JLabel( "Recording" ) );
|
||||
|
||||
mComboRecordings = new JComboBox<Recording>();
|
||||
|
||||
add( mComboRecordings, "wrap" );
|
||||
|
||||
mFrequencyControl = new JFrequencyControl();
|
||||
|
||||
mFrequencyControl.setFrequency(
|
||||
((SourceConfigRecording)mConfig).getFrequency(), false );
|
||||
|
||||
add( mFrequencyControl, "span" );
|
||||
|
||||
resetRecordings();
|
||||
}
|
||||
|
||||
private void resetRecordings()
|
||||
{
|
||||
SwingUtilities.invokeLater( new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
List<Recording> recordings = getResourceManager()
|
||||
.getRecordingSourceManager().getRecordings();
|
||||
|
||||
mComboRecordings.setModel(
|
||||
new DefaultComboBoxModel<Recording>(
|
||||
recordings.toArray( new Recording[ recordings.size()] ) ) );
|
||||
|
||||
SourceConfigRecording config = (SourceConfigRecording)mConfig;
|
||||
|
||||
String recordingAlias = config.getRecordingAlias();
|
||||
|
||||
if( recordingAlias != null )
|
||||
{
|
||||
Recording selected = mResourceManager
|
||||
.getRecordingSourceManager()
|
||||
.getRecordingFromAlias( recordingAlias );
|
||||
|
||||
if( selected != null )
|
||||
{
|
||||
mComboRecordings.setSelectedItem( selected );
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
131
src/source/recording/RecordingEditorPanel.java
Normal file
131
src/source/recording/RecordingEditorPanel.java
Normal file
@@ -0,0 +1,131 @@
|
||||
package source.recording;
|
||||
|
||||
import gui.control.JFrequencyControl;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import source.tuner.FrequencyChangeListener;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
public class RecordingEditorPanel extends JPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private RecordingNode mRecordingNode;
|
||||
|
||||
private JTextField mRecordingAlias;
|
||||
private JLabel mFilePathLabel;
|
||||
|
||||
public RecordingEditorPanel( RecordingNode recordingNode )
|
||||
{
|
||||
mRecordingNode = recordingNode;
|
||||
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][][][][grow]" ) );
|
||||
|
||||
add( new JLabel( "I/Q Recording" ), "span,align left" );
|
||||
|
||||
add( new JLabel( "Alias:" ) );
|
||||
|
||||
mRecordingAlias = new JTextField( mRecordingNode.getRecording()
|
||||
.getRecordingConfiguration().getAlias() );
|
||||
|
||||
mRecordingAlias.addFocusListener( new FocusListener()
|
||||
{
|
||||
@Override
|
||||
public void focusLost( FocusEvent arg0 )
|
||||
{
|
||||
String alias = mRecordingAlias.getText();
|
||||
|
||||
if( alias != null )
|
||||
{
|
||||
mRecordingNode.getRecording().setAlias( alias );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained( FocusEvent arg0 ) {}
|
||||
} );
|
||||
|
||||
add( mRecordingAlias, "wrap" );
|
||||
|
||||
JButton mFileSelectionButton = new JButton( "File ..." );
|
||||
mFileSelectionButton.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent arg0 )
|
||||
{
|
||||
if( mRecordingNode.getRecording().hasChannels() )
|
||||
{
|
||||
JOptionPane.showMessageDialog( RecordingEditorPanel.this,
|
||||
"This recording is currently in replay. Please "
|
||||
+ "disable any channels that are using this "
|
||||
+ "recording before changing the recording file." );
|
||||
}
|
||||
else
|
||||
{
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
|
||||
int returnVal = fc.showOpenDialog( RecordingEditorPanel.this );
|
||||
|
||||
if ( returnVal == JFileChooser.APPROVE_OPTION )
|
||||
{
|
||||
File file = fc.getSelectedFile();
|
||||
|
||||
if( file != null && file.exists() )
|
||||
{
|
||||
mRecordingNode.getRecording()
|
||||
.getRecordingConfiguration()
|
||||
.setFilePath( file.getAbsolutePath() );
|
||||
|
||||
if( mFilePathLabel != null )
|
||||
{
|
||||
mFilePathLabel.setText( file.getName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
add( mFileSelectionButton );
|
||||
|
||||
String filePath = mRecordingNode.getRecording()
|
||||
.getRecordingConfiguration().getFilePath();
|
||||
|
||||
if( filePath != null )
|
||||
{
|
||||
mFilePathLabel = new JLabel( filePath );
|
||||
}
|
||||
else
|
||||
{
|
||||
mFilePathLabel = new JLabel( "Please select a recording" );
|
||||
}
|
||||
|
||||
add( mFilePathLabel, "wrap" );
|
||||
|
||||
add( new JLabel( "Center Frequency:" ), "span,align left" );
|
||||
|
||||
JFrequencyControl frequencyControl = new JFrequencyControl(
|
||||
mRecordingNode.getRecording().getRecordingConfiguration()
|
||||
.getCenterFrequency() );
|
||||
|
||||
frequencyControl.addListener( mRecordingNode.getRecording() );
|
||||
|
||||
add( frequencyControl, "span,align left" );
|
||||
}
|
||||
}
|
||||
91
src/source/recording/RecordingGroupNode.java
Normal file
91
src/source/recording/RecordingGroupNode.java
Normal file
@@ -0,0 +1,91 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 source.recording;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import controller.BaseNode;
|
||||
|
||||
public class RecordingGroupNode extends BaseNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RecordingGroupNode()
|
||||
{
|
||||
super( null );
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Recordings [" + this.getChildCount() + "]";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
|
||||
JMenuItem addRecordingItem = new JMenuItem( "Add Recording" );
|
||||
|
||||
addRecordingItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
RecordingConfiguration config = new RecordingConfiguration();
|
||||
|
||||
getModel().getResourceManager().getSettingsManager()
|
||||
.addRecordingConfiguration( config );
|
||||
|
||||
Recording recording = getModel().getResourceManager()
|
||||
.getRecordingSourceManager().addRecording( config );
|
||||
|
||||
RecordingNode node = new RecordingNode( recording );
|
||||
|
||||
getModel().addNode( node, RecordingGroupNode.this, 0 );
|
||||
|
||||
sort();
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
menu.add( addRecordingItem );
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
public void loadRecordings()
|
||||
{
|
||||
List<Recording> recordings = getModel().getResourceManager()
|
||||
.getRecordingSourceManager().getRecordings();
|
||||
|
||||
for( Recording recording: recordings )
|
||||
{
|
||||
RecordingNode node = new RecordingNode( recording );
|
||||
|
||||
getModel().addNode( node, this, 0 );
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
}
|
||||
79
src/source/recording/RecordingNode.java
Normal file
79
src/source/recording/RecordingNode.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package source.recording;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import controller.BaseNode;
|
||||
|
||||
public class RecordingNode extends BaseNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JPanel mEditor;
|
||||
|
||||
public RecordingNode( Recording recording )
|
||||
{
|
||||
super( recording );
|
||||
}
|
||||
|
||||
public Recording getRecording()
|
||||
{
|
||||
return (Recording)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getRecording().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
if( mEditor == null )
|
||||
{
|
||||
mEditor = new RecordingEditorPanel( this );
|
||||
}
|
||||
|
||||
return mEditor;
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
if( getRecording().hasChannels() )
|
||||
{
|
||||
JOptionPane.showMessageDialog( getModel().getTree(),
|
||||
"Can't delete recording - currently in use. Please"
|
||||
+ " disable any channel(s) that are using this "
|
||||
+ "recording before deleting it",
|
||||
"Can't delete recording",
|
||||
JOptionPane.ERROR_MESSAGE );
|
||||
}
|
||||
else
|
||||
{
|
||||
getModel().getResourceManager().getRecordingSourceManager()
|
||||
.removeRecording( getRecording() );
|
||||
|
||||
getModel().removeNodeFromParent( RecordingNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
menu.add( deleteItem );
|
||||
|
||||
return menu;
|
||||
}
|
||||
}
|
||||
152
src/source/recording/RecordingSourceManager.java
Normal file
152
src/source/recording/RecordingSourceManager.java
Normal file
@@ -0,0 +1,152 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 source.recording;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import log.Log;
|
||||
import settings.SettingsManager;
|
||||
import source.Source;
|
||||
import source.SourceException;
|
||||
import source.config.SourceConfigRecording;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import controller.ResourceManager;
|
||||
import controller.channel.ProcessingChain;
|
||||
|
||||
public class RecordingSourceManager
|
||||
{
|
||||
private ResourceManager mResourceManager;
|
||||
|
||||
private ArrayList<Recording> mRecordings = new ArrayList<Recording>();
|
||||
|
||||
public RecordingSourceManager( ResourceManager resourceManager )
|
||||
{
|
||||
mResourceManager = resourceManager;
|
||||
|
||||
loadRecordings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates current recordings to get a tuner channel source for the frequency
|
||||
* specified in the channel config's source config object
|
||||
*/
|
||||
public Source getSource( ProcessingChain processingChain )
|
||||
throws SourceException
|
||||
{
|
||||
TunerChannelSource retVal = null;
|
||||
|
||||
if( processingChain.getChannel().getSourceConfiguration()
|
||||
instanceof SourceConfigRecording )
|
||||
{
|
||||
TunerChannel tunerChannel =
|
||||
processingChain.getChannel().getTunerChannel();
|
||||
|
||||
SourceConfigRecording config = (SourceConfigRecording)processingChain
|
||||
.getChannel().getSourceConfiguration();
|
||||
|
||||
Recording recording = getRecordingFromAlias( config.getRecordingAlias() );
|
||||
|
||||
if( recording != null )
|
||||
{
|
||||
retVal = recording.getChannel(
|
||||
mResourceManager.getThreadPoolManager(),
|
||||
tunerChannel );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new SourceException( "Recording with alias name [" +
|
||||
config.getRecordingAlias() + "] is not currently available" );
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public Recording getRecordingFromAlias( String alias )
|
||||
{
|
||||
for( Recording recording: mRecordings )
|
||||
{
|
||||
if( recording.getRecordingConfiguration()
|
||||
.getAlias().contentEquals( alias ) )
|
||||
{
|
||||
return recording;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of loaded IQ files
|
||||
*/
|
||||
public List<Recording> getRecordings()
|
||||
{
|
||||
Collections.sort( mRecordings );
|
||||
|
||||
return mRecordings;
|
||||
}
|
||||
|
||||
public void addRecording( Recording recording )
|
||||
{
|
||||
mRecordings.add( recording );
|
||||
}
|
||||
|
||||
public Recording addRecording( RecordingConfiguration config )
|
||||
{
|
||||
Recording recording = new Recording( mResourceManager, config );
|
||||
|
||||
mRecordings.add( recording );
|
||||
|
||||
return recording;
|
||||
}
|
||||
|
||||
public void removeRecording( Recording recording )
|
||||
{
|
||||
/* Remove the config from the settings manager */
|
||||
mResourceManager.getSettingsManager().removeRecordingConfiguration(
|
||||
recording.getRecordingConfiguration() );
|
||||
|
||||
mRecordings.remove( recording );
|
||||
}
|
||||
|
||||
private void loadRecordings()
|
||||
{
|
||||
if( mResourceManager != null )
|
||||
{
|
||||
SettingsManager settingsManager = mResourceManager.getSettingsManager();
|
||||
|
||||
if( settingsManager != null )
|
||||
{
|
||||
ArrayList<RecordingConfiguration> recordingConfigurations =
|
||||
settingsManager.getRecordingConfigurations();
|
||||
|
||||
Log.info( "RecordingSourceManager - discovered [" + recordingConfigurations.size() + "] recording configurations" );
|
||||
|
||||
for( RecordingConfiguration config: recordingConfigurations )
|
||||
{
|
||||
Recording recording = new Recording( mResourceManager, config );
|
||||
|
||||
mRecordings.add( recording );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user