Improved book rendering in tree
This commit is contained in:
@@ -10,6 +10,7 @@ public class AGC implements Effect {
|
|||||||
double attack;
|
double attack;
|
||||||
|
|
||||||
public AGC(double c, double a, double d, double l) {
|
public AGC(double c, double a, double d, double l) {
|
||||||
|
Debug.trace();
|
||||||
ceiling = c;
|
ceiling = c;
|
||||||
attack = a;
|
attack = a;
|
||||||
decay = d;
|
decay = d;
|
||||||
@@ -18,14 +19,17 @@ public class AGC implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
Debug.trace();
|
||||||
return "AGC (Ceiling = " + ceiling + " attack = " + attack + " decay = " + decay + " limit = " + limit;
|
return "AGC (Ceiling = " + ceiling + " attack = " + attack + " decay = " + decay + " limit = " + limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Debug.trace();
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(double[][] samples) {
|
public void process(double[][] samples) {
|
||||||
|
Debug.trace();
|
||||||
gain = 1d;
|
gain = 1d;
|
||||||
for (int i = 0; i < samples[Sentence.LEFT].length; i++) {
|
for (int i = 0; i < samples[Sentence.LEFT].length; i++) {
|
||||||
double absSampleLeft = Math.abs(samples[Sentence.LEFT][i]) * gain;
|
double absSampleLeft = Math.abs(samples[Sentence.LEFT][i]) * gain;
|
||||||
@@ -55,14 +59,17 @@ public class AGC implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init(double sr) {
|
public void init(double sr) {
|
||||||
|
Debug.trace();
|
||||||
gain = 1d;
|
gain = 1d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dump() {
|
public void dump() {
|
||||||
|
Debug.trace();
|
||||||
System.out.println(toString());
|
System.out.println(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Effect> getChildEffects() {
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
Debug.trace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.awt.*;
|
|||||||
public class AboutPanel extends JPanel {
|
public class AboutPanel extends JPanel {
|
||||||
|
|
||||||
public AboutPanel() {
|
public AboutPanel() {
|
||||||
|
Debug.trace();
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
JLabel icon = new JLabel(Icons.appIcon);
|
JLabel icon = new JLabel(Icons.appIcon);
|
||||||
add(icon, BorderLayout.WEST);
|
add(icon, BorderLayout.WEST);
|
||||||
|
|||||||
@@ -5,21 +5,26 @@ import java.util.ArrayList;
|
|||||||
public class Amplifier implements Effect {
|
public class Amplifier implements Effect {
|
||||||
double gain;
|
double gain;
|
||||||
public Amplifier() {
|
public Amplifier() {
|
||||||
|
Debug.trace();
|
||||||
gain = 1.0d;
|
gain = 1.0d;
|
||||||
}
|
}
|
||||||
public Amplifier(double g) {
|
public Amplifier(double g) {
|
||||||
|
Debug.trace();
|
||||||
gain = g;
|
gain = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
Debug.trace();
|
||||||
return "Amplifier (" + gain + ")";
|
return "Amplifier (" + gain + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Effect> getChildEffects() {
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
Debug.trace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(double[][] samples) {
|
public void process(double[][] samples) {
|
||||||
|
Debug.trace();
|
||||||
for (int i = 0; i < samples[Sentence.LEFT].length; i++) {
|
for (int i = 0; i < samples[Sentence.LEFT].length; i++) {
|
||||||
samples[Sentence.LEFT][i] *= gain;
|
samples[Sentence.LEFT][i] *= gain;
|
||||||
samples[Sentence.RIGHT][i] *= gain;
|
samples[Sentence.RIGHT][i] *= gain;
|
||||||
@@ -27,21 +32,26 @@ public class Amplifier implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getGain() {
|
public double getGain() {
|
||||||
|
Debug.trace();
|
||||||
return gain;
|
return gain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGain(double g) {
|
public void setGain(double g) {
|
||||||
|
Debug.trace();
|
||||||
gain = g;
|
gain = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Debug.trace();
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dump() {
|
public void dump() {
|
||||||
|
Debug.trace();
|
||||||
System.out.println(toString());
|
System.out.println(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(double sf) {
|
public void init(double sf) {
|
||||||
|
Debug.trace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2244,13 +2244,14 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
ImageIcon i = new ImageIcon(cf.getAbsolutePath());
|
ImageIcon i = new ImageIcon(cf.getAbsolutePath());
|
||||||
Image ri = Utils.getScaledImage(i.getImage(), 22, 22);
|
Image ri = Utils.getScaledImage(i.getImage(), 22, 22);
|
||||||
book.setIcon(new ImageIcon(ri));
|
book.setIcon(new ImageIcon(ri));
|
||||||
bookTreeModel.reload(book);
|
} else {
|
||||||
|
book.setIcon(Icons.book);
|
||||||
}
|
}
|
||||||
|
bookTreeModel.reload(book);
|
||||||
|
|
||||||
bookTree.expandPath(new TreePath(book.getPath()));
|
bookTree.expandPath(new TreePath(book.getPath()));
|
||||||
|
|
||||||
statusLabel.setText("Noise floor: " + getNoiseFloorDB() + "dB");
|
statusLabel.setText("Noise floor: " + getNoiseFloorDB() + "dB");
|
||||||
book.setIcon(Icons.book);
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class Biquad implements Effect {
|
|||||||
double sampleFrequency;
|
double sampleFrequency;
|
||||||
|
|
||||||
public Biquad() {
|
public Biquad() {
|
||||||
|
Debug.trace();
|
||||||
type = Lowpass;
|
type = Lowpass;
|
||||||
a0 = 1.0d;
|
a0 = 1.0d;
|
||||||
a1 = 0.0d;
|
a1 = 0.0d;
|
||||||
@@ -54,6 +55,7 @@ public class Biquad implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Biquad(int type, double Fc, double Q, double peakGainDB) {
|
public Biquad(int type, double Fc, double Q, double peakGainDB) {
|
||||||
|
Debug.trace();
|
||||||
setBiquad(type, Fc, Q, peakGainDB);
|
setBiquad(type, Fc, Q, peakGainDB);
|
||||||
lz1 = 0.0;
|
lz1 = 0.0;
|
||||||
lz2 = 0.0;
|
lz2 = 0.0;
|
||||||
@@ -63,26 +65,31 @@ public class Biquad implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setType(int typei) {
|
public void setType(int typei) {
|
||||||
|
Debug.trace();
|
||||||
type = typei;
|
type = typei;
|
||||||
calcBiquad();
|
calcBiquad();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQ(double Qi) {
|
public void setQ(double Qi) {
|
||||||
|
Debug.trace();
|
||||||
Q = Qi;
|
Q = Qi;
|
||||||
calcBiquad();
|
calcBiquad();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFc(double Fci) {
|
public void setFc(double Fci) {
|
||||||
|
Debug.trace();
|
||||||
Fc = Fci;
|
Fc = Fci;
|
||||||
calcBiquad();
|
calcBiquad();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPeakGain(double peakGainDB) {
|
public void setPeakGain(double peakGainDB) {
|
||||||
|
Debug.trace();
|
||||||
peakGain = peakGainDB;
|
peakGain = peakGainDB;
|
||||||
calcBiquad();
|
calcBiquad();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBiquad(int typei, double Fci, double Qi, double peakGainDB) {
|
public void setBiquad(int typei, double Fci, double Qi, double peakGainDB) {
|
||||||
|
Debug.trace();
|
||||||
type = typei;
|
type = typei;
|
||||||
Q = Qi;
|
Q = Qi;
|
||||||
Fc = Fci;
|
Fc = Fci;
|
||||||
@@ -90,6 +97,7 @@ public class Biquad implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void process(double[][] samples) {
|
public void process(double[][] samples) {
|
||||||
|
Debug.trace();
|
||||||
lz1 = 0d;
|
lz1 = 0d;
|
||||||
lz2 = 0d;
|
lz2 = 0d;
|
||||||
rz1 = 0d;
|
rz1 = 0d;
|
||||||
@@ -111,6 +119,7 @@ public class Biquad implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init(double sf) {
|
public void init(double sf) {
|
||||||
|
Debug.trace();
|
||||||
sampleFrequency = sf;
|
sampleFrequency = sf;
|
||||||
lz1 = 0d;
|
lz1 = 0d;
|
||||||
lz2 = 0d;
|
lz2 = 0d;
|
||||||
@@ -120,6 +129,7 @@ public class Biquad implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void calcBiquad() {
|
void calcBiquad() {
|
||||||
|
Debug.trace();
|
||||||
|
|
||||||
double norm;
|
double norm;
|
||||||
double V = Math.pow(10, Math.abs(peakGain) / 20.0);
|
double V = Math.pow(10, Math.abs(peakGain) / 20.0);
|
||||||
@@ -221,6 +231,7 @@ public class Biquad implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
Debug.trace();
|
||||||
String n = "Biquad Filter (";
|
String n = "Biquad Filter (";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Lowpass: n += "Lowpass"; break;
|
case Lowpass: n += "Lowpass"; break;
|
||||||
@@ -242,14 +253,17 @@ public class Biquad implements Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Effect> getChildEffects() {
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
Debug.trace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Debug.trace();
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dump() {
|
public void dump() {
|
||||||
|
Debug.trace();
|
||||||
System.out.println(toString());
|
System.out.println(toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.w3c.dom.NodeList;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Text;
|
import org.w3c.dom.Text;
|
||||||
|
|
||||||
public class Book extends DefaultMutableTreeNode {
|
public class Book extends BookTreeNode {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
String author;
|
String author;
|
||||||
@@ -39,13 +39,15 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
int channels;
|
int channels;
|
||||||
int resolution;
|
int resolution;
|
||||||
|
|
||||||
|
String notes = null;
|
||||||
|
|
||||||
ImageIcon icon;
|
ImageIcon icon;
|
||||||
|
|
||||||
Properties prefs;
|
Properties prefs;
|
||||||
|
|
||||||
public Book(Properties p, String bookname) {
|
public Book(Properties p, String bookname) {
|
||||||
super(bookname);
|
super(bookname);
|
||||||
|
Debug.trace();
|
||||||
prefs = p;
|
prefs = p;
|
||||||
name = bookname;
|
name = bookname;
|
||||||
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name); // This should be in the load routine!!!!
|
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name); // This should be in the load routine!!!!
|
||||||
@@ -53,12 +55,13 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
|
|
||||||
public Book(Element root) {
|
public Book(Element root) {
|
||||||
super(getTextNode(root, "title"));
|
super(getTextNode(root, "title"));
|
||||||
|
Debug.trace();
|
||||||
name = getTextNode(root, "title");
|
name = getTextNode(root, "title");
|
||||||
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name); // This should be in the load routine!!!!
|
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name); // This should be in the load routine!!!!
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadBookXML(Element root, DefaultTreeModel model) {
|
public void loadBookXML(Element root, DefaultTreeModel model) {
|
||||||
|
Debug.trace();
|
||||||
name = getTextNode(root, "title");
|
name = getTextNode(root, "title");
|
||||||
author = getTextNode(root, "author");
|
author = getTextNode(root, "author");
|
||||||
genre = getTextNode(root, "genre");
|
genre = getTextNode(root, "genre");
|
||||||
@@ -67,6 +70,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
manuscript = getTextNode(root, "manuscript");
|
manuscript = getTextNode(root, "manuscript");
|
||||||
|
|
||||||
AudiobookRecorder.window.setBookNotes(getTextNode(root, "notes"));
|
AudiobookRecorder.window.setBookNotes(getTextNode(root, "notes"));
|
||||||
|
notes = getTextNode(root, "notes");
|
||||||
|
|
||||||
Element settings = getNode(root, "settings");
|
Element settings = getNode(root, "settings");
|
||||||
Element audioSettings = getNode(settings, "audio");
|
Element audioSettings = getNode(settings, "audio");
|
||||||
@@ -92,6 +96,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Element getNode(Element r, String n) {
|
public static Element getNode(Element r, String n) {
|
||||||
|
Debug.trace();
|
||||||
NodeList nl = r.getElementsByTagName(n);
|
NodeList nl = r.getElementsByTagName(n);
|
||||||
if (nl == null) return null;
|
if (nl == null) return null;
|
||||||
if (nl.getLength() == 0) return null;
|
if (nl.getLength() == 0) return null;
|
||||||
@@ -99,35 +104,40 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getTextNode(Element r, String n) {
|
public static String getTextNode(Element r, String n) {
|
||||||
|
Debug.trace();
|
||||||
return getTextNode(r, n, "");
|
return getTextNode(r, n, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTextNode(Element r, String n, String d) {
|
public static String getTextNode(Element r, String n, String d) {
|
||||||
|
Debug.trace();
|
||||||
Element node = getNode(r, n);
|
Element node = getNode(r, n);
|
||||||
if (node == null) return d;
|
if (node == null) return d;
|
||||||
return node.getTextContent();
|
return node.getTextContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthor(String a) { author = a; }
|
public void setAuthor(String a) { Debug.trace(); author = a; }
|
||||||
public void setGenre(String g) { genre = g; }
|
public void setGenre(String g) { Debug.trace(); genre = g; }
|
||||||
public void setComment(String c) { comment = c; }
|
public void setComment(String c) { Debug.trace(); comment = c; }
|
||||||
public void setACX(String c) { ACX = c; }
|
public void setACX(String c) { Debug.trace(); ACX = c; }
|
||||||
|
|
||||||
public String getAuthor() { return author; }
|
public String getAuthor() { Debug.trace(); return author; }
|
||||||
public String getGenre() { return genre; }
|
public String getGenre() { Debug.trace(); return genre; }
|
||||||
public String getComment() { return comment; }
|
public String getComment() { Debug.trace(); return comment; }
|
||||||
public String getACX() { if (ACX == null) return ""; return ACX; }
|
public String getACX() { Debug.trace(); if (ACX == null) return ""; return ACX; }
|
||||||
|
|
||||||
public Chapter getClosingCredits() {
|
public Chapter getClosingCredits() {
|
||||||
|
Debug.trace();
|
||||||
return getChapterById("close");
|
return getChapterById("close");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chapter getOpeningCredits() {
|
public Chapter getOpeningCredits() {
|
||||||
|
Debug.trace();
|
||||||
return getChapterById("open");
|
return getChapterById("open");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Chapter getChapterById(String id) {
|
public Chapter getChapterById(String id) {
|
||||||
|
Debug.trace();
|
||||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||||
Object ob = (Object)o.nextElement();
|
Object ob = (Object)o.nextElement();
|
||||||
if (ob instanceof Chapter) {
|
if (ob instanceof Chapter) {
|
||||||
@@ -141,6 +151,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Chapter getLastChapter() {
|
public Chapter getLastChapter() {
|
||||||
|
Debug.trace();
|
||||||
Chapter cc = getClosingCredits();
|
Chapter cc = getClosingCredits();
|
||||||
if (cc == null) return null;
|
if (cc == null) return null;
|
||||||
Chapter c = (Chapter)getChildBefore(cc);
|
Chapter c = (Chapter)getChildBefore(cc);
|
||||||
@@ -150,11 +161,13 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Chapter getChapter(int n) {
|
public Chapter getChapter(int n) {
|
||||||
|
Debug.trace();
|
||||||
if (n == 0) return null;
|
if (n == 0) return null;
|
||||||
return (Chapter)getChildAt(n);
|
return (Chapter)getChildAt(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chapter addChapter() {
|
public Chapter addChapter() {
|
||||||
|
Debug.trace();
|
||||||
Chapter lc = getLastChapter();
|
Chapter lc = getLastChapter();
|
||||||
if (lc == null) return new Chapter("1", "Chapter 1");
|
if (lc == null) return new Chapter("1", "Chapter 1");
|
||||||
try {
|
try {
|
||||||
@@ -170,18 +183,22 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
Debug.trace();
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageIcon getIcon() {
|
public ImageIcon getIcon() {
|
||||||
|
Debug.trace();
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIcon(ImageIcon i) {
|
public void setIcon(ImageIcon i) {
|
||||||
|
Debug.trace();
|
||||||
icon = i;
|
icon = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserObject(Object o) {
|
public void setUserObject(Object o) {
|
||||||
|
Debug.trace();
|
||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
String newName = (String)o;
|
String newName = (String)o;
|
||||||
if (newName.equals(name)) return;
|
if (newName.equals(name)) return;
|
||||||
@@ -190,10 +207,12 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File getBookPath() {
|
public File getBookPath() {
|
||||||
|
Debug.trace();
|
||||||
return new File(Options.get("path.storage"), name);
|
return new File(Options.get("path.storage"), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renameBook(String newName) {
|
public void renameBook(String newName) {
|
||||||
|
Debug.trace();
|
||||||
File oldDir = getBookPath();
|
File oldDir = getBookPath();
|
||||||
File newDir = new File(Options.get("path.storage"), newName);
|
File newDir = new File(Options.get("path.storage"), newName);
|
||||||
|
|
||||||
@@ -214,11 +233,13 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Debug.trace();
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void renumberChapters() {
|
public void renumberChapters() {
|
||||||
|
Debug.trace();
|
||||||
int id = 1;
|
int id = 1;
|
||||||
|
|
||||||
for (Enumeration c = children(); c.hasMoreElements();) {
|
for (Enumeration c = children(); c.hasMoreElements();) {
|
||||||
@@ -230,41 +251,48 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSampleRate() { return sampleRate; }
|
public int getSampleRate() { Debug.trace(); return sampleRate; }
|
||||||
public void setSampleRate(int sr) { sampleRate = sr; }
|
public void setSampleRate(int sr) { Debug.trace(); sampleRate = sr; }
|
||||||
public int getChannels() { return channels; }
|
public int getChannels() { Debug.trace(); return channels; }
|
||||||
public void setChannels(int c) { channels = c; }
|
public void setChannels(int c) { Debug.trace(); channels = c; }
|
||||||
public int getResolution() { return resolution; }
|
public int getResolution() { Debug.trace(); return resolution; }
|
||||||
public void setResolution(int r) { resolution = r; }
|
public void setResolution(int r) { Debug.trace(); resolution = r; }
|
||||||
|
|
||||||
public AudioFormat getAudioFormat() {
|
public AudioFormat getAudioFormat() {
|
||||||
|
Debug.trace();
|
||||||
return new AudioFormat(getSampleRate(), getResolution(), getChannels(), true, false);
|
return new AudioFormat(getSampleRate(), getResolution(), getChannels(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String get(String key) {
|
public String get(String key) {
|
||||||
|
Debug.trace();
|
||||||
if (prefs.getProperty(key) == null) { return Options.get(key); }
|
if (prefs.getProperty(key) == null) { return Options.get(key); }
|
||||||
return prefs.getProperty(key);
|
return prefs.getProperty(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getInteger(String key) {
|
public Integer getInteger(String key) {
|
||||||
|
Debug.trace();
|
||||||
if (prefs.getProperty(key) == null) { return Options.getInteger(key); }
|
if (prefs.getProperty(key) == null) { return Options.getInteger(key); }
|
||||||
return Utils.s2i(prefs.getProperty(key));
|
return Utils.s2i(prefs.getProperty(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(String key, String value) {
|
public void set(String key, String value) {
|
||||||
|
Debug.trace();
|
||||||
prefs.setProperty(key, value);
|
prefs.setProperty(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(String key, Integer value) {
|
public void set(String key, Integer value) {
|
||||||
|
Debug.trace();
|
||||||
prefs.setProperty(key, "" + value);
|
prefs.setProperty(key, "" + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getBookFolder() {
|
public File getBookFolder() {
|
||||||
|
Debug.trace();
|
||||||
File dir = new File(Options.get("path.storage"), name);
|
File dir = new File(Options.get("path.storage"), name);
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> getUsedEffects() {
|
public ArrayList<String> getUsedEffects() {
|
||||||
|
Debug.trace();
|
||||||
|
|
||||||
ArrayList<String> out = new ArrayList<String>();
|
ArrayList<String> out = new ArrayList<String>();
|
||||||
|
|
||||||
@@ -285,6 +313,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void purgeBackups() {
|
public void purgeBackups() {
|
||||||
|
Debug.trace();
|
||||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||||
Object ob = (Object)o.nextElement();
|
Object ob = (Object)o.nextElement();
|
||||||
if (ob instanceof Chapter) {
|
if (ob instanceof Chapter) {
|
||||||
@@ -295,6 +324,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Document buildDocument() throws ParserConfigurationException {
|
public Document buildDocument() throws ParserConfigurationException {
|
||||||
|
Debug.trace();
|
||||||
DocumentBuilderFactory dbFactory =
|
DocumentBuilderFactory dbFactory =
|
||||||
DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||||
@@ -343,6 +373,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Element makeTextNode(Document doc, String name, String text) {
|
public static Element makeTextNode(Document doc, String name, String text) {
|
||||||
|
Debug.trace();
|
||||||
Element node = doc.createElement(name);
|
Element node = doc.createElement(name);
|
||||||
Text tnode = doc.createTextNode(text == null ? "" : text);
|
Text tnode = doc.createTextNode(text == null ? "" : text);
|
||||||
node.appendChild(tnode);
|
node.appendChild(tnode);
|
||||||
@@ -350,6 +381,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Element makeTextNode(Document doc, String name, Integer text) {
|
public static Element makeTextNode(Document doc, String name, Integer text) {
|
||||||
|
Debug.trace();
|
||||||
Element node = doc.createElement(name);
|
Element node = doc.createElement(name);
|
||||||
Text tnode = doc.createTextNode(Integer.toString(text));
|
Text tnode = doc.createTextNode(Integer.toString(text));
|
||||||
node.appendChild(tnode);
|
node.appendChild(tnode);
|
||||||
@@ -357,6 +389,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Element makeTextNode(Document doc, String name, Double text) {
|
public static Element makeTextNode(Document doc, String name, Double text) {
|
||||||
|
Debug.trace();
|
||||||
Element node = doc.createElement(name);
|
Element node = doc.createElement(name);
|
||||||
Text tnode = doc.createTextNode(String.format("%.8f", text));
|
Text tnode = doc.createTextNode(String.format("%.8f", text));
|
||||||
node.appendChild(tnode);
|
node.appendChild(tnode);
|
||||||
@@ -364,6 +397,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Element makeTextNode(Document doc, String name, Boolean text) {
|
public static Element makeTextNode(Document doc, String name, Boolean text) {
|
||||||
|
Debug.trace();
|
||||||
Element node = doc.createElement(name);
|
Element node = doc.createElement(name);
|
||||||
Text tnode = doc.createTextNode(text ? "true" : "false");
|
Text tnode = doc.createTextNode(text ? "true" : "false");
|
||||||
node.appendChild(tnode);
|
node.appendChild(tnode);
|
||||||
@@ -371,14 +405,17 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultEffect() {
|
public String getDefaultEffect() {
|
||||||
|
Debug.trace();
|
||||||
return defaultEffect;
|
return defaultEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultEffect(String eff) {
|
public void setDefaultEffect(String eff) {
|
||||||
|
Debug.trace();
|
||||||
defaultEffect = eff;
|
defaultEffect = eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setManuscript(File f) {
|
public void setManuscript(File f) {
|
||||||
|
Debug.trace();
|
||||||
manuscript = f.getName();
|
manuscript = f.getName();
|
||||||
File dst = new File(getBookPath(), manuscript);
|
File dst = new File(getBookPath(), manuscript);
|
||||||
|
|
||||||
@@ -390,6 +427,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File getManuscript() {
|
public File getManuscript() {
|
||||||
|
Debug.trace();
|
||||||
if (manuscript == null) return null;
|
if (manuscript == null) return null;
|
||||||
if (manuscript.equals("")) return null;
|
if (manuscript.equals("")) return null;
|
||||||
File f = new File(getBookPath(), manuscript);
|
File f = new File(getBookPath(), manuscript);
|
||||||
@@ -398,4 +436,17 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onSelect() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNotes() {
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotes(String n) {
|
||||||
|
notes = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class BookInfoPanel extends JPanel {
|
|||||||
|
|
||||||
public BookInfoPanel(String t, String a, String g, String c, String x) {
|
public BookInfoPanel(String t, String a, String g, String c, String x) {
|
||||||
super();
|
super();
|
||||||
|
Debug.trace();
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
GridBagConstraints con = new GridBagConstraints();
|
GridBagConstraints con = new GridBagConstraints();
|
||||||
|
|
||||||
@@ -69,12 +70,13 @@ public class BookInfoPanel extends JPanel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() { return title.getText(); }
|
public String getTitle() { Debug.trace(); return title.getText(); }
|
||||||
public String getAuthor() { return author.getText(); }
|
public String getAuthor() { Debug.trace(); return author.getText(); }
|
||||||
public String getGenre() { return genre.getText(); }
|
public String getGenre() { Debug.trace(); return genre.getText(); }
|
||||||
public String getComment() { return comment.getText(); }
|
public String getComment() { Debug.trace(); return comment.getText(); }
|
||||||
|
|
||||||
public String getACX() {
|
public String getACX() {
|
||||||
|
Debug.trace();
|
||||||
Pattern p = Pattern.compile("\\/titleview\\/([A-Z0-9]{14})");
|
Pattern p = Pattern.compile("\\/titleview\\/([A-Z0-9]{14})");
|
||||||
Matcher m = p.matcher(acx.getText());
|
Matcher m = p.matcher(acx.getText());
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
@@ -84,10 +86,10 @@ public class BookInfoPanel extends JPanel {
|
|||||||
return acx.getText();
|
return acx.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String t) { title.setText(t); }
|
public void setTitle(String t) { Debug.trace(); title.setText(t); }
|
||||||
public void setAuthor(String a) { author.setText(a); }
|
public void setAuthor(String a) { Debug.trace(); author.setText(a); }
|
||||||
public void setGenre(String g) { genre.setText(g); }
|
public void setGenre(String g) { Debug.trace(); genre.setText(g); }
|
||||||
public void setComment(String c) { comment.setText(c); }
|
public void setComment(String c) { Debug.trace(); comment.setText(c); }
|
||||||
public void setACX(String a) { acx.setText(a); }
|
public void setACX(String a) { Debug.trace(); acx.setText(a); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,33 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
|||||||
p.setOpaque(false);
|
p.setOpaque(false);
|
||||||
return p;
|
return p;
|
||||||
} else if (value instanceof Book) {
|
} else if (value instanceof Book) {
|
||||||
ret.setIcon(((Book)value).getIcon());
|
Book b = (Book)value;
|
||||||
|
|
||||||
|
JPanel p = new JPanel();
|
||||||
|
p.setLayout(new GridBagLayout());
|
||||||
|
GridBagConstraints ctx = new GridBagConstraints();
|
||||||
|
|
||||||
|
ctx.gridx = 0;
|
||||||
|
ctx.gridy = 0;
|
||||||
|
ctx.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
ctx.anchor = GridBagConstraints.LINE_START;
|
||||||
|
ctx.weightx = 1.0d;
|
||||||
|
|
||||||
|
ret.setIcon(b.getIcon());
|
||||||
|
p.add(ret, ctx);
|
||||||
|
|
||||||
|
JLabel author = new JLabel(b.getAuthor());
|
||||||
|
ctx.gridy++;
|
||||||
|
author.setBorder(new EmptyBorder(0, 27, 0, 0));
|
||||||
|
Font f = author.getFont();
|
||||||
|
Font nf = f.deriveFont(Font.ITALIC, (int)(f.getSize() * 0.75));
|
||||||
|
author.setFont(nf);
|
||||||
|
author.setForeground(author.getForeground().darker());
|
||||||
|
p.add(author, ctx);
|
||||||
|
|
||||||
|
p.setOpaque(false);
|
||||||
|
return p;
|
||||||
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
|
|
||||||
public Chapter(String i, String chaptername) {
|
public Chapter(String i, String chaptername) {
|
||||||
super(chaptername);
|
super(chaptername);
|
||||||
|
Debug.trace();
|
||||||
id = i;
|
id = i;
|
||||||
name = chaptername;
|
name = chaptername;
|
||||||
preGap = Options.getInteger("catenation.pre-chapter");
|
preGap = Options.getInteger("catenation.pre-chapter");
|
||||||
@@ -46,7 +46,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Chapter(Element root, DefaultTreeModel model) {
|
public Chapter(Element root, DefaultTreeModel model) {
|
||||||
|
Debug.trace();
|
||||||
name = Book.getTextNode(root, "name");
|
name = Book.getTextNode(root, "name");
|
||||||
id = root.getAttribute("id");
|
id = root.getAttribute("id");
|
||||||
preGap = Utils.s2i(Book.getTextNode(root, "pre-gap"));
|
preGap = Utils.s2i(Book.getTextNode(root, "pre-gap"));
|
||||||
@@ -65,24 +65,29 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
Debug.trace();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String i) {
|
public void setId(String i) {
|
||||||
|
Debug.trace();
|
||||||
id = i;
|
id = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sentence getLastSentence() {
|
public Sentence getLastSentence() {
|
||||||
|
Debug.trace();
|
||||||
DefaultMutableTreeNode ls = getLastLeaf();
|
DefaultMutableTreeNode ls = getLastLeaf();
|
||||||
if (ls instanceof Sentence) return (Sentence)ls;
|
if (ls instanceof Sentence) return (Sentence)ls;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Debug.trace();
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserObject(Object o) {
|
public void setUserObject(Object o) {
|
||||||
|
Debug.trace();
|
||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
String so = (String)o;
|
String so = (String)o;
|
||||||
name = so;
|
name = so;
|
||||||
@@ -90,26 +95,32 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
Debug.trace();
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String n) {
|
public void setName(String n) {
|
||||||
|
Debug.trace();
|
||||||
name = n;
|
name = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreGap(int g) {
|
public void setPreGap(int g) {
|
||||||
|
Debug.trace();
|
||||||
preGap = g;
|
preGap = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPreGap() {
|
public int getPreGap() {
|
||||||
|
Debug.trace();
|
||||||
return preGap;
|
return preGap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostGap(int g) {
|
public void setPostGap(int g) {
|
||||||
|
Debug.trace();
|
||||||
postGap = g;
|
postGap = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPostGap() {
|
public int getPostGap() {
|
||||||
|
Debug.trace();
|
||||||
return postGap;
|
return postGap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +128,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
public void exportChapter(ProgressDialog exportDialog) throws
|
public void exportChapter(ProgressDialog exportDialog) throws
|
||||||
FileNotFoundException, IOException, InputFormatException, NotSupportedException,
|
FileNotFoundException, IOException, InputFormatException, NotSupportedException,
|
||||||
EncoderException, UnsupportedTagException, InvalidDataException {
|
EncoderException, UnsupportedTagException, InvalidDataException {
|
||||||
|
Debug.trace();
|
||||||
|
|
||||||
if (getChildCount() == 0) return;
|
if (getChildCount() == 0) return;
|
||||||
|
|
||||||
@@ -235,6 +247,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getChapterLength() {
|
public double getChapterLength() {
|
||||||
|
Debug.trace();
|
||||||
double totalTime = Options.getInteger("audio.recording.pre-chapter") / 1000d;
|
double totalTime = Options.getInteger("audio.recording.pre-chapter") / 1000d;
|
||||||
for (Enumeration s = children(); s.hasMoreElements();) {
|
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||||
Sentence sentence = (Sentence)s.nextElement();
|
Sentence sentence = (Sentence)s.nextElement();
|
||||||
@@ -249,6 +262,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> getUsedEffects() {
|
public ArrayList<String> getUsedEffects() {
|
||||||
|
Debug.trace();
|
||||||
|
|
||||||
ArrayList<String> out = new ArrayList<String>();
|
ArrayList<String> out = new ArrayList<String>();
|
||||||
|
|
||||||
@@ -266,6 +280,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetPostGaps() {
|
public void resetPostGaps() {
|
||||||
|
Debug.trace();
|
||||||
for (Enumeration s = children(); s.hasMoreElements();) {
|
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||||
Sentence snt = (Sentence)s.nextElement();
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
snt.resetPostGap();
|
snt.resetPostGap();
|
||||||
@@ -273,6 +288,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void purgeBackups() {
|
public void purgeBackups() {
|
||||||
|
Debug.trace();
|
||||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||||
Object ob = (Object)o.nextElement();
|
Object ob = (Object)o.nextElement();
|
||||||
if (ob instanceof Sentence) {
|
if (ob instanceof Sentence) {
|
||||||
@@ -283,6 +299,7 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Element getChapterXML(Document doc) {
|
public Element getChapterXML(Document doc) {
|
||||||
|
Debug.trace();
|
||||||
Element chapterNode = doc.createElement("chapter");
|
Element chapterNode = doc.createElement("chapter");
|
||||||
chapterNode.setAttribute("id", id);
|
chapterNode.setAttribute("id", id);
|
||||||
chapterNode.appendChild(Book.makeTextNode(doc, "name", name));
|
chapterNode.appendChild(Book.makeTextNode(doc, "name", name));
|
||||||
@@ -305,18 +322,22 @@ public class Chapter extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getNotes() {
|
public String getNotes() {
|
||||||
|
Debug.trace();
|
||||||
return notes;
|
return notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotes(String t) {
|
public void setNotes(String t) {
|
||||||
|
Debug.trace();
|
||||||
notes = t;
|
notes = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelect() {
|
public void onSelect() {
|
||||||
|
Debug.trace();
|
||||||
AudiobookRecorder.window.setChapterNotes(notes);
|
AudiobookRecorder.window.setChapterNotes(notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getLength() {
|
public double getLength() {
|
||||||
|
Debug.trace();
|
||||||
double len = 0;
|
double len = 0;
|
||||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||||
Object ob = (Object)o.nextElement();
|
Object ob = (Object)o.nextElement();
|
||||||
|
|||||||
Reference in New Issue
Block a user