This commit is contained in:
Douglas Gillespie 2023-06-09 12:28:29 +01:00
commit b0a063004e
3 changed files with 30 additions and 15 deletions

View File

@ -104,9 +104,13 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
boolean ans = super.prepareInputFile();
if (ans == false && ++currentFile < allFiles.size()) {
System.out.println("Failed to open sound file. Try again with file " + allFiles.get(currentFile).getName());
/*
* jumping striaght to the next file messes it up if it thinks the files
* are continuous, so we HAVE to stop and restart.
*/
// return prepareInputFile();
PamController.getInstance().pamStop();
PamController.getInstance().startLater();
PamController.getInstance().startLater(false);
}
return ans;
}
@ -648,7 +652,17 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
}
setFolderProgress();
// sayEta();
ans = prepareInputFile();
/*
* I think that here, we just need a check of the file. the prepareInputFile in
* this class will (on failure) move straight to the next file and also issue a
* stop/start, which is not good if it's trying a continuous file, where this is
* being called, if false is returned it should manage moving onto the next file by
* itself if we use the super.prep ....
*/
ans = super.prepareInputFile();
if (ans == false) {
return false;
}
currentFileStart = System.currentTimeMillis();
// if (ans && audioFormat.getSampleRate() != currentSampleRate && currentFile > 0) {
// acquisitionControl.getDaqProcess().setSampleRate(currentSampleRate = audioFormat.getSampleRate(), true);

View File

@ -48,9 +48,9 @@ public class SudAudioFile extends WavAudioFile {
}
// don't do anything and it will try the built in Audiosystem
catch (UnsupportedAudioFileException e) {
System.err.println("Could not open sud file: not a supported file " + soundFile.getName());
e.printStackTrace();
System.err.println("UnsupportedAudioFileException: Could not open sud file: not a supported file " + soundFile.getName());
System.err.println(e.getMessage());
// e.printStackTrace();
} catch (IOException e) {
System.err.println("Could not open sud file: IO Exception: " + soundFile.getName());

View File

@ -46,7 +46,8 @@ public class SudAudioFileReader {
try {
sudAudioInputStream = SudAudioInputStream.openInputStream(file, sudParams, false);
} catch (Exception e) {
e.printStackTrace();
String msg = String.format("Corrupt sud file %s: %s", file.getName(), e.getMessage());
throw new UnsupportedAudioFileException(msg);
}
return sudAudioInputStream;
}