update sud file management to more efficiently skip to the correct part

of a sud file when reading data offline.
This commit is contained in:
Douglas Gillespie 2023-10-26 14:44:41 +01:00
parent 60435e567a
commit fa5fe9943d
5 changed files with 101 additions and 80 deletions

View File

@ -4,7 +4,7 @@
<groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId>
<name>Pamguard Java12+</name>
<version>2.02.09</version>
<version>2.02.09b</version>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>
<organization>

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId>
<version>2.02.09a</version>
<version>2.02.09b</version>
<name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>
@ -782,14 +782,14 @@
<!-- not in Maven repository
you may need to copy files from your downloaded PAMGuard source code, e.g. C:\Users\*yourreposfolder*\source\repos\PAMGuardPAMGuard\repo\pamguard\org\x3\2.2.2 to
C:\Users\*yourusername*\.m2\repository\pamguard\org\x3\2.2.2
-->
C:\Users\*yourusername*\.m2\repository\pamguard\org\x3\2.2.2-->
<dependency>
<groupId>pamguard.org</groupId>
<artifactId>x3</artifactId>
<version>2.2.2</version>
<version>2.2.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/it.sauronsoftware/jave -->
<dependency>
<groupId>it.sauronsoftware</groupId>

View File

@ -14,6 +14,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
import org.codehaus.plexus.util.FileUtils;
import Acquisition.offlineFuncs.AquisitionLoadPoint;
import PamDetection.RawDataUnit;
//import PamUtils.CPUMonitor;
import PamguardMVC.PamDataBlock;
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
import dataMap.OfflineDataMap;
@ -70,9 +71,13 @@ public class WavAudioFile implements PamAudioFileLoader {
FileDataMapPoint mapPoint = offlineFileServer.findFirstMapPoint(mapIt, offlineDataLoadInfo.getStartMillis(), offlineDataLoadInfo.getEndMillis());
if (openSoundFile(mapPoint.getSoundFile()) == false) {
System.out.println("Could not open .wav sound file " + mapPoint.getSoundFile().getAbsolutePath());
System.out.println("Could not open sound file " + mapPoint.getSoundFile().getAbsolutePath());
return false;
}
if (offlineDataLoadInfo.cancel) {
return false;
}
File soundFile;
ByteConverter byteConverter = ByteConverter.createByteConverter(audioFormat);
@ -106,7 +111,11 @@ public class WavAudioFile implements PamAudioFileLoader {
try {
//System.out.println("Skipped " + skipped+ " " + skipBytes + " " + audioInputStream.available());
// CPUMonitor cpuMonitor = new CPUMonitor();
// cpuMonitor.start();
skipped = audioInputStream.skip(skipBytes);
// cpuMonitor.stop();
// System.out.println(cpuMonitor.getSummary("Sound skip: " + skipBytes + " bytes "));
//System.out.println("Offline " + (offlineDataLoadInfo.getStartMillis()-currentTime) + " ms : frame size: " + audioFormat.getFrameSize());
} catch (IOException e) {

View File

@ -31,7 +31,7 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f'
*/
static public final String version = "2.02.09a";
static public final String version = "2.02.09b";
/**
* Release date

View File

@ -259,10 +259,13 @@ public class OfflineDataLoading<T extends PamDataUnit> {
* @param que
*/
public void cancelDataOrder(boolean que) {
// threadMessage("Calling cancelDataOrder");
synchronized (orderLock) {
// threadMessage("cancelDataOrder is in synchronized oderLock");
if (orderData != null) {
try {
orderData.cancelOrder();
boolean isCancelled = orderData.cancelOrder();
// threadMessage("candelDataOrder returned: isCancelled = " + isCancelled);
}
catch (NullPointerException e) {
System.err.println("Null pointer in Cancel data order " + e.getMessage());
@ -319,16 +322,19 @@ public class OfflineDataLoading<T extends PamDataUnit> {
@Override
protected Integer doInBackground() {
// threadMessage("Start background");
try {
// System.out.println("Enter get offline data " + pamDataBlock.getDataName() + " Thread " + Thread.currentThread().getName());
clearAllFFTBlocks();
// threadMessage("Called clearAllFTBlocks");
int ans = getOfflineData(offlineDataInfo);
// System.out.println("Leave get offline data " + pamDataBlock.getDataName());
if (this == orderData) {
orderData = null;
}
// threadMessage("End background exit code " + ans);
return ans;
}
catch (Exception e) {
@ -338,9 +344,9 @@ public class OfflineDataLoading<T extends PamDataUnit> {
}
return 0;
}
}
@Override
protected void done() {
if (this == orderData) {
@ -394,6 +400,12 @@ public class OfflineDataLoading<T extends PamDataUnit> {
}
// private void threadMessage(String message) {
// String name = Thread.currentThread().getName();
// String now = PamCalendar.formatDBDateTime(System.currentTimeMillis(), true);
// System.out.printf("Thread %s load for %s at %s: %s\n", name, pamDataBlock.getDataName(), now, message);
// }
private void launchQuedReloadThread(){
// System.out.println(" launchQuedReloadThread(): ");
if (waitingDataLoads.size()>=1){