diff --git a/ExampleExportProfiles/librivox-noinit.abprof b/ExampleExportProfiles/librivox-noinit.abprof
new file mode 100644
index 0000000..3b675b2
--- /dev/null
+++ b/ExampleExportProfiles/librivox-noinit.abprof
@@ -0,0 +1,21 @@
+
+ librivox-noinit
+ LibriVox.org (Without initials)
+
+ 128000
+ 1
+ 44100
+ {chapter.name:lower}_{book.author.short:lower}_{file.bitrate.kb}kb
+
+
+ 500
+ 5000
+ 400
+ 100
+ 1000
+ 1200
+
+
+
diff --git a/ExampleExportProfiles/librivox-spc.abprof b/ExampleExportProfiles/librivox-spc.abprof
new file mode 100644
index 0000000..b234b2d
--- /dev/null
+++ b/ExampleExportProfiles/librivox-spc.abprof
@@ -0,0 +1,21 @@
+
+ librivox-spc
+ LibriVox.org Short Poetry Collection
+
+ 128000
+ 1
+ 44100
+ {book.title:lower}_{chapter.name:lower}_{narrator.initials:lower}_{file.bitrate.kb}kb
+
+
+ 500
+ 5000
+ 400
+ 100
+ 1000
+ 1200
+
+
+
diff --git a/ExampleExportFilters/librivox.abprof b/ExampleExportProfiles/librivox.abprof
similarity index 100%
rename from ExampleExportFilters/librivox.abprof
rename to ExampleExportProfiles/librivox.abprof
diff --git a/src/uk/co/majenko/audiobookrecorder/Book.java b/src/uk/co/majenko/audiobookrecorder/Book.java
index 02252fe..e4f7b9f 100644
--- a/src/uk/co/majenko/audiobookrecorder/Book.java
+++ b/src/uk/co/majenko/audiobookrecorder/Book.java
@@ -252,8 +252,11 @@ public class Book extends BookTreeNode {
public Chapter getChapter(int n) {
Debug.trace();
- if (n == 0) return null;
- return (Chapter)getChildAt(n);
+ Object o = getChildAt(n);
+ if (o instanceof Chapter) {
+ return (Chapter)o;
+ }
+ return null;
}
public Chapter addChapter() {
diff --git a/src/uk/co/majenko/audiobookrecorder/Chapter.java b/src/uk/co/majenko/audiobookrecorder/Chapter.java
index dfcc8c1..32a991c 100644
--- a/src/uk/co/majenko/audiobookrecorder/Chapter.java
+++ b/src/uk/co/majenko/audiobookrecorder/Chapter.java
@@ -100,7 +100,7 @@ public class Chapter extends BookTreeNode {
public int getSequenceNumber() {
Book book = getBook();
- int i = 1;
+ int i = 0;
while (true) {
Chapter c = book.getChapter(i);
if (c == null) {
diff --git a/src/uk/co/majenko/audiobookrecorder/Sentence.java b/src/uk/co/majenko/audiobookrecorder/Sentence.java
index b94d54b..65fb685 100644
--- a/src/uk/co/majenko/audiobookrecorder/Sentence.java
+++ b/src/uk/co/majenko/audiobookrecorder/Sentence.java
@@ -106,7 +106,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
double[] waveProfile = null;
- TreeMap gainPoints = null;
+ TreeMap gainPoints = new TreeMap();
RecordingThread recordingThread;
@@ -241,7 +241,6 @@ public class Sentence extends BookTreeNode implements Cacheable {
autoTrimSample();
}
- gainPoints = new TreeMap();
Element gp = Book.getNode(root, "gainpoints");
if (gp != null) {
NodeList points = gp.getElementsByTagName("gainpoint");
@@ -1901,16 +1900,10 @@ public class Sentence extends BookTreeNode implements Cacheable {
public TreeMap getGainPoints() {
Debug.trace();
- if (gainPoints == null) {
- gainPoints = new TreeMap();
- }
return gainPoints;
}
public void addGainPoint(Integer loc, Double g) {
- if (gainPoints == null) {
- gainPoints = new TreeMap();
- }
gainPoints.put(loc, g);
refreshAllData();
}
@@ -1925,10 +1918,6 @@ public class Sentence extends BookTreeNode implements Cacheable {
}
public void adjustGainPoint(Integer loc, Double adj, boolean reload) {
- if (gainPoints == null) {
- gainPoints = new TreeMap();
- return;
- }
Double gp = gainPoints.get(loc);
if (gp == null) return;
gp += adj;
@@ -2048,10 +2037,11 @@ public class Sentence extends BookTreeNode implements Cacheable {
final int window = 500;
- public double[] getWaveProfile() {
+ public synchronized double[] getWaveProfile() {
if (waveProfile != null) return waveProfile;
double[][] samples = getProcessedAudioData();
if (samples[LEFT].length == 0) return null;
+ System.out.println(String.format("Sample length: %d", samples[LEFT].length));
waveProfile = new double[samples[LEFT].length];
double rt = 0;