mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-11 08:07:24 -05:00
* WIP - Adds support for aliasing P25 Phase 2 tones.Playlist editor - adds editor support for alias actions * Playlist editor implementation and integration into application is complete. Adds JavaFX window monitoring to persist window size/location across application runs. Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
@@ -118,6 +118,15 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
return mProcessingChains.containsKey(channel) && mProcessingChains.get(channel).isProcessing();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if any channels are currently processing.
|
||||
* @return true if channels are processing.
|
||||
*/
|
||||
public boolean isProcessing()
|
||||
{
|
||||
return !mProcessingChains.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current processing chain associated with the channel, or
|
||||
* null if a processing chain is not currently setup for the channel
|
||||
@@ -164,38 +173,52 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
case REQUEST_ENABLE:
|
||||
if(!isProcessing(channel))
|
||||
{
|
||||
startProcessing(event);
|
||||
try
|
||||
{
|
||||
startProcessing(event);
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error starting requested channel [" + channel.getName() + "] - " + ce.getMessage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case REQUEST_DISABLE:
|
||||
if(channel.isProcessing())
|
||||
{
|
||||
switch(channel.getChannelType())
|
||||
try
|
||||
{
|
||||
case STANDARD:
|
||||
stopProcessing(channel, true);
|
||||
break;
|
||||
case TRAFFIC:
|
||||
//Don't remove traffic channel processing chains
|
||||
//until explicitly deleted, so that we can reuse them
|
||||
stopProcessing(channel, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch(channel.getChannelType())
|
||||
{
|
||||
case STANDARD:
|
||||
stopProcessing(channel, true);
|
||||
break;
|
||||
case TRAFFIC:
|
||||
//Don't remove traffic channel processing chains
|
||||
//until explicitly deleted, so that we can reuse them
|
||||
stopProcessing(channel, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error stopping channel [" + channel.getName() + "] - " + ce.getMessage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NOTIFICATION_DELETE:
|
||||
if(channel.isProcessing())
|
||||
{
|
||||
stopProcessing(channel, true);
|
||||
}
|
||||
break;
|
||||
case NOTIFICATION_CONFIGURATION_CHANGE:
|
||||
if(isProcessing(channel))
|
||||
{
|
||||
stopProcessing(channel, true);
|
||||
startProcessing(event);
|
||||
try
|
||||
{
|
||||
stopProcessing(channel, true);
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error stopping deleted channel [" + channel.getName() + "] - " + ce.getMessage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -203,12 +226,32 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the specified channel.
|
||||
* @param channel to start
|
||||
* @throws ChannelException if the channel can't be started
|
||||
*/
|
||||
public void start(Channel channel) throws ChannelException
|
||||
{
|
||||
startProcessing(new ChannelEvent(channel, ChannelEvent.Event.REQUEST_ENABLE));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the specified channel
|
||||
* @param channel to stop
|
||||
*/
|
||||
public void stop(Channel channel) throws ChannelException
|
||||
{
|
||||
stopProcessing(channel, !channel.isTrafficChannel());
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a channel/processing chain
|
||||
*
|
||||
* @param event that requested the channel start
|
||||
*/
|
||||
private void startProcessing(ChannelEvent event)
|
||||
private void startProcessing(ChannelEvent event) throws ChannelException
|
||||
{
|
||||
Channel channel = event.getChannel();
|
||||
|
||||
@@ -217,7 +260,7 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
//If we're already processing, ignore the request
|
||||
if(processingChain != null && processingChain.isProcessing())
|
||||
{
|
||||
return;
|
||||
throw new ChannelException("Channel is already playing");
|
||||
}
|
||||
|
||||
//Ensure that we can get a source before we construct a new processing chain
|
||||
@@ -240,7 +283,7 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
mChannelEventBroadcaster.broadcast(new ChannelEvent(channel,
|
||||
ChannelEvent.Event.NOTIFICATION_PROCESSING_START_REJECTED, TUNER_UNAVAILABLE_DESCRIPTION));
|
||||
|
||||
return;
|
||||
throw new ChannelException("No Tuner Available");
|
||||
}
|
||||
|
||||
if(processingChain == null)
|
||||
@@ -277,8 +320,17 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
|
||||
if(toShutdown != null)
|
||||
{
|
||||
mLog.info("Channel source error detected - stopping channel [" + toShutdown.getName() + "]");
|
||||
stopProcessing(toShutdown, true);
|
||||
mLog.warn("Channel source error detected - stopping channel [" + toShutdown.getName() + "]");
|
||||
|
||||
try
|
||||
{
|
||||
stopProcessing(toShutdown, true);
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error stopping channel [" + channel.getName() + "] with source error - " +
|
||||
ce.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -380,7 +432,7 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
* @param channel to stop
|
||||
* @param remove set to true to remove the associated processing chain.
|
||||
*/
|
||||
private void stopProcessing(Channel channel, boolean remove)
|
||||
private void stopProcessing(Channel channel, boolean remove) throws ChannelException
|
||||
{
|
||||
channel.setProcessing(false);
|
||||
|
||||
@@ -412,6 +464,10 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
processingChain.dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ChannelException("Channel is not currently playing");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -423,7 +479,14 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
|
||||
for(Channel channel : channelsToStop)
|
||||
{
|
||||
stopProcessing(channel, true);
|
||||
try
|
||||
{
|
||||
stopProcessing(channel, true);
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error stopping channel [" + channel.getName() + "] - " + ce.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user