SoundRecorder
Class RecorderProcess

java.lang.Object
  extended by PamguardMVC.PamProcess
      extended by SoundRecorder.RecorderProcess
All Implemented Interfaces:
Annotator, PamObserver

public class RecorderProcess
extends PamProcess

Process raw audio data prior to storage. Raw data blocks only contain one channel of data each. RecorderProcess stacks up the data from all channels before passing it on the the RecorderStorage

Author:
Doug
See Also:
RecorderStorage, RecorderControl

Field Summary
(package private)  java.lang.String actionTrigger
           
(package private)  int collectedChannels
           
private  boolean dataComing
          Data flowing in from source (i.e.
(package private)  int grabBuffer
          Flag that when recording starts the buffer should be grabbed and inserted at the start of the recording.
private  long lastRecordedSample
           
(package private)  RecorderControl recorderControl
           
(package private)  PamDataBlock<RecorderDataUnit> recordingData
           
(package private)  RecordingInfo recordingInfo
           
(package private)  long sampleStartTime
           
(package private)  double[][] soundData
           
 
Fields inherited from class PamguardMVC.PamProcess
outputDataBlocks, processName, sampleRate
 
Constructor Summary
RecorderProcess(RecorderControl recorderControl)
           
 
Method Summary
 long getRequiredDataHistory(PamObservable o, java.lang.Object arg)
           
 boolean isDataComing()
           
 void newData(PamObservable o, PamDataUnit arg)
           
 void pamStart()
          Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway.
 void pamStop()
          Stops the process.
 void prepareProcess()
          Called for each process before any of them receive the PamStart command
private  void recordData(PamObservable o, RawDataUnit rawDataUnit)
           
private  boolean recordSoundData(long dataTimeMillis, double[][] soundData)
           
protected  void setRecordStatus(int status, java.lang.String actionTrigger)
           
 void setSampleRate(float sampleRate, boolean notify)
          New sample rate
private  boolean startRecording(boolean forceStart)
           
protected  boolean stopRecording()
           
protected  void storageClosed()
           
 
Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, fillXMLElement, fillXMLParameters, getAncestorDataBlock, getAnnotation, getBackendProcess, getChainPosition, getCpuPercent, getNumAnnotations, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOutputDataBlock, getPamControlledUnit, getParentDataBlock, getParentProcess, getProcessName, getRawSourceDataBlock, getSampleRate, getSourceDataBlock, getSourceProcess, isCanMultiThread, makePamProcess, masterClockUpdate, noteNewSettings, notifyModelChanged, relMillisecondsToSamples, relSamplesToMilliseconds, removeObservable, removeOutputDatablock, saveViewerData, setBackendProcess, setCanMultiThread, setParentDataBlock, setParentDataBlock, setProcessName, setupProcess, toString, update, updateData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

recorderControl

RecorderControl recorderControl

collectedChannels

int collectedChannels

sampleStartTime

long sampleStartTime

lastRecordedSample

private long lastRecordedSample

soundData

double[][] soundData

recordingInfo

RecordingInfo recordingInfo

recordingData

PamDataBlock<RecorderDataUnit> recordingData

dataComing

private boolean dataComing
Data flowing in from source (i.e. Pam Started)


grabBuffer

int grabBuffer
Flag that when recording starts the buffer should be grabbed and inserted at the start of the recording. If recording is already running, then this flag will have no effect. It is always cleared at the end of a recording. It's an integer value, so that different recorder triggers can demand different amounts of buffer.


actionTrigger

java.lang.String actionTrigger
Constructor Detail

RecorderProcess

public RecorderProcess(RecorderControl recorderControl)
Method Detail

getRequiredDataHistory

public long getRequiredDataHistory(PamObservable o,
                                   java.lang.Object arg)
Specified by:
getRequiredDataHistory in interface PamObserver
Overrides:
getRequiredDataHistory in class PamProcess
Parameters:
o - PamObservable class requiring the data
arg - optional argument from PamObservable
Returns:
time in milliseconds requried by data held in PamObservable

newData

public void newData(PamObservable o,
                    PamDataUnit arg)
Overrides:
newData in class PamProcess

recordData

private void recordData(PamObservable o,
                        RawDataUnit rawDataUnit)

recordSoundData

private boolean recordSoundData(long dataTimeMillis,
                                double[][] soundData)

setRecordStatus

protected void setRecordStatus(int status,
                               java.lang.String actionTrigger)

startRecording

private boolean startRecording(boolean forceStart)

stopRecording

protected boolean stopRecording()

storageClosed

protected void storageClosed()

setSampleRate

public void setSampleRate(float sampleRate,
                          boolean notify)
Description copied from interface: PamObserver
New sample rate

Specified by:
setSampleRate in interface PamObserver
Overrides:
setSampleRate in class PamProcess
notify - Notify other PamObservers and PamObservables in the chain.

prepareProcess

public void prepareProcess()
Description copied from class: PamProcess
Called for each process before any of them receive the PamStart command

Overrides:
prepareProcess in class PamProcess

pamStart

public void pamStart()
Description copied from class: PamProcess
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway.

Specified by:
pamStart in class PamProcess

pamStop

public void pamStop()
Description copied from class: PamProcess
Stops the process.

Specified by:
pamStop in class PamProcess

isDataComing

public boolean isDataComing()