Add refresh data button

This commit is contained in:
2020-02-10 11:45:23 +00:00
parent 785a4f1b7b
commit 13d8dc4612
5 changed files with 31 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -183,6 +183,8 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
JToggleButtonSpacePlay selectCutMode; JToggleButtonSpacePlay selectCutMode;
JButtonSpacePlay doCutSplit; JButtonSpacePlay doCutSplit;
JButtonSpacePlay refreshSentence;
JComboBox<KVPair<String,String>> effectChain; JComboBox<KVPair<String,String>> effectChain;
Thread playingThread = null; Thread playingThread = null;
@@ -574,6 +576,14 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
} }
}); });
refreshSentence = new JButtonSpacePlay(Icons.refresh, "Refresh Phrase Data", new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Debug.trace();
if (selectedSentence == null) return;
selectedSentence.refreshAllData();
}
});
controlsTop.add(attention); controlsTop.add(attention);
controlsTop.add(Box.createHorizontalGlue()); controlsTop.add(Box.createHorizontalGlue());
@@ -587,6 +597,8 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
controlsTop.add(Box.createHorizontalGlue()); controlsTop.add(Box.createHorizontalGlue());
controlsTop.add(refreshSentence);
JButtonSpacePlay zoomIn = new JButtonSpacePlay(Icons.zoomIn, "Zoom In", new ActionListener() { JButtonSpacePlay zoomIn = new JButtonSpacePlay(Icons.zoomIn, "Zoom In", new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@@ -98,7 +98,7 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
String effectChain = s.getEffectChain(); String effectChain = s.getEffectChain();
if ((effectChain != null) && (!effectChain.equals("none"))) { if ((effectChain != null) && (!effectChain.equals("none"))) {
Effect e = AudiobookRecorder.window.getBook().effects.get(effectChain); Effect e = s.getBook().effects.get(effectChain);
if (e != null) { if (e != null) {
JLabel eff = new JLabel(e.toString() + " "); JLabel eff = new JLabel(e.toString() + " ");
ctx.weightx = 0.0d; ctx.weightx = 0.0d;

View File

@@ -43,4 +43,5 @@ public class Icons {
static public final ImageIcon queued = new ImageIcon(Icons.class.getResource("icons/queued.png")); static public final ImageIcon queued = new ImageIcon(Icons.class.getResource("icons/queued.png"));
static public final ImageIcon processing = new ImageIcon(Icons.class.getResource("icons/processing.png")); static public final ImageIcon processing = new ImageIcon(Icons.class.getResource("icons/processing.png"));
static public final ImageIcon close = new ImageIcon(Icons.class.getResource("icons/close.png")); static public final ImageIcon close = new ImageIcon(Icons.class.getResource("icons/close.png"));
static public final ImageIcon refresh = new ImageIcon(Icons.class.getResource("icons/refresh.png"));
} }

View File

@@ -1762,4 +1762,21 @@ public class Sentence extends BookTreeNode implements Cacheable {
public void setParentBook(Book b) { public void setParentBook(Book b) {
parentBook = b; parentBook = b;
} }
public void refreshAllData() {
runtime = -1d;
peak = -1d;
sampleSize = -1;
audioData = null;
processedAudio = null;
fftProfile = null;
CacheManager.removeFromCache(this);
getProcessedAudioData();
getLength();
crossStartOffset = -1;
crossEndOffset = -1;
updateCrossings();
getPeakDB();
reloadTree();
}
} }