checking nan sample rate in ST Click detector

This commit is contained in:
Douglas Gillespie 2023-04-19 09:07:54 +01:00
parent 57bae3c39c
commit 73282b9a71
3 changed files with 23 additions and 0 deletions

View File

@ -2078,6 +2078,9 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
/* /*
* Doesnt notify it's own parent to avoid an infinite loop * Doesnt notify it's own parent to avoid an infinite loop
*/ */
if (Float.isNaN(sampleRate)) {
System.out.println("NaN sample rate being set in " + getLongDataName());
}
if (notify) { if (notify) {
for (int i = 0; i < countObservers(); i++) { for (int i = 0; i < countObservers(); i++) {
if (getPamObserver(i).getObserverObject() != parentProcess) { if (getPamObserver(i).getObserverObject() != parentProcess) {

View File

@ -28,6 +28,7 @@ import java.awt.Component;
import Acquisition.AcquisitionControl; import Acquisition.AcquisitionControl;
import Acquisition.DaqSystem; import Acquisition.DaqSystem;
import PamController.PamControlledUnitSettings;
/** /**
* @author SCANS * @author SCANS
@ -102,6 +103,18 @@ public class STAcquisitionControl extends AcquisitionControl {
return stDaqSystem; return stDaqSystem;
} }
@Override
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
// TODO Auto-generated method stub
boolean ok = super.restoreSettings(pamControlledUnitSettings);
if (Float.isNaN(this.getAcquisitionParameters().sampleRate)) {
System.out.println("Nan sample rate read back in sound trap data control. ");
this.getAcquisitionParameters().sampleRate = 384000.f;
}
return ok;
}
} }

View File

@ -87,6 +87,12 @@ public class STAcquisitionProcess extends AcquisitionProcess {
} }
} }
} }
@Override
public float getSampleRate() {
float fs = super.getSampleRate();
return fs;
}
@Override @Override
/** /**
@ -150,6 +156,7 @@ public class STAcquisitionProcess extends AcquisitionProcess {
public boolean isStalled() { public boolean isStalled() {
return false; return false;
} }