mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
Updates to support ContactCollator plugin (#33)
* Change synchronization on RawDataTransforms soit uses the owner data holder, not itself for synchronization. Otherwise you get thread locks. * fix problem in SummaryComand * Update command line options * Change synchronization on RawDataTransforms soit uses the owner data holder, not itself for synchronization. Otherwise you get thread locks. * Update command line options * Update DecimatorParams.java * couple of updates to support new contact collator plugin * Sorting out sample rate info in clip display to support Contact Collator plugin * FLAC Speed Improve flac speed * Update .gitignore * Update .gitignore * Updates to support new features in Contact Collator * Small update to RawDatautils to handle null data
This commit is contained in:
parent
d85d9078a1
commit
9f998165ee
@ -6,7 +6,7 @@
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java 17">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -36,3 +36,5 @@ target/WMM.COF
|
||||
|
||||
settings.xml
|
||||
.classpath
|
||||
.classpath
|
||||
.classpath
|
||||
|
@ -1,11 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
|
||||
org.eclipse.jdt.core.compiler.compliance=16
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=16
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -397,7 +397,7 @@ public class PamUtils {
|
||||
/**
|
||||
* Force an angle to sit within some range.
|
||||
* @param angle input angle (radians)
|
||||
* @param maxAngle maximum angle in degrees
|
||||
* @param maxAngle maximum angle in radians
|
||||
* @return output angle (radians)
|
||||
*/
|
||||
static public double constrainedAngleR(double angle, double maxAngle) {
|
||||
|
@ -19,14 +19,23 @@ import java.io.IOException;
|
||||
public class RawDataUtils {
|
||||
|
||||
/**
|
||||
* Write the wave clip in scaled int8 format into a data output stream.
|
||||
* Write the wave clip in scaled int8 format into a data output stream. If rawData is null
|
||||
* or empty, it will still write the header consisting of nChan, nSamp and a scale, but no
|
||||
* data.
|
||||
* @param dos Data output stream
|
||||
* @param rawData raw data
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeWaveClipInt8(DataOutputStream dos, double[][] rawData) throws IOException {
|
||||
int nChan = rawData.length;
|
||||
int nSamps = rawData[0].length;
|
||||
int nChan, nSamps;
|
||||
if (rawData == null || rawData.length == 0 || rawData[0] == null) {
|
||||
nChan = 0;
|
||||
nSamps = 0;
|
||||
}
|
||||
else {
|
||||
nChan = rawData.length;
|
||||
nSamps = rawData[0].length;
|
||||
}
|
||||
double minVal = 0, maxVal = 0;
|
||||
for (int iC = 0; iC < nChan; iC++) {
|
||||
double[] chanData = rawData[iC];
|
||||
@ -36,7 +45,13 @@ public class RawDataUtils {
|
||||
}
|
||||
}
|
||||
maxVal = Math.max(maxVal, -minVal);
|
||||
float scale = (float) (127./maxVal);
|
||||
float scale;
|
||||
if (maxVal == 0) {
|
||||
scale = 1.f;
|
||||
}
|
||||
else {
|
||||
scale = (float) (127./maxVal);
|
||||
}
|
||||
dos.writeShort(nChan);
|
||||
dos.writeInt(nSamps);
|
||||
dos.writeFloat(scale);
|
||||
@ -51,13 +66,17 @@ public class RawDataUtils {
|
||||
/**
|
||||
* Read a waveform clip in scaled int8 format from a data input stream
|
||||
* @param dis data input stream
|
||||
* @return waveform double array
|
||||
* @return waveform double array or null if nChan or nSamps was zero (implying an empty array
|
||||
* was written in the fist place)
|
||||
* @throws IOException
|
||||
*/
|
||||
public double[][] readWavClipInt8(DataInputStream dis) throws IOException {
|
||||
int nChan = dis.readShort();
|
||||
int nSamps = dis.readInt();
|
||||
double scale = 1./dis.readFloat();
|
||||
if (nChan == 0 || nSamps == 0) {
|
||||
return null;
|
||||
}
|
||||
double[][] rawData = new double[nChan][nSamps];
|
||||
for (int iC = 0; iC < nChan; iC++) {
|
||||
double[] chanData = rawData[iC];
|
||||
|
Loading…
Reference in New Issue
Block a user