Merge pull request #43 from PAMGuard/main

update from main
This commit is contained in:
Douglas Gillespie 2023-05-12 15:38:04 +01:00 committed by GitHub
commit 508ca524e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 1 deletions

View File

@ -861,7 +861,19 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
long[] allFileStarts = new long[allFiles.size()];
for (int i = 0; i < allFiles.size(); i++) {
allFileStarts[i] = getFileStartTime(allFiles.get(i).getAbsoluteFile());
if (allFileStarts[i] < firstFileStart) {
// System.out.printf("Swap first file from %s to %s\n", firstFile.getName(), allFiles.get(i).getName());
firstFile = allFiles.get(i);
firstFileStart = allFileStarts[i];
}
if (allFileStarts[i] > lastFileEnd) {
// System.out.printf("Swap last file from %s to %s\n", lastFile.getName(), allFiles.get(i).getName());
lastFile = allFiles.get(i);
lastFileEnd = allFileStarts[i] + (long) (lastFile.getDurationInSeconds()*1000.);
}
}
storeInfo.setFirstFileStart(firstFileStart); // just incase changed.
storeInfo.setLastFileEnd(lastFileEnd); // just incase changed
storeInfo.setFileStartTimes(allFileStarts);
}
return storeInfo;

View File

@ -75,6 +75,27 @@ public class InputStoreInfo {
public long[] getFileStartTimes() {
return fileStartTimes;
}
/**
* @param firstFileStart the firstFileStart to set
*/
public void setFirstFileStart(long firstFileStart) {
this.firstFileStart = firstFileStart;
}
/**
* @param lastFileStart the lastFileStart to set
*/
public void setLastFileStart(long lastFileStart) {
this.lastFileStart = lastFileStart;
}
/**
* @param lastFileEnd the lastFileEnd to set
*/
public void setLastFileEnd(long lastFileEnd) {
this.lastFileEnd = lastFileEnd;
}

View File

@ -127,7 +127,8 @@ public class NIFilePlayback implements FilePlaybackDevice, PamSettings {
@Override
public boolean preparePlayback(PlaybackParameters playbackParameters) {
if (niDeviceLUT == null || niDeviceLUT.length <= playbackParameters.deviceNumber) {
if (niDeviceLUT == null || niDeviceLUT.length <= playbackParameters.deviceNumber
|| playbackParameters.deviceNumber < 0) {
return false;
}
int bn = niDeviceLUT[playbackParameters.deviceNumber];