|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPamguardMVC.PamProcess
Spectrogram.SpectrogramMarkProcess
clipgenerator.ClipProcess
public class ClipProcess
| Field Summary |
|---|
| Fields inherited from class PamguardMVC.PamProcess |
|---|
outputDataBlocks, processName, sampleRate |
| Fields inherited from interface Spectrogram.SpectrogramMarkObserver |
|---|
MOUSE_DOWN, MOUSE_UP |
| Constructor Summary | |
|---|---|
ClipProcess(PamControlledUnit pamControlledUnit)
|
|
| Method Summary | |
|---|---|
void |
spectrogramNotification(SpectrogramDisplay display,
int downUp,
int channel,
long startMilliseconds,
long duration,
double f1,
double f2)
Override this to process data from the marked spectrogram. |
| Methods inherited from class Spectrogram.SpectrogramMarkProcess |
|---|
getMarkObserverName, pamStart, pamStop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ClipProcess(PamControlledUnit pamControlledUnit)
| Method Detail |
|---|
public void spectrogramNotification(SpectrogramDisplay display,
int downUp,
int channel,
long startMilliseconds,
long duration,
double f1,
double f2)
SpectrogramMarkProcessThe 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 SpectrogramMarkObserverspectrogramNotification in class SpectrogramMarkProcess
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||