public class ClipProcess extends SpectrogramMarkProcess
Modifier and Type | Class and Description |
---|---|
class |
ClipProcess.ClipBlockProcess |
class |
ClipProcess.ClipRequest
Data needed for a clip request.
|
MOUSE_DOWN, MOUSE_DRAG, MOUSE_UP
Constructor and Description |
---|
ClipProcess(ClipControl clipControl) |
Modifier and Type | Method and Description |
---|---|
boolean |
canMark() |
java.io.File |
findClipFile(ClipDataUnit clipDataUnit)
Find the wav file to go with a particular clip
|
boolean |
flushDataBlockBuffers(long maxWait)
Work through all the output datablocks and wait for their
internal buffers to flush through.
|
ClipControl |
getClipControl() |
ClipDataBlock |
getClipDataBlock() |
ClipSpectrogramMarkDataBlock |
getClipSpectrogramMarkDataBlock() |
long |
getRequiredDataHistory(PamObservable o,
java.lang.Object arg) |
void |
masterClockUpdate(long timeMilliseconds,
long sampleNumber) |
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 |
prepareProcess()
Called for each process before any of them receive the PamStart command
|
void |
processNewBuoyData(BuoyStatusDataUnit buoyStatusDataUnit,
PamDataUnit pamDataUnit) |
boolean |
spectrogramNotification(SpectrogramDisplay display,
java.awt.event.MouseEvent mouseEvent,
int downUp,
int channel,
long startMilliseconds,
long duration,
double f1,
double f2)
Override this to process data from the marked spectrogram.
|
void |
subscribeDataBlocks()
Called at end of setup of after settings dialog to subscribe data blocks.
|
getMarkObserverName, pamStop
absMillisecondsToSamples, absSamplesToMilliseconds, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, fillXMLElement, getAncestorDataBlock, getAnnotation, getChainPosition, getCpuPercent, getNumAnnotations, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOutputDataBlock, getOutputDataBlocks, getPamControlledUnit, getParentDataBlock, getParentProcess, getProcessName, getRawSourceDataBlock, getSampleRate, getSourceDataBlock, getSourceProcess, isCanMultiThread, makePamProcess, noteNewSettings, notifyModelChanged, relMillisecondsToSamples, relSamplesToMilliseconds, removeAllDataBlocks, removeObservable, removeOutputDatablock, resetDataBlocks, saveViewerData, setCanMultiThread, setParentDataBlock, setParentDataBlock, setProcessName, setSampleRate, setupProcess, toString, update, updateData
public ClipProcess(ClipControl clipControl)
public void newData(PamObservable o, PamDataUnit arg)
newData
in class PamProcess
public void masterClockUpdate(long timeMilliseconds, long sampleNumber)
masterClockUpdate
in interface PamObserver
masterClockUpdate
in class PamProcess
public void prepareProcess()
PamProcess
prepareProcess
in class PamProcess
public void pamStart()
PamProcess
pamStart
in class SpectrogramMarkProcess
public java.io.File findClipFile(ClipDataUnit clipDataUnit)
clipDataUnit
- data unit to find the file for.public boolean flushDataBlockBuffers(long maxWait)
PamProcess
This is used when stopping PAMGUARD to ensure that all data complete processing before anything else happens.
flushDataBlockBuffers
in class PamProcess
maxWait
- maxWait time in milliseconds.public long getRequiredDataHistory(PamObservable o, java.lang.Object arg)
getRequiredDataHistory
in interface PamObserver
getRequiredDataHistory
in class PamProcess
o
- PamObservable class requiring the dataarg
- optional argument from PamObservablepublic boolean spectrogramNotification(SpectrogramDisplay display, java.awt.event.MouseEvent mouseEvent, int downUp, int channel, long startMilliseconds, long duration, double f1, double f2)
SpectrogramMarkProcess
The spectrogram will have already ensured that Raw waveform data and FFT data that made the SpectrogramDisplay are still in memory and the data blocks can be accessed using
PamRawDataBlock rawDataBlock = (PamRawDataBlock) display.getSourceRawDataBlock();
and
PamDataBlock fftDataBlock = display.getSourceFFTDataBlock();
To obtain raw data, first convert the startMilliseconds and duration to sample numbers using
long startSample = absMillisecondsToSamples(startMilliseconds);
and
int numSamples = (int) relMillisecondsToSamples(duration);
then make a bitmap of the channels you wnat -
int channelMap;
channelMap = PamUtils.SetBit(0, channel, 1); // just the channel that had the mark
channelMap = rawDataBlock.getChannelMap(); // all channels in the raw data block
Then get teh samples from the raw data block ...
double[][] rawData = rawDataBlock.getSamples(startSample, numSamples, channelMap);
To get the FFT data, use PamDataUnit fftDataUnit;
int fftDataUnitIndex = fftDataBlock.getIndexOfFirstUnitAfter(startMilliseconds);
if (fftDataUnitIndex >= 0) while (fftDataUnitIndex < fftDataBlock.getUnitsCount()) {
fftDataUnit = fftDataBlock.getDataUnit(fftDataUnitIndex, PamDataBlock.REFERENCE_CURRENT);
if (fftDataUnit.timeMilliseconds + fftDataUnit.duration > startMilliseconds + duration) {
break;
}
// process that unit in any way you want, then get the next unit
fftDataUnitIndex ++;
}
Remember that the data units will contain one channel of fft data each and multiple channels may be interleaved.
spectrogramNotification
in interface SpectrogramMarkObserver
spectrogramNotification
in class SpectrogramMarkProcess
display
- spectrogram displaymouseEvent
- Full mouse event - allows more flexibility in user functionsdownUp
- 0 = mouse down, 1 = mouse up, 2 = drag + button number in upper 16 bits.channel
- channel numberstartMilliseconds
- start time in milliseconds.duration
- duration in milliseconds.f1
- min frequency in Hzf2
- max frequency in Hzpublic boolean canMark()
public void subscribeDataBlocks()
public ClipControl getClipControl()
public ClipDataBlock getClipDataBlock()
public ClipSpectrogramMarkDataBlock getClipSpectrogramMarkDataBlock()
public void processNewBuoyData(BuoyStatusDataUnit buoyStatusDataUnit, PamDataUnit pamDataUnit)
processNewBuoyData
in class PamProcess