Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 90ca84cfbf | |||
| a18ca1ce21 | |||
| b92babb5cd | |||
| e3231ec495 |
@@ -1 +1 @@
|
||||
version=0.3.3
|
||||
version=0.3.4
|
||||
|
||||
@@ -1246,6 +1246,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
||||
Chapter c = (Chapter)s.getParent();
|
||||
int idx = bookTreeModel.getIndexOfChild(c, s);
|
||||
bookTreeModel.insertNodeInto(newSentence, c, idx);
|
||||
bookTree.setSelectionPath(new TreePath(newSentence.getPath()));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@@ -2034,10 +2035,11 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
||||
bookTree.addTreeSelectionListener(new TreeSelectionListener() {
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
DefaultMutableTreeNode n = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||
if (n instanceof BookTreeNode) {
|
||||
BookTreeNode btn = (BookTreeNode)n;
|
||||
btn.onSelect();
|
||||
}
|
||||
|
||||
if (n instanceof BookTreeNode) {
|
||||
BookTreeNode btn = (BookTreeNode)n;
|
||||
btn.onSelect();
|
||||
}
|
||||
|
||||
if (n instanceof Sentence) {
|
||||
Sentence s = (Sentence)n;
|
||||
@@ -2531,11 +2533,17 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
||||
|
||||
int numKids = chapter.getChildCount();
|
||||
int kidCount = 0;
|
||||
double lastGain = -1;
|
||||
double variance = Options.getInteger("audio.recording.variance") / 100d;
|
||||
for (Enumeration s = chapter.children(); s.hasMoreElements();) {
|
||||
kidCount++;
|
||||
dialog.setProgress(kidCount * 2000 / numKids);
|
||||
Sentence snt = (Sentence)s.nextElement();
|
||||
snt.normalize();
|
||||
if (lastGain == -1) {
|
||||
lastGain = snt.normalize();
|
||||
} else {
|
||||
lastGain = snt.normalize(lastGain - variance, lastGain + variance);
|
||||
}
|
||||
}
|
||||
|
||||
dialog.closeDialog();
|
||||
@@ -2798,7 +2806,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
||||
play.close();
|
||||
}
|
||||
play = null;
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -3710,8 +3718,12 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
||||
|
||||
public void doSplit(int at) {
|
||||
try {
|
||||
Sentence newSentence = selectedSentence.cloneSentence();
|
||||
if (selectedSentence == null) {
|
||||
System.err.println("Selected sentence is NULL in split. That CANNOT happen!");
|
||||
return;
|
||||
}
|
||||
Chapter c = (Chapter)selectedSentence.getParent();
|
||||
Sentence newSentence = selectedSentence.cloneSentence();
|
||||
int idx = bookTreeModel.getIndexOfChild(c, selectedSentence);
|
||||
bookTreeModel.insertNodeInto(newSentence, c, idx);
|
||||
|
||||
|
||||
@@ -99,8 +99,12 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public static String getTextNode(Element r, String n) {
|
||||
return getTextNode(r, n, "");
|
||||
}
|
||||
|
||||
public static String getTextNode(Element r, String n, String d) {
|
||||
Element node = getNode(r, n);
|
||||
if (node == null) return "";
|
||||
if (node == null) return d;
|
||||
return node.getTextContent();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,15 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
||||
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
|
||||
JLabel ret = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
||||
ret.setIconTextGap(0);
|
||||
ret.setIconTextGap(5);
|
||||
ret.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||
if (value instanceof Sentence) {
|
||||
Sentence s = (Sentence)value;
|
||||
|
||||
JPanel p = new JPanel();
|
||||
p.setLayout(new GridBagLayout());
|
||||
GridBagConstraints ctx = new GridBagConstraints();
|
||||
|
||||
OverlayIcon icn = new OverlayIcon(Icons.sentence);
|
||||
|
||||
if (s.getOverrideText() != null) {
|
||||
@@ -63,17 +67,72 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
||||
}
|
||||
|
||||
if (gaptype.equals("sentence")) {
|
||||
ret.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||
p.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||
} else if (gaptype.equals("continuation")) {
|
||||
ret.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||
p.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||
} else if (gaptype.equals("paragraph")) {
|
||||
ret.setBorder(new EmptyBorder(0, 0, 7, 0));
|
||||
p.setBorder(new EmptyBorder(0, 0, 7, 0));
|
||||
} else if (gaptype.equals("section")) {
|
||||
ret.setBorder(new EmptyBorder(0, 0, 15, 0));
|
||||
p.setBorder(new EmptyBorder(0, 0, 15, 0));
|
||||
}
|
||||
|
||||
|
||||
JLabel time = new JLabel(Utils.secToTime(s.getLength(), "mm:ss.SSS") + " ");
|
||||
|
||||
ctx.gridx = 0;
|
||||
ctx.gridy = 0;
|
||||
ctx.fill = GridBagConstraints.HORIZONTAL;
|
||||
ctx.anchor = GridBagConstraints.LINE_START;
|
||||
|
||||
String effectChain = s.getEffectChain();
|
||||
if ((effectChain == null) || (effectChain.equals("none"))) {
|
||||
ctx.weightx = 1.0d;
|
||||
ctx.gridwidth = 2;
|
||||
p.add(ret, ctx);
|
||||
} else {
|
||||
ctx.weightx = 0.1d;
|
||||
ctx.gridwidth = 1;
|
||||
p.add(ret, ctx);
|
||||
Effect e = AudiobookRecorder.window.effects.get(effectChain);
|
||||
JLabel eff = new JLabel(e.toString() + " ");
|
||||
ctx.weightx = 0.0d;
|
||||
ctx.gridwidth = 1;
|
||||
ctx.gridx = 1;
|
||||
p.add(eff);
|
||||
}
|
||||
|
||||
ctx.weightx = 0.0d;
|
||||
ctx.gridx = 2;
|
||||
ctx.anchor = GridBagConstraints.LINE_END;
|
||||
p.add(time, ctx);
|
||||
|
||||
p.setOpaque(false);
|
||||
|
||||
return p;
|
||||
|
||||
} else if (value instanceof Chapter) {
|
||||
Chapter c = (Chapter)value;
|
||||
|
||||
ret.setIcon(Icons.chapter);
|
||||
|
||||
JPanel p = new JPanel();
|
||||
p.setLayout(new GridBagLayout());
|
||||
GridBagConstraints ctx = new GridBagConstraints();
|
||||
|
||||
JLabel time = new JLabel(Utils.secToTime(c.getLength(), "mm:ss") + " ");
|
||||
|
||||
ctx.gridx = 0;
|
||||
ctx.gridy = 0;
|
||||
ctx.fill = GridBagConstraints.HORIZONTAL;
|
||||
ctx.anchor = GridBagConstraints.LINE_START;
|
||||
ctx.weightx = 1.0d;
|
||||
p.add(ret, ctx);
|
||||
ctx.weightx = 0.0d;
|
||||
ctx.gridx = 1;
|
||||
ctx.anchor = GridBagConstraints.LINE_END;
|
||||
p.add(time, ctx);
|
||||
p.setOpaque(false);
|
||||
return p;
|
||||
} else if (value instanceof Book) {
|
||||
ret.setIcon(((Book)value).getIcon());
|
||||
}
|
||||
|
||||
@@ -316,4 +316,16 @@ public class Chapter extends BookTreeNode {
|
||||
AudiobookRecorder.window.setChapterNotes(notes);
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
double len = 0;
|
||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||
Object ob = (Object)o.nextElement();
|
||||
if (ob instanceof Sentence) {
|
||||
Sentence s = (Sentence)ob;
|
||||
len += s.getLength();
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class Options extends JDialog {
|
||||
JSpinner shortSentenceGap;
|
||||
JSpinner postParagraphGap;
|
||||
JSpinner postSectionGap;
|
||||
JSpinner maxGainVariance;
|
||||
JTextField ffmpegLocation;
|
||||
JComboBox<KVPair> bitRate;
|
||||
JComboBox<KVPair> channels;
|
||||
@@ -301,6 +302,7 @@ public class Options extends JDialog {
|
||||
trimMethod = addDropdown(optionsPanel, "Auto-trim method:", getTrimMethods(), get("audio.recording.trim"));
|
||||
fftThreshold = addSpinner(optionsPanel, "FFT threshold:", 0, 100, 1, getInteger("audio.recording.trim.fft"), "");
|
||||
fftBlockSize = addDropdown(optionsPanel, "FFT Block size:", getFFTBlockSizes(), get("audio.recording.trim.blocksize"));
|
||||
maxGainVariance = addSpinner(optionsPanel, "Maximum gain variance:", 0, 100, 1, getInteger("audio.recording.variance"), "");
|
||||
|
||||
addSeparator(optionsPanel);
|
||||
|
||||
@@ -582,6 +584,7 @@ public class Options extends JDialog {
|
||||
defaultPrefs.put("catenation.post-section", "3000");
|
||||
|
||||
defaultPrefs.put("audio.recording.trim.fft", "10");
|
||||
defaultPrefs.put("audio.recording.variance", "10");
|
||||
|
||||
defaultPrefs.put("path.storage", (new File(System.getProperty("user.home"), "Recordings")).toString());
|
||||
defaultPrefs.put("path.archive", (new File(new File(System.getProperty("user.home"), "Recordings"),"archive")).toString());
|
||||
@@ -718,6 +721,7 @@ public class Options extends JDialog {
|
||||
set("editor.external", externalEditor.getText());
|
||||
set("cache.size", cacheSize.getValue());
|
||||
set("audio.recording.trim.fft", fftThreshold.getValue());
|
||||
set("audio.recording.variance", maxGainVariance.getValue());
|
||||
set("audio.recording.trim.blocksize", ((KVPair)fftBlockSize.getSelectedItem()).key);
|
||||
set("audio.playback.blocksize", ((KVPair)playbackBlockSize.getSelectedItem()).key);
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
TargetDataLine line;
|
||||
AudioInputStream inputStream;
|
||||
AudioFormat storedFormat = null;
|
||||
double storedLength = -1d;
|
||||
|
||||
double runtime = -1d;
|
||||
|
||||
double[][] audioData = null;
|
||||
|
||||
@@ -185,6 +186,8 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
setPostGap(Utils.s2i(Book.getTextNode(root, "post-gap")));
|
||||
setStartOffset(Utils.s2i(Book.getTextNode(root, "start-offset")));
|
||||
setEndOffset(Utils.s2i(Book.getTextNode(root, "end-offset")));
|
||||
crossStartOffset = Utils.s2i(Book.getTextNode(root, "cross-start-offset", "-1"));
|
||||
crossEndOffset = Utils.s2i(Book.getTextNode(root, "end-offset", "-1"));
|
||||
setLocked(Utils.s2b(Book.getTextNode(root, "locked")));
|
||||
setAttentionFlag(Utils.s2b(Book.getTextNode(root, "attention")));
|
||||
setGain(Utils.s2d(Book.getTextNode(root, "gain")));
|
||||
@@ -192,6 +195,14 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
setPostGapType(Book.getTextNode(root, "gaptype"));
|
||||
sampleSize = Utils.s2i(Book.getTextNode(root, "samples"));
|
||||
processed = Utils.s2b(Book.getTextNode(root, "processed"));
|
||||
runtime = Utils.s2d(Book.getTextNode(root, "time", "-1.000"));
|
||||
|
||||
if ((crossStartOffset == -1) || (crossEndOffset == -1)) {
|
||||
System.err.println("Updating " + id);
|
||||
updateCrossings(true);
|
||||
}
|
||||
|
||||
if (runtime <= 0.01d) getLength();
|
||||
}
|
||||
|
||||
public boolean startRecording() {
|
||||
@@ -350,7 +361,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
intens = null;
|
||||
samples = null;
|
||||
processed = true;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public void autoTrimSamplePeak() {
|
||||
@@ -407,7 +418,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
if (endOffset >= samples.length) endOffset = samples.length-1;
|
||||
updateCrossings(useRaw);
|
||||
processed = true;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
@@ -417,7 +428,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
public void setText(String t) {
|
||||
overrideText = null;
|
||||
text = t;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
@@ -450,11 +461,14 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return text;
|
||||
/*
|
||||
if (effectChain == null) return text;
|
||||
if (effectChain.equals("none")) return text;
|
||||
Effect e = AudiobookRecorder.window.effects.get(effectChain);
|
||||
if (e == null) return text;
|
||||
return text + " (" + e.toString() + ")";
|
||||
*/
|
||||
}
|
||||
|
||||
public boolean isRecording() {
|
||||
@@ -465,7 +479,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
if (o instanceof String) {
|
||||
String so = (String)o;
|
||||
text = so;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,6 +513,8 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
public void updateCrossings(boolean useRaw) {
|
||||
updateStartCrossing(useRaw);
|
||||
updateEndCrossing(useRaw);
|
||||
runtime = -1d;
|
||||
getLength();
|
||||
}
|
||||
|
||||
public void updateStartCrossing() {
|
||||
@@ -525,7 +541,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
if (startOffset != o) {
|
||||
startOffset = o;
|
||||
crossStartOffset = -1;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,10 +557,18 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
if (endOffset != o) {
|
||||
endOffset = o;
|
||||
crossEndOffset = -1;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
}
|
||||
|
||||
public void setStartCrossing(int o) {
|
||||
crossStartOffset = o;
|
||||
}
|
||||
|
||||
public void setEndCrossing(int o) {
|
||||
crossEndOffset = o;
|
||||
}
|
||||
|
||||
public int getSampleSize() {
|
||||
if (sampleSize == -1) {
|
||||
loadFile();
|
||||
@@ -570,7 +594,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
public void doRecognition(StreamSpeechRecognizer recognizer) {
|
||||
try {
|
||||
setText("[recognising...]");
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
|
||||
byte[] inData = getPCMData();
|
||||
|
||||
@@ -585,7 +609,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
recognizer.stopRecognition();
|
||||
|
||||
setText(res);
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -621,8 +645,9 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
}
|
||||
|
||||
public void setLocked(boolean l) {
|
||||
if (locked == l) return;
|
||||
locked = l;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
@@ -641,7 +666,6 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
audioData = null;
|
||||
processedAudio = null;
|
||||
storedFormat = null;
|
||||
storedLength = -1;
|
||||
}
|
||||
|
||||
public boolean lockedInCache() {
|
||||
@@ -697,13 +721,16 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
|
||||
/* Get the length of the sample in seconds */
|
||||
public double getLength() {
|
||||
if (storedLength > -1d) return storedLength;
|
||||
if (runtime > 0.01d) return runtime;
|
||||
File f = getFile();
|
||||
if (!f.exists()) { // Not recorded yet!
|
||||
return 0;
|
||||
}
|
||||
AudioFormat format = getAudioFormat();
|
||||
float sampleFrequency = format.getFrameRate();
|
||||
int length = crossEndOffset - crossStartOffset;
|
||||
double time = (double)length / (double)sampleFrequency;
|
||||
storedLength = time;
|
||||
return time;
|
||||
runtime = (double)length / (double)sampleFrequency;
|
||||
return runtime;
|
||||
}
|
||||
|
||||
public Sentence cloneSentence() throws IOException {
|
||||
@@ -714,18 +741,21 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
}
|
||||
sentence.setStartOffset(getStartOffset());
|
||||
sentence.setEndOffset(getEndOffset());
|
||||
sentence.setStartCrossing(getStartCrossing());
|
||||
sentence.setEndCrossing(getEndCrossing());
|
||||
|
||||
File from = getFile();
|
||||
File to = sentence.getFile();
|
||||
Files.copy(from.toPath(), to.toPath());
|
||||
|
||||
sentence.updateCrossings();
|
||||
// sentence.updateCrossings();
|
||||
return sentence;
|
||||
}
|
||||
|
||||
public void setAttentionFlag(boolean f) {
|
||||
if (attention == f) return;
|
||||
attention = f;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public boolean getAttentionFlag() {
|
||||
@@ -787,12 +817,24 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
return gain;
|
||||
}
|
||||
|
||||
public void normalize() {
|
||||
if (locked) return;
|
||||
public double normalize(double low, double high) {
|
||||
if (locked) return gain;
|
||||
double max = getPeakValue(true, false);
|
||||
double d = 0.708 / max;
|
||||
if (d > 1d) d = 1d;
|
||||
if (d < low) d = low;
|
||||
if (d > high) d = high;
|
||||
setGain(d);
|
||||
return d;
|
||||
}
|
||||
|
||||
public double normalize() {
|
||||
if (locked) return gain;
|
||||
double max = getPeakValue(true, false);
|
||||
double d = 0.708 / max;
|
||||
if (d > 1d) d = 1d;
|
||||
setGain(d);
|
||||
return d;
|
||||
}
|
||||
|
||||
class ExternalEditor implements Runnable {
|
||||
@@ -1321,11 +1363,14 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
}
|
||||
|
||||
public void setEffectChain(String key) {
|
||||
if ((effectChain != null) && (effectChain.equals(key))) {
|
||||
return;
|
||||
}
|
||||
if ((effectChain != null) && (!effectChain.equals(key))) {
|
||||
CacheManager.removeFromCache(this);
|
||||
}
|
||||
effectChain = key;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public String getEffectChain() {
|
||||
@@ -1352,7 +1397,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
}
|
||||
}
|
||||
postGapType = t;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public void resetPostGap() {
|
||||
@@ -1414,6 +1459,8 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "post-gap", getPostGap()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "start-offset", getStartOffset()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "end-offset", getEndOffset()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "cross-start-offset", crossStartOffset));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "cross-end-offset", crossEndOffset));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "locked", isLocked()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "attention", getAttentionFlag()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "gain", getGain()));
|
||||
@@ -1422,6 +1469,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "samples", getSampleSize()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "processed", isProcessed()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "notes", getNotes()));
|
||||
sentenceNode.appendChild(Book.makeTextNode(doc, "time", getLength()));
|
||||
return sentenceNode;
|
||||
}
|
||||
|
||||
@@ -1431,7 +1479,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
|
||||
public void setProcessed(boolean p) {
|
||||
processed = p;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
reloadTree();
|
||||
}
|
||||
|
||||
public void setNotes(String n) {
|
||||
@@ -1446,4 +1494,10 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
||||
AudiobookRecorder.window.setSentenceNotes(notes);
|
||||
}
|
||||
|
||||
void reloadTree() {
|
||||
if (id.equals("room-noise")) return;
|
||||
if (getParent() == null) return;
|
||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class Utils {
|
||||
public static Image getScaledImage(Image srcImg, int w, int h){
|
||||
BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
|
||||
@@ -76,4 +78,12 @@ public class Utils {
|
||||
Runtime.getRuntime().freeMemory()
|
||||
));
|
||||
}
|
||||
|
||||
public static String secToTime(double sec, String fmt) {
|
||||
Date d = new Date((long)(sec * 1000d));
|
||||
SimpleDateFormat df = new SimpleDateFormat(fmt);
|
||||
df.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
String time = df.format(d);
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user