mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 09:07:27 -05:00
Compare commits
14 Commits
v0.2.0-bet
...
v0.2.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc3390460a | ||
|
|
8db226cd7b | ||
|
|
b7a54598b1 | ||
|
|
dd22397f75 | ||
|
|
d8a20b5adb | ||
|
|
c670f1d855 | ||
|
|
1dc0125ef4 | ||
|
|
225e747d6e | ||
|
|
36f9953156 | ||
|
|
47c452e7e6 | ||
|
|
06c8bba97e | ||
|
|
a25bb83dea | ||
|
|
8e11cb4554 | ||
|
|
2892e4609e |
30
README.md
30
README.md
@@ -1,18 +1,22 @@
|
|||||||
# sdrtrunk
|
# sdrtrunk #
|
||||||
A cross-platform java application for decoding, monitoring, recording and streaming trunked mobile and related radio protocols using Software Defined Radios (SDR).
|
A cross-platform java application for decoding, monitoring and recording trunked
|
||||||
|
mobile and related radio protocols using Software Defined Radios (SDR).
|
||||||
|
|
||||||
|
# Documentation #
|
||||||
* [Getting Started](https://github.com/DSheirer/sdrtrunk/wiki/GettingStarted)
|
* [Getting Started](https://github.com/DSheirer/sdrtrunk/wiki/GettingStarted)
|
||||||
* [User's Manual](https://github.com/DSheirer/sdrtrunk/wiki/UserManual)
|
* [User's Manual (Version 0.2.0)](https://github.com/DSheirer/sdrtrunk/wiki/UserManual)
|
||||||
|
* [Wiki](https://github.com/DSheirer/sdrtrunk/wiki)
|
||||||
|
|
||||||
|
# Support Group and Error Reporting #
|
||||||
|
You can get help with setting up the sdrtrunk application or report any errors
|
||||||
|
that you encounter while running the application in the sdrtrunk Google Group at:
|
||||||
|
|
||||||
* [Support](https://groups.google.com/forum/#!forum/sdrtrunk)
|
* [Support](https://groups.google.com/forum/#!forum/sdrtrunk)
|
||||||
|
|
||||||
|
# Updates #
|
||||||
|
Subscribe to this group to receive updates about new releases and the ongoing
|
||||||
|
application development effort.
|
||||||
|
|
||||||
|
* [Subscribe for Updates](https://groups.google.com/forum/#!forum/sdrtrunk)
|
||||||
|
|
||||||

|

|
||||||
<script>
|
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
||||||
|
|
||||||
ga('create', 'UA-67489234-1', 'auto');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<property name="major" value="0"/>
|
<property name="major" value="0"/>
|
||||||
<property name="minor" value="2"/>
|
<property name="minor" value="2"/>
|
||||||
<property name="patch" value="0"/>
|
<property name="patch" value="0"/>
|
||||||
<property name="release" value="beta.4"/>
|
<property name="release" value="beta.6"/>
|
||||||
<property name="filename" value="sdrtrunk_${major}.${minor}.${patch}-${release}"/>
|
<property name="filename" value="sdrtrunk_${major}.${minor}.${patch}-${release}"/>
|
||||||
|
|
||||||
<!-- Build properties -->
|
<!-- Build properties -->
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import audio.inverted.AudioType;
|
|||||||
public class TalkgroupID extends AliasID
|
public class TalkgroupID extends AliasID
|
||||||
{
|
{
|
||||||
private String mTalkgroup;
|
private String mTalkgroup;
|
||||||
private AudioType mAudioType;
|
|
||||||
|
|
||||||
public TalkgroupID()
|
public TalkgroupID()
|
||||||
{
|
{
|
||||||
@@ -44,20 +43,9 @@ public class TalkgroupID extends AliasID
|
|||||||
mTalkgroup = talkgroup;
|
mTalkgroup = talkgroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public AudioType getAudioType()
|
|
||||||
{
|
|
||||||
return mAudioType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAudioType( AudioType type )
|
|
||||||
{
|
|
||||||
mAudioType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasAudioType()
|
public boolean hasAudioType()
|
||||||
{
|
{
|
||||||
return mAudioType != null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
@@ -66,13 +54,6 @@ public class TalkgroupID extends AliasID
|
|||||||
|
|
||||||
sb.append( "Talkgroup: " + mTalkgroup );
|
sb.append( "Talkgroup: " + mTalkgroup );
|
||||||
|
|
||||||
if( mAudioType != null )
|
|
||||||
{
|
|
||||||
sb.append( " [Audio " );
|
|
||||||
sb.append( mAudioType.getShortDisplayString() );
|
|
||||||
sb.append( "]" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,9 +20,7 @@ package alias.id.talkgroup;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import javax.swing.DefaultComboBoxModel;
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -30,7 +28,6 @@ import javax.swing.JTextArea;
|
|||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import audio.inverted.AudioType;
|
|
||||||
import controller.ConfigurableNode;
|
import controller.ConfigurableNode;
|
||||||
|
|
||||||
public class TalkgroupIDEditor extends JPanel implements ActionListener
|
public class TalkgroupIDEditor extends JPanel implements ActionListener
|
||||||
@@ -38,19 +35,15 @@ public class TalkgroupIDEditor extends JPanel implements ActionListener
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private TalkgroupIDNode mTalkgroupIDNode;
|
private TalkgroupIDNode mTalkgroupIDNode;
|
||||||
|
|
||||||
private JLabel mLabelName;
|
|
||||||
private JTextField mTextTalkgroupID;
|
private JTextField mTextTalkgroupID;
|
||||||
private JLabel mLabelAudio;
|
|
||||||
private JComboBox<AudioType> mComboAudioTypes;
|
|
||||||
|
|
||||||
private String mHelpText = "Enter a formatted talkgroup identifier.\n\n"
|
private String mHelpText = "Enter a formatted talkgroup identifier.\n\n"
|
||||||
|
+ "P25 Talkgroup Format: hexadecimal value, 4 characters for "
|
||||||
|
+ "talkgroup or 6 characters for a mobile radio\n\n"
|
||||||
+ "LTR Talkgroup Format: A-HH-TTT (A=Area, H=Home Repeater, "
|
+ "LTR Talkgroup Format: A-HH-TTT (A=Area, H=Home Repeater, "
|
||||||
+ "T=Talkgroup)\n\n"
|
+ "T=Talkgroup)\n\n"
|
||||||
+ "Passport Talkgroup Format: xxxxx (up to 5-digit number)\n\n"
|
+ "Passport Talkgroup Format: xxxxx (up to 5-digit number)\n\n"
|
||||||
+ "Wildcard: use one or more asterisks (*) for any talkgroup digits.\n\n"
|
+ "Wildcard: use one or more asterisks (*) for any talkgroup digits.";
|
||||||
+ "Audio: if the talkgroup uses simple frequency inversion, specify"
|
|
||||||
+ " the inversion frequency from the dropdown list to automatically"
|
|
||||||
+ " un-invert audio for this specific talkgroup";
|
|
||||||
|
|
||||||
public TalkgroupIDEditor( TalkgroupIDNode talkgroupIDNode )
|
public TalkgroupIDEditor( TalkgroupIDNode talkgroupIDNode )
|
||||||
{
|
{
|
||||||
@@ -72,22 +65,6 @@ public class TalkgroupIDEditor extends JPanel implements ActionListener
|
|||||||
|
|
||||||
add( mTextTalkgroupID, "growx,push" );
|
add( mTextTalkgroupID, "growx,push" );
|
||||||
|
|
||||||
add( new JLabel( "Audio:" ) );
|
|
||||||
|
|
||||||
mComboAudioTypes = new JComboBox<AudioType>();
|
|
||||||
|
|
||||||
mComboAudioTypes.setModel(
|
|
||||||
new DefaultComboBoxModel<AudioType>( AudioType.values() ) );
|
|
||||||
|
|
||||||
AudioType audioType = mTalkgroupIDNode.getTalkgroupID().getAudioType();
|
|
||||||
|
|
||||||
if( audioType != null )
|
|
||||||
{
|
|
||||||
mComboAudioTypes.setSelectedItem( audioType );
|
|
||||||
}
|
|
||||||
|
|
||||||
add( mComboAudioTypes, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
JButton btnSave = new JButton( "Save" );
|
||||||
btnSave.addActionListener( TalkgroupIDEditor.this );
|
btnSave.addActionListener( TalkgroupIDEditor.this );
|
||||||
add( btnSave, "growx,push" );
|
add( btnSave, "growx,push" );
|
||||||
@@ -117,14 +94,6 @@ public class TalkgroupIDEditor extends JPanel implements ActionListener
|
|||||||
|
|
||||||
((ConfigurableNode)mTalkgroupIDNode.getParent()).sort();
|
((ConfigurableNode)mTalkgroupIDNode.getParent()).sort();
|
||||||
|
|
||||||
AudioType selected = mComboAudioTypes
|
|
||||||
.getItemAt( mComboAudioTypes.getSelectedIndex() );
|
|
||||||
|
|
||||||
if( selected != null )
|
|
||||||
{
|
|
||||||
mTalkgroupIDNode.getTalkgroupID().setAudioType( selected );
|
|
||||||
}
|
|
||||||
|
|
||||||
mTalkgroupIDNode.save();
|
mTalkgroupIDNode.save();
|
||||||
|
|
||||||
mTalkgroupIDNode.show();
|
mTalkgroupIDNode.show();
|
||||||
@@ -139,9 +108,6 @@ public class TalkgroupIDEditor extends JPanel implements ActionListener
|
|||||||
{
|
{
|
||||||
mTextTalkgroupID.setText(
|
mTextTalkgroupID.setText(
|
||||||
mTalkgroupIDNode.getTalkgroupID().getTalkgroup() );
|
mTalkgroupIDNode.getTalkgroupID().getTalkgroup() );
|
||||||
|
|
||||||
mComboAudioTypes.setSelectedItem(
|
|
||||||
mTalkgroupIDNode.getTalkgroupID().getAudioType() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mTalkgroupIDNode.refresh();
|
mTalkgroupIDNode.refresh();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
{
|
{
|
||||||
private static final Logger mLog = LoggerFactory.getLogger( AudioManager.class );
|
private static final Logger mLog = LoggerFactory.getLogger( AudioManager.class );
|
||||||
|
|
||||||
public static final int AUDIO_TIMEOUT = 2000; //2 seconds
|
public static final int AUDIO_TIMEOUT = 1000; //1 second
|
||||||
|
|
||||||
public static final String AUDIO_CHANNELS_PROPERTY = "audio.manager.channels";
|
public static final String AUDIO_CHANNELS_PROPERTY = "audio.manager.channels";
|
||||||
public static final String AUDIO_MIXER_PROPERTY = "audio.manager.mixer";
|
public static final String AUDIO_MIXER_PROPERTY = "audio.manager.mixer";
|
||||||
@@ -182,7 +182,8 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
|
|
||||||
for( AudioOutputConnection connection: mAudioOutputConnections )
|
for( AudioOutputConnection connection: mAudioOutputConnections )
|
||||||
{
|
{
|
||||||
if( connection.isConnected() && connection.isInactive() )
|
if( connection.isInactive() &&
|
||||||
|
mChannelConnectionMap.containsKey( connection.getSource() ) )
|
||||||
{
|
{
|
||||||
mChannelConnectionMap.remove( connection.getSource() );
|
mChannelConnectionMap.remove( connection.getSource() );
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
@@ -424,13 +425,12 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audio output connection manages a connection between a soure and an audio
|
* Audio output connection manages a connection between a source and an audio
|
||||||
* output and maintains current state information about the audio activity
|
* output and maintains current state information about the audio activity
|
||||||
* received form the source.
|
* received form the source.
|
||||||
*/
|
*/
|
||||||
public class AudioOutputConnection implements Listener<AudioEvent>
|
public class AudioOutputConnection implements Listener<AudioEvent>
|
||||||
{
|
{
|
||||||
private static final long CALL_END_DELAY = 2000; //2 seconds
|
|
||||||
private static final int DISCONNECTED = -1;
|
private static final int DISCONNECTED = -1;
|
||||||
|
|
||||||
private AudioOutput mAudioOutput;
|
private AudioOutput mAudioOutput;
|
||||||
@@ -545,7 +545,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
public boolean isInactive()
|
public boolean isInactive()
|
||||||
{
|
{
|
||||||
return mLastActivity != Long.MAX_VALUE &&
|
return mLastActivity != Long.MAX_VALUE &&
|
||||||
mLastActivity + CALL_END_DELAY < System.currentTimeMillis();
|
mLastActivity + AUDIO_TIMEOUT < System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPriority()
|
public int getPriority()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package audio.output;
|
package audio.output;
|
||||||
|
|
||||||
import java.util.concurrent.LinkedTransferQueue;
|
import java.util.concurrent.LinkedTransferQueue;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import javax.sound.sampled.FloatControl;
|
import javax.sound.sampled.FloatControl;
|
||||||
|
import javax.sound.sampled.LineListener;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -11,18 +11,15 @@ import org.slf4j.LoggerFactory;
|
|||||||
import sample.Broadcaster;
|
import sample.Broadcaster;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import audio.AudioEvent;
|
import audio.AudioEvent;
|
||||||
import audio.AudioEvent.Type;
|
|
||||||
import audio.AudioPacket;
|
import audio.AudioPacket;
|
||||||
import audio.metadata.AudioMetadata;
|
import audio.metadata.AudioMetadata;
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
|
|
||||||
public abstract class AudioOutput implements Listener<AudioPacket>
|
public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( AudioOutput.class );
|
private final static Logger mLog = LoggerFactory.getLogger( AudioOutput.class );
|
||||||
|
|
||||||
private AtomicBoolean mSquelched = new AtomicBoolean( false );
|
|
||||||
private Listener<AudioMetadata> mAudioMetadataListener;
|
private Listener<AudioMetadata> mAudioMetadataListener;
|
||||||
|
|
||||||
protected Broadcaster<AudioEvent> mAudioEventBroadcaster = new Broadcaster<>();
|
protected Broadcaster<AudioEvent> mAudioEventBroadcaster = new Broadcaster<>();
|
||||||
protected LinkedTransferQueue<AudioPacket> mBuffer = new LinkedTransferQueue<>();
|
protected LinkedTransferQueue<AudioPacket> mBuffer = new LinkedTransferQueue<>();
|
||||||
protected ThreadPoolManager mThreadPoolManager;
|
protected ThreadPoolManager mThreadPoolManager;
|
||||||
@@ -74,19 +71,6 @@ public abstract class AudioOutput implements Listener<AudioPacket>
|
|||||||
mAudioEventBroadcaster.broadcast( audioEvent );
|
mAudioEventBroadcaster.broadcast( audioEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSquelched( boolean squelched )
|
|
||||||
{
|
|
||||||
mSquelched.set( squelched );
|
|
||||||
|
|
||||||
broadcast( new AudioEvent( squelched ? Type.AUDIO_SQUELCHED :
|
|
||||||
Type.AUDIO_UNSQUELCHED, getChannelName() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSquelched()
|
|
||||||
{
|
|
||||||
return mSquelched.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a single listener to receive audio start and audio stop events
|
* Registers a single listener to receive audio start and audio stop events
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import javax.sound.sampled.BooleanControl;
|
import javax.sound.sampled.BooleanControl;
|
||||||
import javax.sound.sampled.Control;
|
import javax.sound.sampled.Control;
|
||||||
import javax.sound.sampled.FloatControl;
|
import javax.sound.sampled.FloatControl;
|
||||||
|
import javax.sound.sampled.LineEvent;
|
||||||
import javax.sound.sampled.LineUnavailableException;
|
import javax.sound.sampled.LineUnavailableException;
|
||||||
import javax.sound.sampled.Mixer;
|
import javax.sound.sampled.Mixer;
|
||||||
import javax.sound.sampled.SourceDataLine;
|
import javax.sound.sampled.SourceDataLine;
|
||||||
@@ -50,11 +51,9 @@ public class MonoAudioOutput extends AudioOutput
|
|||||||
private SourceDataLine mOutput;
|
private SourceDataLine mOutput;
|
||||||
private FloatControl mGainControl;
|
private FloatControl mGainControl;
|
||||||
private BooleanControl mMuteControl;
|
private BooleanControl mMuteControl;
|
||||||
|
|
||||||
private AudioEvent mAudioStartEvent;
|
private AudioEvent mAudioStartEvent;
|
||||||
private AudioEvent mAudioStopEvent;
|
private AudioEvent mAudioStopEvent;
|
||||||
private AudioEvent mAudioContinuationEvent;
|
private AudioEvent mAudioContinuationEvent;
|
||||||
|
|
||||||
private ScheduledFuture<?> mProcessorTask;
|
private ScheduledFuture<?> mProcessorTask;
|
||||||
|
|
||||||
public MonoAudioOutput( ThreadPoolManager threadPoolManager, Mixer mixer )
|
public MonoAudioOutput( ThreadPoolManager threadPoolManager, Mixer mixer )
|
||||||
@@ -76,6 +75,7 @@ public class MonoAudioOutput extends AudioOutput
|
|||||||
if( mOutput != null )
|
if( mOutput != null )
|
||||||
{
|
{
|
||||||
mOutput.open( AudioFormats.PCM_SIGNED_48KHZ_16BITS_MONO, BUFFER_SIZE );
|
mOutput.open( AudioFormats.PCM_SIGNED_48KHZ_16BITS_MONO, BUFFER_SIZE );
|
||||||
|
mOutput.addLineListener( this );
|
||||||
mCanProcessAudio = true;
|
mCanProcessAudio = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,17 +162,13 @@ public class MonoAudioOutput extends AudioOutput
|
|||||||
|
|
||||||
if( packets.size() > 0 )
|
if( packets.size() > 0 )
|
||||||
{
|
{
|
||||||
broadcast( mAudioContinuationEvent );
|
|
||||||
|
|
||||||
for( AudioPacket packet: packets )
|
for( AudioPacket packet: packets )
|
||||||
{
|
{
|
||||||
|
broadcast( mAudioContinuationEvent );
|
||||||
|
|
||||||
if( mCanProcessAudio )
|
if( mCanProcessAudio )
|
||||||
{
|
{
|
||||||
if( isSquelched() )
|
if( packet.getType() == Type.AUDIO )
|
||||||
{
|
|
||||||
checkStop();
|
|
||||||
}
|
|
||||||
else if( packet.getType() == Type.AUDIO )
|
|
||||||
{
|
{
|
||||||
float[] samples = packet.getAudioBuffer().getSamples();
|
float[] samples = packet.getAudioBuffer().getSamples();
|
||||||
|
|
||||||
@@ -216,24 +212,20 @@ public class MonoAudioOutput extends AudioOutput
|
|||||||
|
|
||||||
private void checkStart()
|
private void checkStart()
|
||||||
{
|
{
|
||||||
if( mCanProcessAudio && !isSquelched() &&
|
if( mCanProcessAudio &&
|
||||||
!mOutput.isRunning() && mOutput.available() <= START_THRESHOLD )
|
!mOutput.isRunning() && mOutput.available() <= START_THRESHOLD )
|
||||||
{
|
{
|
||||||
mOutput.start();
|
mOutput.start();
|
||||||
|
|
||||||
mAudioEventBroadcaster.broadcast( mAudioStartEvent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkStop()
|
private void checkStop()
|
||||||
{
|
{
|
||||||
if( mCanProcessAudio && mOutput.isRunning() &&
|
if( mCanProcessAudio && mOutput.isRunning() &&
|
||||||
( mOutput.available() >= STOP_THRESHOLD || isSquelched() ) )
|
mOutput.available() >= STOP_THRESHOLD )
|
||||||
{
|
{
|
||||||
mOutput.drain();
|
mOutput.drain();
|
||||||
mOutput.stop();
|
mOutput.stop();
|
||||||
|
|
||||||
mAudioEventBroadcaster.broadcast( mAudioStopEvent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,4 +264,19 @@ public class MonoAudioOutput extends AudioOutput
|
|||||||
{
|
{
|
||||||
return mGainControl != null;
|
return mGainControl != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update( LineEvent event )
|
||||||
|
{
|
||||||
|
LineEvent.Type type = event.getType();
|
||||||
|
|
||||||
|
if( type == LineEvent.Type.START )
|
||||||
|
{
|
||||||
|
mAudioEventBroadcaster.broadcast( mAudioStartEvent );
|
||||||
|
}
|
||||||
|
else if( type == LineEvent.Type.STOP )
|
||||||
|
{
|
||||||
|
mAudioEventBroadcaster.broadcast( mAudioStopEvent );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import javax.sound.sampled.BooleanControl;
|
import javax.sound.sampled.BooleanControl;
|
||||||
import javax.sound.sampled.Control;
|
import javax.sound.sampled.Control;
|
||||||
import javax.sound.sampled.FloatControl;
|
import javax.sound.sampled.FloatControl;
|
||||||
|
import javax.sound.sampled.LineEvent;
|
||||||
import javax.sound.sampled.LineUnavailableException;
|
import javax.sound.sampled.LineUnavailableException;
|
||||||
import javax.sound.sampled.Mixer;
|
import javax.sound.sampled.Mixer;
|
||||||
import javax.sound.sampled.SourceDataLine;
|
import javax.sound.sampled.SourceDataLine;
|
||||||
@@ -40,9 +41,9 @@ public class StereoAudioOutput extends AudioOutput
|
|||||||
private final static int BUFFER_SIZE = 96000;
|
private final static int BUFFER_SIZE = 96000;
|
||||||
|
|
||||||
/* The queue processor will run every 20 milliseconds checking for inbound
|
/* The queue processor will run every 20 milliseconds checking for inbound
|
||||||
* audio and automatically starting or stopping audio playback. We set the
|
* audio and automatically start or stop audio playback. We set the
|
||||||
* data line available space threshold to start when we're 20 ms away from
|
* data line available space threshold to start when we're 20 ms away from
|
||||||
* being full, and the stop threshold when 20 ms away from being empty */
|
* being full and the stop threshold when 20 ms away from being empty */
|
||||||
private final static int SAMPLE_SIZE_40_MS = BUFFER_SIZE / 25;
|
private final static int SAMPLE_SIZE_40_MS = BUFFER_SIZE / 25;
|
||||||
private final static int START_THRESHOLD = SAMPLE_SIZE_40_MS;
|
private final static int START_THRESHOLD = SAMPLE_SIZE_40_MS;
|
||||||
private final static int STOP_THRESHOLD = BUFFER_SIZE - SAMPLE_SIZE_40_MS;
|
private final static int STOP_THRESHOLD = BUFFER_SIZE - SAMPLE_SIZE_40_MS;
|
||||||
@@ -50,13 +51,10 @@ public class StereoAudioOutput extends AudioOutput
|
|||||||
private SourceDataLine mOutput;
|
private SourceDataLine mOutput;
|
||||||
private FloatControl mGainControl;
|
private FloatControl mGainControl;
|
||||||
private BooleanControl mMuteControl;
|
private BooleanControl mMuteControl;
|
||||||
|
|
||||||
private AudioEvent mAudioStartEvent;
|
private AudioEvent mAudioStartEvent;
|
||||||
private AudioEvent mAudioStopEvent;
|
private AudioEvent mAudioStopEvent;
|
||||||
private AudioEvent mAudioContinuationEvent;
|
private AudioEvent mAudioContinuationEvent;
|
||||||
|
|
||||||
private MixerChannel mMixerChannel;
|
private MixerChannel mMixerChannel;
|
||||||
|
|
||||||
private ScheduledFuture<?> mProcessorTask;
|
private ScheduledFuture<?> mProcessorTask;
|
||||||
|
|
||||||
public StereoAudioOutput( ThreadPoolManager threadPoolManager,
|
public StereoAudioOutput( ThreadPoolManager threadPoolManager,
|
||||||
@@ -83,6 +81,7 @@ public class StereoAudioOutput extends AudioOutput
|
|||||||
if( mOutput != null )
|
if( mOutput != null )
|
||||||
{
|
{
|
||||||
mOutput.open( AudioFormats.PCM_SIGNED_48KHZ_16BITS_STEREO, BUFFER_SIZE );
|
mOutput.open( AudioFormats.PCM_SIGNED_48KHZ_16BITS_STEREO, BUFFER_SIZE );
|
||||||
|
mOutput.addLineListener( this );
|
||||||
mCanProcessAudio = true;
|
mCanProcessAudio = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,17 +201,14 @@ public class StereoAudioOutput extends AudioOutput
|
|||||||
|
|
||||||
if( packets.size() > 0 )
|
if( packets.size() > 0 )
|
||||||
{
|
{
|
||||||
broadcast( mAudioContinuationEvent );
|
|
||||||
|
|
||||||
for( AudioPacket packet: packets )
|
for( AudioPacket packet: packets )
|
||||||
{
|
{
|
||||||
|
broadcast( mAudioContinuationEvent );
|
||||||
|
|
||||||
if( mCanProcessAudio )
|
if( mCanProcessAudio )
|
||||||
{
|
{
|
||||||
if( isSquelched() )
|
if( packet.getType() == Type.AUDIO )
|
||||||
{
|
|
||||||
checkStop();
|
|
||||||
}
|
|
||||||
else if( packet.getType() == Type.AUDIO )
|
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = convert(
|
ByteBuffer buffer = convert(
|
||||||
packet.getAudioBuffer().getSamples() );
|
packet.getAudioBuffer().getSamples() );
|
||||||
@@ -245,24 +241,20 @@ public class StereoAudioOutput extends AudioOutput
|
|||||||
|
|
||||||
private void checkStart()
|
private void checkStart()
|
||||||
{
|
{
|
||||||
if( mCanProcessAudio && !isSquelched() &&
|
if( mCanProcessAudio &&
|
||||||
!mOutput.isRunning() && mOutput.available() <= START_THRESHOLD )
|
!mOutput.isRunning() && mOutput.available() <= START_THRESHOLD )
|
||||||
{
|
{
|
||||||
mOutput.start();
|
mOutput.start();
|
||||||
|
|
||||||
mAudioEventBroadcaster.broadcast( mAudioStartEvent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkStop()
|
private void checkStop()
|
||||||
{
|
{
|
||||||
if( mCanProcessAudio && mOutput.isRunning() &&
|
if( mCanProcessAudio && mOutput.isRunning() &&
|
||||||
( mOutput.available() >= STOP_THRESHOLD || isSquelched() ) )
|
mOutput.available() >= STOP_THRESHOLD )
|
||||||
{
|
{
|
||||||
mOutput.drain();
|
mOutput.drain();
|
||||||
mOutput.stop();
|
mOutput.stop();
|
||||||
|
|
||||||
mAudioEventBroadcaster.broadcast( mAudioStopEvent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,4 +293,20 @@ public class StereoAudioOutput extends AudioOutput
|
|||||||
{
|
{
|
||||||
return mGainControl != null;
|
return mGainControl != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update( LineEvent event )
|
||||||
|
{
|
||||||
|
LineEvent.Type type = event.getType();
|
||||||
|
|
||||||
|
if( type == LineEvent.Type.START )
|
||||||
|
{
|
||||||
|
mAudioEventBroadcaster.broadcast( mAudioStartEvent );
|
||||||
|
}
|
||||||
|
else if( type == LineEvent.Type.STOP )
|
||||||
|
{
|
||||||
|
mAudioEventBroadcaster.broadcast( mAudioStopEvent );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,6 +297,9 @@ public class Channel extends Configuration
|
|||||||
|
|
||||||
/* Broadcast channel deleted event */
|
/* Broadcast channel deleted event */
|
||||||
fireChannelEvent( Event.CHANNEL_DELETED );
|
fireChannelEvent( Event.CHANNEL_DELETED );
|
||||||
|
|
||||||
|
mProcessingChain.dispose();
|
||||||
|
mProcessingChain = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -809,7 +812,7 @@ public class Channel extends Configuration
|
|||||||
{
|
{
|
||||||
if( mProcessingChain == null )
|
if( mProcessingChain == null )
|
||||||
{
|
{
|
||||||
mProcessingChain = new ProcessingChain();
|
mProcessingChain = new ProcessingChain( getName() );
|
||||||
|
|
||||||
/* Get the optional alias list for the decode modules to use */
|
/* Get the optional alias list for the decode modules to use */
|
||||||
AliasList aliasList = mResourceManager.getPlaylistManager()
|
AliasList aliasList = mResourceManager.getPlaylistManager()
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ import source.Source;
|
|||||||
|
|
||||||
public class InstrumentableProcessingChain extends ProcessingChain implements Instrumentable
|
public class InstrumentableProcessingChain extends ProcessingChain implements Instrumentable
|
||||||
{
|
{
|
||||||
public InstrumentableProcessingChain()
|
public InstrumentableProcessingChain( String name )
|
||||||
{
|
{
|
||||||
|
super( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSource( Source source ) throws IllegalStateException
|
public void setSource( Source source ) throws IllegalStateException
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
|
|
||||||
mDecodeConfig = decodeConfig;
|
mDecodeConfig = decodeConfig;
|
||||||
|
|
||||||
mProcessingChain = new InstrumentableProcessingChain();
|
mProcessingChain = new InstrumentableProcessingChain( "instrumented" );
|
||||||
|
|
||||||
List<Module> modules = DecoderFactory
|
List<Module> modules = DecoderFactory
|
||||||
.getModules( ChannelType.STANDARD,
|
.getModules( ChannelType.STANDARD,
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ package module;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import message.IMessageListener;
|
import message.IMessageListener;
|
||||||
@@ -61,7 +62,7 @@ import audio.metadata.Metadata;
|
|||||||
import audio.squelch.ISquelchStateListener;
|
import audio.squelch.ISquelchStateListener;
|
||||||
import audio.squelch.ISquelchStateProvider;
|
import audio.squelch.ISquelchStateProvider;
|
||||||
import audio.squelch.SquelchState;
|
import audio.squelch.SquelchState;
|
||||||
import controller.ThreadPoolManager;
|
import controller.NamingThreadFactory;
|
||||||
import controller.channel.ChannelEvent;
|
import controller.channel.ChannelEvent;
|
||||||
import controller.channel.IChannelEventListener;
|
import controller.channel.IChannelEventListener;
|
||||||
import controller.channel.IChannelEventProvider;
|
import controller.channel.IChannelEventProvider;
|
||||||
@@ -99,15 +100,17 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
private Broadcaster<RealBuffer> mRealBufferBroadcaster = new Broadcaster<>();
|
private Broadcaster<RealBuffer> mRealBufferBroadcaster = new Broadcaster<>();
|
||||||
private Broadcaster<SquelchState> mSquelchStateBroadcaster = new Broadcaster<>();
|
private Broadcaster<SquelchState> mSquelchStateBroadcaster = new Broadcaster<>();
|
||||||
|
|
||||||
// private ThreadPoolManager mThreadPoolManager;
|
private ScheduledExecutorService mScheduledExecutorService;
|
||||||
private AtomicBoolean mRunning = new AtomicBoolean();
|
private AtomicBoolean mRunning = new AtomicBoolean();
|
||||||
|
|
||||||
protected Source mSource;
|
protected Source mSource;
|
||||||
private List<Module> mModules = new ArrayList<>();
|
private List<Module> mModules = new ArrayList<>();
|
||||||
private IFrequencyCorrectionController mFrequencyCorrectionController;
|
private IFrequencyCorrectionController mFrequencyCorrectionController;
|
||||||
|
|
||||||
public ProcessingChain()
|
public ProcessingChain( String name )
|
||||||
{
|
{
|
||||||
|
mScheduledExecutorService = Executors.newScheduledThreadPool( 1,
|
||||||
|
new NamingThreadFactory( "channel " + name ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
@@ -121,6 +124,9 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
|
|
||||||
mModules.clear();
|
mModules.clear();
|
||||||
|
|
||||||
|
mScheduledExecutorService.shutdownNow();
|
||||||
|
mScheduledExecutorService = null;
|
||||||
|
|
||||||
mFrequencyCorrectionController = null;
|
mFrequencyCorrectionController = null;
|
||||||
|
|
||||||
mAudioPacketBroadcaster.dispose();
|
mAudioPacketBroadcaster.dispose();
|
||||||
@@ -432,9 +438,11 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
* of the decoder state's */
|
* of the decoder state's */
|
||||||
if( mSource instanceof TunerChannelSource )
|
if( mSource instanceof TunerChannelSource )
|
||||||
{
|
{
|
||||||
|
TunerChannelSource tunerChannelSource = (TunerChannelSource)mSource;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
long frequency = ((TunerChannelSource)mSource).getFrequency();
|
long frequency = tunerChannelSource.getFrequency();
|
||||||
|
|
||||||
mDecoderStateEventBroadcaster.broadcast(
|
mDecoderStateEventBroadcaster.broadcast(
|
||||||
new DecoderStateEvent( this, Event.SOURCE_FREQUENCY,
|
new DecoderStateEvent( this, Event.SOURCE_FREQUENCY,
|
||||||
@@ -444,6 +452,8 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
mLog.error( "Error getting frequency from tuner channel source", e );
|
mLog.error( "Error getting frequency from tuner channel source", e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tunerChannelSource.start( mScheduledExecutorService );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -153,7 +153,9 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
case CA_ENDD:
|
case CA_ENDD:
|
||||||
CallEndMessage end = (CallEndMessage)message;
|
CallEndMessage end = (CallEndMessage)message;
|
||||||
|
|
||||||
int repeater = end.getHomeRepeater();
|
//Home channel is 31 for call end -- use the free channel
|
||||||
|
//as the call end channel
|
||||||
|
int repeater = end.getFree();
|
||||||
|
|
||||||
mLCNTracker.processCallChannel( repeater );
|
mLCNTracker.processCallChannel( repeater );
|
||||||
|
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ public class P25MessageFramer implements Listener<Dibit>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mComplete = true;
|
mComplete = true;
|
||||||
|
dispatch( new P25Message( mMessage.copy(), duid, mAliasList ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -253,20 +253,6 @@ public class ChannelList extends JPanel implements ChannelEventListener
|
|||||||
idleMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
idleMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ) );
|
||||||
|
|
||||||
JMenu noTunerMenu = new JMenu( "No Tuner" );
|
|
||||||
channelsMenu.add( noTunerMenu );
|
|
||||||
|
|
||||||
noTunerMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ) );
|
|
||||||
noTunerMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ) );
|
|
||||||
noTunerMenu.add( new JSeparator() );
|
|
||||||
|
|
||||||
noTunerMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ) );
|
|
||||||
noTunerMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ) );
|
|
||||||
|
|
||||||
JMenu labelMenu = new JMenu( "Labels" );
|
JMenu labelMenu = new JMenu( "Labels" );
|
||||||
colorMenu.add( labelMenu );
|
colorMenu.add( labelMenu );
|
||||||
|
|
||||||
|
|||||||
@@ -144,11 +144,6 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
mMonitoring.set( false );
|
mMonitoring.set( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new RuntimeException( "Channel state monitor's scheduled "
|
|
||||||
+ "future pointer was not null" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,15 @@ public class TrafficChannelManager extends Module
|
|||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
|
mLog.debug( "dispose() on traffic channel manager" );
|
||||||
|
for( Channel trafficChannel: mTrafficChannelPool )
|
||||||
|
{
|
||||||
|
trafficChannel.setEnabled( false );
|
||||||
|
trafficChannel.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
mTrafficChannelPool.clear();
|
||||||
|
|
||||||
mCallEventListener = null;
|
mCallEventListener = null;
|
||||||
mResourceManager = null;
|
mResourceManager = null;
|
||||||
mDecodeConfiguration = null;
|
mDecodeConfiguration = null;
|
||||||
|
|||||||
@@ -63,9 +63,8 @@ public class Recording implements Comparable<Recording>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource getChannel( TunerChannel channel )
|
||||||
TunerChannel channel ) throws RejectedExecutionException,
|
throws RejectedExecutionException, SourceException
|
||||||
SourceException
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ public class RecordingSourceManager
|
|||||||
|
|
||||||
if( recording != null )
|
if( recording != null )
|
||||||
{
|
{
|
||||||
retVal = recording.getChannel(
|
retVal = recording.getChannel( tunerChannel );
|
||||||
mResourceManager.getThreadPoolManager(),
|
|
||||||
tunerChannel );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,10 +30,9 @@ import sample.complex.ComplexBuffer;
|
|||||||
import source.SourceException;
|
import source.SourceException;
|
||||||
import source.tuner.frequency.FrequencyChangeBroadcaster;
|
import source.tuner.frequency.FrequencyChangeBroadcaster;
|
||||||
import source.tuner.frequency.FrequencyChangeEvent;
|
import source.tuner.frequency.FrequencyChangeEvent;
|
||||||
import source.tuner.frequency.FrequencyChangeListener;
|
|
||||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||||
|
import source.tuner.frequency.FrequencyChangeListener;
|
||||||
import controller.ResourceManager;
|
import controller.ResourceManager;
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tuner - provides tuner channel sources, representing a channel frequency
|
* Tuner - provides tuner channel sources, representing a channel frequency
|
||||||
@@ -147,8 +146,8 @@ public abstract class Tuner implements FrequencyChangeBroadcaster,
|
|||||||
*
|
*
|
||||||
* @return - source for 48k sample rate
|
* @return - source for 48k sample rate
|
||||||
*/
|
*/
|
||||||
public abstract TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public abstract TunerChannelSource getChannel( TunerChannel channel )
|
||||||
TunerChannel channel ) throws RejectedExecutionException, SourceException;
|
throws RejectedExecutionException, SourceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the tuned channel resources
|
* Releases the tuned channel resources
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ public interface TunerChannelProvider
|
|||||||
*
|
*
|
||||||
* @return - source for 48k sample rate
|
* @return - source for 48k sample rate
|
||||||
*/
|
*/
|
||||||
public abstract TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public abstract TunerChannelSource getChannel( TunerChannel channel )
|
||||||
TunerChannel channel ) throws RejectedExecutionException, SourceException;
|
throws RejectedExecutionException, SourceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the tuned channel resources
|
* Releases the tuned channel resources
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.LinkedTransferQueue;
|
import java.util.concurrent.LinkedTransferQueue;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@@ -37,8 +38,6 @@ import source.SourceException;
|
|||||||
import source.tuner.frequency.FrequencyChangeEvent;
|
import source.tuner.frequency.FrequencyChangeEvent;
|
||||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||||
import source.tuner.frequency.FrequencyChangeListener;
|
import source.tuner.frequency.FrequencyChangeListener;
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
import controller.ThreadPoolManager.ThreadType;
|
|
||||||
import dsp.filter.FilterFactory;
|
import dsp.filter.FilterFactory;
|
||||||
import dsp.filter.Window.WindowType;
|
import dsp.filter.Window.WindowType;
|
||||||
import dsp.filter.cic.ComplexPrimeCICDecimate;
|
import dsp.filter.cic.ComplexPrimeCICDecimate;
|
||||||
@@ -62,7 +61,6 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
private ComplexPrimeCICDecimate mDecimationFilter;
|
private ComplexPrimeCICDecimate mDecimationFilter;
|
||||||
private Listener<ComplexBuffer> mListener;
|
private Listener<ComplexBuffer> mListener;
|
||||||
private FrequencyChangeListener mFrequencyChangeListener;
|
private FrequencyChangeListener mFrequencyChangeListener;
|
||||||
private ThreadPoolManager mThreadPoolManager;
|
|
||||||
private ScheduledFuture<?> mTaskHandle;
|
private ScheduledFuture<?> mTaskHandle;
|
||||||
|
|
||||||
private long mTunerFrequency = 0;
|
private long mTunerFrequency = 0;
|
||||||
@@ -71,15 +69,11 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
|
|
||||||
private DecimationProcessor mDecimationProcessor = new DecimationProcessor();
|
private DecimationProcessor mDecimationProcessor = new DecimationProcessor();
|
||||||
|
|
||||||
public TunerChannelSource( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource( Tuner tuner, TunerChannel tunerChannel )
|
||||||
Tuner tuner,
|
throws RejectedExecutionException, SourceException
|
||||||
TunerChannel tunerChannel )
|
|
||||||
throws RejectedExecutionException, SourceException
|
|
||||||
{
|
{
|
||||||
super( "Tuner Channel Source" );
|
super( "Tuner Channel Source" );
|
||||||
|
|
||||||
mThreadPoolManager = threadPoolManager;
|
|
||||||
|
|
||||||
mTuner = tuner;
|
mTuner = tuner;
|
||||||
mTuner.addListener( (FrequencyChangeListener)this );
|
mTuner.addListener( (FrequencyChangeListener)this );
|
||||||
|
|
||||||
@@ -95,14 +89,17 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
/* Fire a sample rate change event to setup the decimation chain */
|
/* Fire a sample rate change event to setup the decimation chain */
|
||||||
frequencyChanged( new FrequencyChangeEvent(
|
frequencyChanged( new FrequencyChangeEvent(
|
||||||
Event.SAMPLE_RATE_CHANGE_NOTIFICATION, mTuner.getSampleRate() ) );
|
Event.SAMPLE_RATE_CHANGE_NOTIFICATION, mTuner.getSampleRate() ) );
|
||||||
|
}
|
||||||
/* Schedule the decimation task to run every 20 ms (50 iterations/second) */
|
|
||||||
mTaskHandle = mThreadPoolManager.scheduleFixedRate( ThreadType.DECIMATION,
|
public void start( ScheduledExecutorService scheduledExecutorService )
|
||||||
mDecimationProcessor, 20, TimeUnit.MILLISECONDS );
|
{
|
||||||
|
/* Schedule the decimation task to run every 10 ms (100 iterations/second) */
|
||||||
|
mTaskHandle = scheduledExecutorService.scheduleAtFixedRate(
|
||||||
|
mDecimationProcessor, 0, 10, TimeUnit.MILLISECONDS );
|
||||||
|
|
||||||
/* Finally, register to receive samples from the tuner */
|
/* Finally, register to receive samples from the tuner */
|
||||||
mTuner.addListener( (Listener<ComplexBuffer>)this );
|
mTuner.addListener( (Listener<ComplexBuffer>)this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
@@ -129,12 +126,10 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
{
|
{
|
||||||
if( mTaskHandle != null )
|
if( mTaskHandle != null )
|
||||||
{
|
{
|
||||||
mThreadPoolManager.cancel( mTaskHandle );
|
mTaskHandle.cancel( true );
|
||||||
mThreadPoolManager = null;
|
|
||||||
mTaskHandle = null;
|
mTaskHandle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mBuffer.clear();
|
mBuffer.clear();
|
||||||
mBuffer = null;
|
mBuffer = null;
|
||||||
|
|
||||||
@@ -290,7 +285,7 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
{
|
{
|
||||||
if( mBuffer != null )
|
if( mBuffer != null )
|
||||||
{
|
{
|
||||||
mBuffer.drainTo( mSampleBuffers, 4 );
|
mBuffer.drainTo( mSampleBuffers, 8 );
|
||||||
|
|
||||||
for( Buffer buffer: mSampleBuffers )
|
for( Buffer buffer: mSampleBuffers )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -194,8 +194,8 @@ public abstract class TunerController implements Tunable
|
|||||||
*
|
*
|
||||||
* @throws RejectedExecutionException if the decimation processor has an error
|
* @throws RejectedExecutionException if the decimation processor has an error
|
||||||
*/
|
*/
|
||||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource getChannel( Tuner tuner, TunerChannel channel )
|
||||||
Tuner tuner, TunerChannel channel ) throws RejectedExecutionException
|
throws RejectedExecutionException
|
||||||
{
|
{
|
||||||
TunerChannelSource source = null;
|
TunerChannelSource source = null;
|
||||||
|
|
||||||
@@ -210,8 +210,7 @@ public abstract class TunerController implements Tunable
|
|||||||
updateLOFrequency();
|
updateLOFrequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
source = new TunerChannelSource( threadPoolManager,
|
source = new TunerChannelSource( tuner, channel );
|
||||||
tuner, channel );
|
|
||||||
}
|
}
|
||||||
catch( SourceException se )
|
catch( SourceException se )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -100,8 +100,7 @@ public class TunerManager
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
retVal = tuner.getChannel(
|
retVal = tuner.getChannel( tunerChannel );
|
||||||
mResourceManager.getThreadPoolManager(), tunerChannel );
|
|
||||||
}
|
}
|
||||||
catch ( RejectedExecutionException ree )
|
catch ( RejectedExecutionException ree )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ public class AirspyTuner extends Tuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource getChannel( TunerChannel channel )
|
||||||
TunerChannel channel ) throws RejectedExecutionException, SourceException
|
throws RejectedExecutionException, SourceException
|
||||||
{
|
{
|
||||||
//TODO: this channel has a decimated sample rate of:
|
//TODO: this channel has a decimated sample rate of:
|
||||||
// 10.0 MSps = 10,000,000 / 208 = 48076.923
|
// 10.0 MSps = 10,000,000 / 208 = 48076.923
|
||||||
@@ -138,7 +138,7 @@ public class AirspyTuner extends Tuner
|
|||||||
//Consider implementing a fractional resampler to get a correct 48 kHz
|
//Consider implementing a fractional resampler to get a correct 48 kHz
|
||||||
//output sample rate
|
//output sample rate
|
||||||
|
|
||||||
return mController.getChannel( threadPoolManager, this, channel );
|
return mController.getChannel( this, channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ public class B100Tuner extends Tuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource getChannel( TunerChannel channel )
|
||||||
TunerChannel channel ) throws RejectedExecutionException, SourceException
|
throws RejectedExecutionException, SourceException
|
||||||
{
|
{
|
||||||
//TODO: pass this call to the tuner controller
|
//TODO: pass this call to the tuner controller
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -112,11 +112,10 @@ public class FCDTuner extends MixerTuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource getChannel( TunerChannel tunerChannel )
|
||||||
TunerChannel tunerChannel ) throws RejectedExecutionException,
|
throws RejectedExecutionException, SourceException
|
||||||
SourceException
|
|
||||||
{
|
{
|
||||||
return mController.getChannel( threadPoolManager, this, tunerChannel );
|
return mController.getChannel( this, tunerChannel );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -106,10 +106,10 @@ public class HackRFTuner extends Tuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource getChannel( TunerChannel channel )
|
||||||
TunerChannel channel ) throws RejectedExecutionException, SourceException
|
throws RejectedExecutionException, SourceException
|
||||||
{
|
{
|
||||||
return mController.getChannel( threadPoolManager, this, channel );
|
return mController.getChannel( this, channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import source.tuner.TunerType;
|
|||||||
import source.tuner.frequency.FrequencyChangeListener;
|
import source.tuner.frequency.FrequencyChangeListener;
|
||||||
import source.tuner.rtl.RTL2832TunerController.SampleRate;
|
import source.tuner.rtl.RTL2832TunerController.SampleRate;
|
||||||
import controller.ResourceManager;
|
import controller.ResourceManager;
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
|
|
||||||
public class RTL2832Tuner extends Tuner
|
public class RTL2832Tuner extends Tuner
|
||||||
{
|
{
|
||||||
@@ -148,16 +147,14 @@ public class RTL2832Tuner extends Tuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
public TunerChannelSource getChannel( TunerChannel channel )
|
||||||
TunerChannel channel )
|
throws RejectedExecutionException, SourceException
|
||||||
throws RejectedExecutionException,
|
|
||||||
SourceException
|
|
||||||
{
|
{
|
||||||
TunerChannelSource source = null;
|
TunerChannelSource source = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
source = mController.getChannel( threadPoolManager, this, channel );
|
source = mController.getChannel( this, channel );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user