mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 01:27:34 -05:00
Adds call blacklisting (do not monitor) to aliases.
This commit is contained in:
@@ -47,10 +47,6 @@ public class AudioChannelPanel extends JPanel
|
||||
private IAudioController mController;
|
||||
private String mChannel;
|
||||
|
||||
private JLabel mChannelLabel;
|
||||
private JLabel mChannelName;
|
||||
private JLabel mMutedLabel;
|
||||
|
||||
private JLabel mToLabel = new JLabel( "To:" );
|
||||
private JLabel mTo = new JLabel( "" );
|
||||
private JLabel mToAlias = new JLabel( "" );
|
||||
@@ -59,6 +55,10 @@ public class AudioChannelPanel extends JPanel
|
||||
private JLabel mFrom = new JLabel( "" );
|
||||
private JLabel mFromAlias = new JLabel( "" );
|
||||
|
||||
private JLabel mChannelLabel;
|
||||
private JLabel mChannelName;
|
||||
private JLabel mMutedLabel;
|
||||
|
||||
private boolean mConfigured = false;
|
||||
|
||||
private BooleanControl mMuteControl;
|
||||
@@ -121,24 +121,6 @@ public class AudioChannelPanel extends JPanel
|
||||
|
||||
addMouseListener( new MouseSelectionListener() );
|
||||
|
||||
mChannelLabel = new JLabel( "Channel:" );
|
||||
mChannelLabel.setFont( mFont );
|
||||
mChannelLabel.setForeground( mDetailsColor );
|
||||
|
||||
add( mChannelLabel );
|
||||
|
||||
mChannelName = new JLabel( mChannel );
|
||||
mChannelName.setFont( mFont );
|
||||
mChannelName.setForeground( mDetailsColor );
|
||||
|
||||
add( mChannelName );
|
||||
|
||||
mMutedLabel = new JLabel( "" );
|
||||
mMutedLabel.setFont( mFont );
|
||||
mMutedLabel.setForeground( Color.RED );
|
||||
|
||||
add( mMutedLabel, "wrap" );
|
||||
|
||||
mToLabel.setFont( mFont );
|
||||
mToLabel.setForeground( mLabelColor );
|
||||
add( mToLabel );
|
||||
@@ -162,6 +144,24 @@ public class AudioChannelPanel extends JPanel
|
||||
mFromAlias.setFont( mFont );
|
||||
mFromAlias.setForeground( mLabelColor );
|
||||
add( mFromAlias,"wrap" );
|
||||
|
||||
mChannelLabel = new JLabel( "Channel:" );
|
||||
mChannelLabel.setFont( mFont );
|
||||
mChannelLabel.setForeground( mDetailsColor );
|
||||
|
||||
add( mChannelLabel );
|
||||
|
||||
mChannelName = new JLabel( mChannel );
|
||||
mChannelName.setFont( mFont );
|
||||
mChannelName.setForeground( mDetailsColor );
|
||||
|
||||
add( mChannelName );
|
||||
|
||||
mMutedLabel = new JLabel( "" );
|
||||
mMutedLabel.setFont( mFont );
|
||||
mMutedLabel.setForeground( Color.RED );
|
||||
|
||||
add( mMutedLabel, "wrap" );
|
||||
}
|
||||
|
||||
private void updateMuteState()
|
||||
@@ -225,7 +225,8 @@ public class AudioChannelPanel extends JPanel
|
||||
|
||||
if( icon != null )
|
||||
{
|
||||
label.setIcon( mSettingsManager.getImageIcon( icon, 12 ) );
|
||||
label.setIcon( mSettingsManager.getImageIcon( icon,
|
||||
SettingsManager.DEFAULT_ICON_SIZE ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -99,61 +99,61 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
||||
|
||||
for( AudioPacket packet: packets )
|
||||
{
|
||||
int source = packet.getAudioMetadata().getSource();
|
||||
/* Don't process any packet's marked as do not monitor */
|
||||
if( !packet.getAudioMetadata().isDoNotMonitor() )
|
||||
{
|
||||
int source = packet.getAudioMetadata().getSource();
|
||||
|
||||
if( packet.getType() == AudioPacket.Type.END )
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Existing channel assignment */
|
||||
if( mChannelAssignments.containsKey( source ) )
|
||||
if( packet.getType() != AudioPacket.Type.END )
|
||||
{
|
||||
mChannelAssignments.get( source ).getAudioOutput()
|
||||
.receive( packet );
|
||||
}
|
||||
/* Start a new channel assignment */
|
||||
else if( !mAvailableAudioOutputs.isEmpty() )
|
||||
{
|
||||
AudioOutput channel = mAvailableAudioOutputs.remove( 0 );
|
||||
|
||||
mChannelAssignments.put( packet.getAudioMetadata().getSource(),
|
||||
new AudioChannelAssignment( channel, packet.getAudioMetadata().getPriority() ) );
|
||||
|
||||
updateLowestPriorityAssignment();
|
||||
|
||||
channel.receive( packet );
|
||||
}
|
||||
/* Override the lowest priority assignment */
|
||||
else
|
||||
{
|
||||
if( mLowestPrioritySource > -1 )
|
||||
/* Existing channel assignment */
|
||||
if( mChannelAssignments.containsKey( source ) )
|
||||
{
|
||||
int priority = packet.getAudioMetadata().getPriority();
|
||||
|
||||
if( packet.getAudioMetadata().isSelected() ||
|
||||
priority < mChannelAssignments
|
||||
.get( mLowestPrioritySource ).getPriority() )
|
||||
mChannelAssignments.get( source ).getAudioOutput()
|
||||
.receive( packet );
|
||||
}
|
||||
/* Start a new channel assignment */
|
||||
else if( !mAvailableAudioOutputs.isEmpty() )
|
||||
{
|
||||
AudioOutput channel = mAvailableAudioOutputs.remove( 0 );
|
||||
|
||||
mChannelAssignments.put( packet.getAudioMetadata().getSource(),
|
||||
new AudioChannelAssignment( channel, packet.getAudioMetadata().getPriority() ) );
|
||||
|
||||
updateLowestPriorityAssignment();
|
||||
|
||||
channel.receive( packet );
|
||||
}
|
||||
/* Override the lowest priority assignment */
|
||||
else
|
||||
{
|
||||
if( mLowestPrioritySource > -1 )
|
||||
{
|
||||
AudioChannelAssignment assignment =
|
||||
mChannelAssignments.remove( mLowestPrioritySource );
|
||||
|
||||
if( assignment != null )
|
||||
{
|
||||
assignment.setPriority( priority );
|
||||
int priority = packet.getAudioMetadata().getPriority();
|
||||
|
||||
int overrideSource = packet.getAudioMetadata().getSource();
|
||||
|
||||
mChannelAssignments.put( overrideSource, assignment );
|
||||
|
||||
mLowestPrioritySource = overrideSource;
|
||||
|
||||
assignment.getAudioOutput().receive( packet );
|
||||
}
|
||||
else
|
||||
if( packet.getAudioMetadata().isSelected() ||
|
||||
priority < mChannelAssignments
|
||||
.get( mLowestPrioritySource ).getPriority() )
|
||||
{
|
||||
mLowestPrioritySource = -1;
|
||||
AudioChannelAssignment assignment =
|
||||
mChannelAssignments.remove( mLowestPrioritySource );
|
||||
|
||||
if( assignment != null )
|
||||
{
|
||||
assignment.setPriority( priority );
|
||||
|
||||
int overrideSource = packet.getAudioMetadata().getSource();
|
||||
|
||||
mChannelAssignments.put( overrideSource, assignment );
|
||||
|
||||
mLowestPrioritySource = overrideSource;
|
||||
|
||||
assignment.getAudioOutput().receive( packet );
|
||||
}
|
||||
else
|
||||
{
|
||||
mLowestPrioritySource = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,41 +113,47 @@ public class AudioMetadata implements Listener<Metadata>
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the recordable state, identifier and audio call priority levels */
|
||||
/* Reset recordable state, identifier and audio call priority levels
|
||||
* and reprocess the metadata */
|
||||
mRecordable = mSourceRecordable;
|
||||
setIdentifier( mSource );
|
||||
mPriority = Priority.DEFAULT_PRIORITY;
|
||||
|
||||
for( Metadata metadata: mMetadata )
|
||||
{
|
||||
if( metadata.hasAlias() )
|
||||
{
|
||||
Alias alias = metadata.getAlias();
|
||||
|
||||
if( metadata.getMetadataType() == MetadataType.FROM ||
|
||||
metadata.getMetadataType() == MetadataType.TO )
|
||||
{
|
||||
if( !alias.isRecordable() )
|
||||
{
|
||||
mRecordable = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( metadata.getMetadataType() == MetadataType.TO )
|
||||
{
|
||||
setIdentifier( mSource, metadata.getValue() );
|
||||
}
|
||||
|
||||
if( alias != null && alias.getCallPriority() < mPriority )
|
||||
{
|
||||
mPriority = alias.getCallPriority();
|
||||
}
|
||||
}
|
||||
processMetadata( metadata );
|
||||
}
|
||||
|
||||
mUpdated = true;
|
||||
}
|
||||
|
||||
private void processMetadata( Metadata metadata )
|
||||
{
|
||||
if( metadata.hasAlias() )
|
||||
{
|
||||
Alias alias = metadata.getAlias();
|
||||
|
||||
if( metadata.getMetadataType() == MetadataType.FROM ||
|
||||
metadata.getMetadataType() == MetadataType.TO )
|
||||
{
|
||||
if( !alias.isRecordable() )
|
||||
{
|
||||
mRecordable = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( metadata.getMetadataType() == MetadataType.TO )
|
||||
{
|
||||
setIdentifier( mSource, metadata.getValue() );
|
||||
}
|
||||
|
||||
if( alias != null && alias.getCallPriority() < mPriority )
|
||||
{
|
||||
mPriority = alias.getCallPriority();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this audio metadata contains updated information. The flag
|
||||
* will only be set when new data is added and will be reset by a copyOf()
|
||||
@@ -177,27 +183,7 @@ public class AudioMetadata implements Listener<Metadata>
|
||||
else
|
||||
{
|
||||
mMetadata.add( metadata );
|
||||
|
||||
if( metadata.hasAlias() )
|
||||
{
|
||||
Alias alias = metadata.getAlias();
|
||||
|
||||
/* Capture non-recordable aliases */
|
||||
if( metadata.getMetadataType() == MetadataType.FROM ||
|
||||
metadata.getMetadataType() == MetadataType.TO )
|
||||
{
|
||||
if( !alias.isRecordable() )
|
||||
{
|
||||
mRecordable = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Capture call priority levels from aliases */
|
||||
if( alias.getCallPriority() < mPriority )
|
||||
{
|
||||
mPriority = alias.getCallPriority();
|
||||
}
|
||||
}
|
||||
processMetadata( metadata );
|
||||
}
|
||||
|
||||
mUpdated = true;
|
||||
@@ -247,23 +233,24 @@ public class AudioMetadata implements Listener<Metadata>
|
||||
* Sets the priority of this audio packet within the defined min/max priority range */
|
||||
public void setPriority( int priority )
|
||||
{
|
||||
assert( Priority.MIN_PRIORITY <= priority && priority <= Priority.MAX_PRIORITY );
|
||||
|
||||
mPriority = priority;
|
||||
|
||||
mUpdated = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the priority of this audio packet or a priority of -1 if the
|
||||
* audio source is currently selected, so that the priority of this packet
|
||||
* is higher (lower?) than any other audio source
|
||||
* Returns the priority of this audio metadata
|
||||
*
|
||||
* @return - priority of audio packet where lower numbers are higher priority
|
||||
*/
|
||||
public int getPriority()
|
||||
{
|
||||
return mSelected ? -1 : mPriority;
|
||||
return mPriority;
|
||||
}
|
||||
|
||||
public boolean isDoNotMonitor()
|
||||
{
|
||||
return mPriority == Priority.DO_NOT_MONITOR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user