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:
@@ -19,9 +19,13 @@ package instrument.gui;
|
||||
|
||||
import instrument.Instrumentable;
|
||||
import instrument.tap.Tap;
|
||||
import instrument.tap.TapViewPanel;
|
||||
import instrument.tap.stream.BinaryTap;
|
||||
import instrument.tap.stream.BinaryTapViewPanel;
|
||||
import instrument.tap.stream.FloatTap;
|
||||
import instrument.tap.stream.FloatTapViewPanel;
|
||||
import instrument.tap.stream.SymbolEventTap;
|
||||
import instrument.tap.stream.SymbolEventTapViewPanel;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -51,7 +55,9 @@ import decode.Decoder;
|
||||
public class DecoderViewFrame extends JInternalFrame
|
||||
implements PositionListener, Listener<Message>
|
||||
{
|
||||
private Decoder mDecoder;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Decoder mDecoder;
|
||||
private WaveSource mWaveSource;
|
||||
|
||||
private HashMap<Tap,TapViewPanel> mPanelMap =
|
||||
|
||||
@@ -46,6 +46,7 @@ import decode.fleetsync2.Fleetsync2Decoder;
|
||||
import decode.ltrnet.LTRNetDecoder;
|
||||
import decode.mdc1200.MDCDecoder;
|
||||
import decode.mpt1327.MPT1327Decoder;
|
||||
import decode.p25.P25Decoder;
|
||||
import decode.passport.PassportDecoder;
|
||||
|
||||
public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
@@ -146,6 +147,10 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
break;
|
||||
case PASSPORT:
|
||||
decoder = new PassportDecoder( SampleType.FLOAT, null );
|
||||
break;
|
||||
case P25:
|
||||
decoder = new P25Decoder( SampleType.FLOAT, null );
|
||||
break;
|
||||
}
|
||||
|
||||
if( decoder != null )
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
* 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 instrument.gui;
|
||||
package instrument.tap;
|
||||
|
||||
import instrument.gui.SampleModel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
@@ -15,10 +15,11 @@
|
||||
* 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 instrument.gui;
|
||||
package instrument.tap.stream;
|
||||
|
||||
import instrument.gui.SampleModel;
|
||||
import instrument.tap.Tap;
|
||||
import instrument.tap.stream.BinaryTap;
|
||||
import instrument.tap.TapViewPanel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FontMetrics;
|
||||
128
src/instrument/tap/stream/FloatTapPhaseViewPanel.java
Normal file
128
src/instrument/tap/stream/FloatTapPhaseViewPanel.java
Normal file
@@ -0,0 +1,128 @@
|
||||
/*******************************************************************************
|
||||
* 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 instrument.tap.stream;
|
||||
|
||||
import instrument.gui.SampleModel;
|
||||
import instrument.tap.Tap;
|
||||
import instrument.tap.TapViewPanel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
|
||||
import log.Log;
|
||||
|
||||
public class FloatTapPhaseViewPanel extends TapViewPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Tap mTap;
|
||||
private List<Float> mSamples;
|
||||
private int mSampleCount;
|
||||
|
||||
public FloatTapPhaseViewPanel( FloatTap tap )
|
||||
{
|
||||
super( new SampleModel<Float>(), tap.getName() );
|
||||
|
||||
mTap = tap;
|
||||
mTap.addListener( getModel() );
|
||||
|
||||
mSampleCount = (int)( 2000 * tap.getSampleRateRatio() );
|
||||
|
||||
getModel().setSampleCount( mSampleCount );
|
||||
getModel().setDelay( tap.getDelay() );
|
||||
|
||||
Log.info( "Float Tap Panel [" + tap.getName() + "] count: " +
|
||||
getModel().getSampleCount() + " delay:" + getModel().getDelay() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update( Observable arg0, Object arg1 )
|
||||
{
|
||||
mSamples = (List<Float>)getModel().getSamples();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void paintComponent( Graphics g )
|
||||
{
|
||||
super.paintComponent( g );
|
||||
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
|
||||
int height = getHeight();
|
||||
int width = getWidth();
|
||||
|
||||
g2.setColor( Color.DARK_GRAY );
|
||||
|
||||
float middle = (float)height / 2.0f;
|
||||
|
||||
g2.drawLine( 0, (int)middle, width, (int)middle );
|
||||
|
||||
if( mSamples != null &&
|
||||
mSamples.size() > 0 )
|
||||
{
|
||||
g2.setColor( getForeground() );
|
||||
|
||||
g2.drawString( mLabel, 5 , 15 );
|
||||
|
||||
Path2D.Float polyline =
|
||||
new Path2D.Float( Path2D.Float.WIND_EVEN_ODD, mSamples.size() );
|
||||
|
||||
/* Move to the first point */
|
||||
Point2D.Float first = resolve( 0, mSamples.get( 0 ) );
|
||||
polyline.moveTo( first.x, first.y );
|
||||
|
||||
for( int x = 1; x < mSamples.size(); x++ )
|
||||
{
|
||||
Point2D.Float point = resolve( x, mSamples.get( x ) );
|
||||
|
||||
polyline.lineTo( point.x, point.y );
|
||||
}
|
||||
|
||||
g2.draw(polyline);
|
||||
}
|
||||
|
||||
g2.dispose();
|
||||
}
|
||||
|
||||
private Point2D.Float resolve( int index, float value )
|
||||
{
|
||||
int middle = (int)( getHeight() / 2 );
|
||||
|
||||
double scaledValue = Math.asin( value );
|
||||
|
||||
float y = middle - (float)( middle * scaledValue * mVerticalZoom );
|
||||
|
||||
/* Clip y to zero as necessary */
|
||||
y = ( y < 0 ) ? 0 : y;
|
||||
|
||||
/* Clip y to max height as necessary */
|
||||
y = ( y > getHeight() ) ? getHeight() : y;
|
||||
|
||||
float indexWidth = (float)getWidth() / (float)mSampleCount;
|
||||
|
||||
float x = (float)index * indexWidth;
|
||||
|
||||
Point2D.Float point = new Point2D.Float( x, y );
|
||||
|
||||
return new Point2D.Float( x , y );
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,11 @@
|
||||
* 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 instrument.gui;
|
||||
package instrument.tap.stream;
|
||||
|
||||
import instrument.gui.SampleModel;
|
||||
import instrument.tap.Tap;
|
||||
import instrument.tap.stream.FloatTap;
|
||||
import instrument.tap.TapViewPanel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
@@ -108,6 +109,7 @@ public class FloatTapViewPanel extends TapViewPanel
|
||||
|
||||
float scaledValue = value / (float)Short.MAX_VALUE;
|
||||
|
||||
Log.info( "Float value is:" + scaledValue );
|
||||
float y = middle - ( middle * scaledValue * mVerticalZoom );
|
||||
|
||||
/* Clip y to zero as necessary */
|
||||
@@ -15,9 +15,10 @@
|
||||
* 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 instrument.gui;
|
||||
package instrument.tap.stream;
|
||||
|
||||
import instrument.tap.stream.SymbolEventTap;
|
||||
import instrument.gui.SampleModel;
|
||||
import instrument.tap.TapViewPanel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FontMetrics;
|
||||
Reference in New Issue
Block a user