diff --git a/src/main/java/io/github/dsheirer/channel/state/ChannelState.java b/src/main/java/io/github/dsheirer/channel/state/ChannelState.java index 2cfd78b5..c688035b 100644 --- a/src/main/java/io/github/dsheirer/channel/state/ChannelState.java +++ b/src/main/java/io/github/dsheirer/channel/state/ChannelState.java @@ -114,6 +114,8 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder @Override public void reset() { + getMutableMetadata().resetTemporalAttributes(); + broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE)); mState = State.IDLE; @@ -401,8 +403,6 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder { broadcast(SquelchState.SQUELCH); - getMutableMetadata().resetTemporalAttributes(); - mState = State.TEARDOWN; mMutableMetadata.receive(new AttributeChangeRequest(Attribute.CHANNEL_STATE, mState)); diff --git a/src/main/java/io/github/dsheirer/record/config/RecordConfiguration.java b/src/main/java/io/github/dsheirer/record/config/RecordConfiguration.java index 1cda4aa1..482687e0 100644 --- a/src/main/java/io/github/dsheirer/record/config/RecordConfiguration.java +++ b/src/main/java/io/github/dsheirer/record/config/RecordConfiguration.java @@ -1,20 +1,22 @@ -/******************************************************************************* - * SDR Trunk - * Copyright (C) 2014 Dennis Sheirer +/* + * ****************************************************************************** + * sdrtrunk + * Copyright (C) 2014-2018 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 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. + * 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 - ******************************************************************************/ + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * ***************************************************************************** + */ package io.github.dsheirer.record.config; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -24,32 +26,64 @@ import io.github.dsheirer.record.RecorderType; import java.util.ArrayList; import java.util.List; +/** + * Contains the types of recordings specified for a channel + */ public class RecordConfiguration extends Configuration { + /** + * Recording types requested for this configuration + */ private List mRecorders = new ArrayList<>(); + /** + * Constructs a recording configuration instance + */ public RecordConfiguration() { + //Empty constructor required for deserialization } + /** + * List of recorder types specified in this configuration + */ @JacksonXmlProperty(isAttribute = false, localName = "recorder") public List getRecorders() { return mRecorders; } + /** + * Sets the (complete) list of recorder types for this configuration, erasing any existing recording types. + */ public void setRecorders(List recorders) { mRecorders = recorders; } + /** + * Adds the recorder type to the configuration + */ public void addRecorder(RecorderType recorder) { mRecorders.add(recorder); } + /** + * Clears all recorder types from this configuration + */ public void clearRecorders() { mRecorders.clear(); } + + /** + * Indicates if this configuration has the specified recorder type + * @param recorderType to check + * @return true if this configuration contains the specified recorder type + */ + public boolean contains(RecorderType recorderType) + { + return mRecorders.contains(recorderType); + } } diff --git a/src/main/java/io/github/dsheirer/record/wave/AudioPacketWaveRecorder.java b/src/main/java/io/github/dsheirer/record/wave/AudioPacketWaveRecorder.java index 4f554a27..e810c1a1 100644 --- a/src/main/java/io/github/dsheirer/record/wave/AudioPacketWaveRecorder.java +++ b/src/main/java/io/github/dsheirer/record/wave/AudioPacketWaveRecorder.java @@ -32,6 +32,8 @@ import javax.sound.sampled.AudioFormat; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -54,6 +56,7 @@ public class AudioPacketWaveRecorder extends Module implements Listener mProcessorHandle; private Metadata mMetadata; private long mLastBufferReceived; + private List mAudioPacketsToProcess = new ArrayList<>(); private AtomicBoolean mRunning = new AtomicBoolean(); @@ -186,24 +189,24 @@ public class AudioPacketWaveRecorder extends Module implements Listener */ public E poll() { - return mQueue.poll(); + E element = mQueue.poll(); + + if(element != null) + { + mCounter.decrementAndGet(); + } + + return element; } /**