diff --git a/dist/linux/stub b/dist/linux/stub index 11cac5e..0b4b577 100644 --- a/dist/linux/stub +++ b/dist/linux/stub @@ -5,6 +5,6 @@ java=java if test -n "$JAVA_HOME"; then java="$JAVA_HOME/bin/java" fi -java_args=-Xmx1g +java_args=-Xmx8g exec "$java" $java_args -jar $MYSELF "$@" exit 1 diff --git a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java index 1d7f75c..89a0b7a 100644 --- a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java +++ b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java @@ -2351,7 +2351,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener { book.save(); // Add the book to the tree - loadXMLBookStructure(new File(book.getLocation(), "audiobook.abx")); + loadXMLBookStructure(book.getLocation("audiobook.abx")); updateOpenBookList(); } catch (Exception ex) { ex.printStackTrace(); @@ -3240,8 +3240,8 @@ public class AudiobookRecorder extends JFrame implements DocumentListener { } newSentence.writeAudioData(startSamples); - newSentence.setPostGapType("continuation"); - newSentence.setPostGap(Options.getInteger("catenation.short-sentence")); + newSentence.setPostGapType("sentence"); + newSentence.setPostGap(Options.getInteger("catenation.post-sentence")); selectedSentence.writeAudioData(endSamples); selectedSentence.autoTrimSample(); diff --git a/src/uk/co/majenko/audiobookrecorder/Book.java b/src/uk/co/majenko/audiobookrecorder/Book.java index a1b179f..d8e38b4 100644 --- a/src/uk/co/majenko/audiobookrecorder/Book.java +++ b/src/uk/co/majenko/audiobookrecorder/Book.java @@ -502,6 +502,11 @@ public class Book extends BookTreeNode { return location; } + public File getLocation(String dir) { + Debug.trace(); + return new File(location, dir); + } + public void setLocation(File l) { Debug.trace(); location = l; diff --git a/src/uk/co/majenko/audiobookrecorder/Chapter.java b/src/uk/co/majenko/audiobookrecorder/Chapter.java index 4399bbb..8d7ea9c 100644 --- a/src/uk/co/majenko/audiobookrecorder/Chapter.java +++ b/src/uk/co/majenko/audiobookrecorder/Chapter.java @@ -172,12 +172,7 @@ public class Chapter extends BookTreeNode { Book book = getBook(); - File bookRoot = new File(Options.get("path.storage"), book.getName()); - if (!bookRoot.exists()) { - bookRoot.mkdirs(); - } - - File export = new File(bookRoot, "export"); + File export = book.getLocation("export"); if (!export.exists()) { export.mkdirs(); } diff --git a/src/uk/co/majenko/audiobookrecorder/Sentence.java b/src/uk/co/majenko/audiobookrecorder/Sentence.java index 911f847..7c4af50 100644 --- a/src/uk/co/majenko/audiobookrecorder/Sentence.java +++ b/src/uk/co/majenko/audiobookrecorder/Sentence.java @@ -235,6 +235,11 @@ public class Sentence extends BookTreeNode implements Cacheable { peak = Utils.s2d(Book.getTextNode(root, "peak", "-1.000")); isDetected = Utils.s2b(Book.getTextNode(root, "detected")); + if (sampleSize == 0) { + loadFile(); + autoTrimSample(); + } + gainPoints = new TreeMap(); Element gp = Book.getNode(root, "gainpoints"); if (gp != null) { @@ -580,7 +585,7 @@ public class Sentence extends BookTreeNode implements Cacheable { Debug.d("Get file for", id); Book book = getBook(); if (book == null) return null; - File b = new File(book.getLocation(), "files"); + File b = book.getLocation("files"); if (!b.exists()) { b.mkdirs(); } @@ -589,7 +594,7 @@ public class Sentence extends BookTreeNode implements Cacheable { public File getTempFile() { Debug.trace(); - File b = new File(getBook().getLocation(), "files"); + File b = getBook().getLocation("files"); if (!b.exists()) { b.mkdirs(); } @@ -2027,6 +2032,7 @@ public class Sentence extends BookTreeNode implements Cacheable { public double[] getWaveProfile() { if (waveProfile != null) return waveProfile; double[][] samples = getProcessedAudioData(); + if (samples[LEFT].length == 0) return null; waveProfile = new double[samples[LEFT].length]; double rt = 0;