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:
Douglas Gillespie 2022-05-02 19:40:24 +01:00 committed by GitHub
parent d85d9078a1
commit 9f998165ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 10 deletions

View File

@ -6,7 +6,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </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> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

2
.gitignore vendored
View File

@ -36,3 +36,5 @@ target/WMM.COF
settings.xml settings.xml
.classpath .classpath
.classpath
.classpath

View File

@ -1,11 +1,11 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=16 org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=16 org.eclipse.jdt.core.compiler.source=11

View File

@ -397,7 +397,7 @@ public class PamUtils {
/** /**
* Force an angle to sit within some range. * Force an angle to sit within some range.
* @param angle input angle (radians) * @param angle input angle (radians)
* @param maxAngle maximum angle in degrees * @param maxAngle maximum angle in radians
* @return output angle (radians) * @return output angle (radians)
*/ */
static public double constrainedAngleR(double angle, double maxAngle) { static public double constrainedAngleR(double angle, double maxAngle) {

View File

@ -19,14 +19,23 @@ import java.io.IOException;
public class RawDataUtils { 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 dos Data output stream
* @param rawData raw data * @param rawData raw data
* @throws IOException * @throws IOException
*/ */
public void writeWaveClipInt8(DataOutputStream dos, double[][] rawData) throws IOException { public void writeWaveClipInt8(DataOutputStream dos, double[][] rawData) throws IOException {
int nChan = rawData.length; int nChan, nSamps;
int nSamps = rawData[0].length; 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; double minVal = 0, maxVal = 0;
for (int iC = 0; iC < nChan; iC++) { for (int iC = 0; iC < nChan; iC++) {
double[] chanData = rawData[iC]; double[] chanData = rawData[iC];
@ -36,7 +45,13 @@ public class RawDataUtils {
} }
} }
maxVal = Math.max(maxVal, -minVal); 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.writeShort(nChan);
dos.writeInt(nSamps); dos.writeInt(nSamps);
dos.writeFloat(scale); dos.writeFloat(scale);
@ -51,13 +66,17 @@ public class RawDataUtils {
/** /**
* Read a waveform clip in scaled int8 format from a data input stream * Read a waveform clip in scaled int8 format from a data input stream
* @param dis 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 * @throws IOException
*/ */
public double[][] readWavClipInt8(DataInputStream dis) throws IOException { public double[][] readWavClipInt8(DataInputStream dis) throws IOException {
int nChan = dis.readShort(); int nChan = dis.readShort();
int nSamps = dis.readInt(); int nSamps = dis.readInt();
double scale = 1./dis.readFloat(); double scale = 1./dis.readFloat();
if (nChan == 0 || nSamps == 0) {
return null;
}
double[][] rawData = new double[nChan][nSamps]; double[][] rawData = new double[nChan][nSamps];
for (int iC = 0; iC < nChan; iC++) { for (int iC = 0; iC < nChan; iC++) {
double[] chanData = rawData[iC]; double[] chanData = rawData[iC];