mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Initial commit of redesigned internal processing and audio management.
Note: Several of the decoders are currently non-functioning in this commit. If you want the latest functioning codebase, please checkout the commit prior to this one. All decoders will eventually be updated with this new architecture. Currently broken: - Logging and recording - Aux decoders (Fleetsync/MDC/LoJack/Tait) - LTR/Passport decoders Changes in this commit: - Module architecture for decoders and components with central provisioning by the DecoderFactory - Transition from Complex sample stream processing to float buffer processing for improved memory management - Redesigned filter structures - to support buffers and streams - Resolved several memory leak issues - Universal sharing of the thread pool manager - Added centralized audio management with call/user prioritization and new gui with mute/volume controls - Embedded audio metadata for eventual streaming support - Redesigned ProcessingChain to support independent re-use - Added new TrafficChannelManager to handle traffic channel allocations - Traffic Channel pool size and Call timeout available in P25 and MPT1327 configs - Redesigned channel and decoder gui components
This commit is contained in:
120
src/audio/AudioPanel.java
Normal file
120
src/audio/AudioPanel.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package audio;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.sound.sampled.BooleanControl;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import settings.SettingsManager;
|
||||
|
||||
public class AudioPanel extends JPanel implements Listener<AudioEvent>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger mLog = LoggerFactory.getLogger( AudioPanel.class );
|
||||
|
||||
private SettingsManager mSettingsManager;
|
||||
private IAudioController mController;
|
||||
private MuteButton mMuteButton;
|
||||
|
||||
public AudioPanel( SettingsManager settingsManager, IAudioController controller )
|
||||
{
|
||||
mSettingsManager = settingsManager;
|
||||
mController = controller;
|
||||
|
||||
mMuteButton = new MuteButton( mController );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]") );
|
||||
setBackground( Color.BLACK );
|
||||
|
||||
add( mMuteButton, "span" );
|
||||
|
||||
for( String channel: mController.getAudioChannels() )
|
||||
{
|
||||
add( new AudioChannelPanel( mSettingsManager, mController, channel ), "span" );
|
||||
}
|
||||
}
|
||||
|
||||
public int getPreferredHeight()
|
||||
{
|
||||
return mMuteButton.getHeight() +
|
||||
( mController.getAudioChannels().size() * 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( AudioEvent event )
|
||||
{
|
||||
if( event.getType() == AudioEvent.Type.AUDIO_CONFIGURATION_CHANGED )
|
||||
{
|
||||
mLog.debug( "Audio configuration change detected" );
|
||||
}
|
||||
}
|
||||
|
||||
public class MuteButton extends JButton
|
||||
{
|
||||
private IAudioController mController;
|
||||
|
||||
private boolean mMuted = false;
|
||||
|
||||
public MuteButton( IAudioController controller )
|
||||
{
|
||||
super( "Mute Audio" );
|
||||
|
||||
setBackground( Color.GREEN );
|
||||
|
||||
mController = controller;
|
||||
|
||||
addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
mMuted = !mMuted;
|
||||
|
||||
for( String channel: mController.getAudioChannels() )
|
||||
{
|
||||
try
|
||||
{
|
||||
BooleanControl control = mController.getMuteControl( channel );
|
||||
|
||||
if( control != null )
|
||||
{
|
||||
control.setValue( mMuted );
|
||||
}
|
||||
}
|
||||
catch ( AudioException e1 )
|
||||
{
|
||||
mLog.error( "Couldn't obtain mute control for "
|
||||
+ "channel [" + channel + "] from audio manager", e1 );
|
||||
}
|
||||
}
|
||||
|
||||
EventQueue.invokeLater( new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
MuteButton.this.setText( ( mMuted ? "Unmute Audio" : "Mute Audio" ) );
|
||||
MuteButton.this.setBackground( ( mMuted ? Color.RED : Color.GREEN ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user