Fixes to effect and tree synchronisation
This commit is contained in:
@@ -204,6 +204,8 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
public Queue<Runnable>processQueue = null;
|
public Queue<Runnable>processQueue = null;
|
||||||
public QueueMonitor queueMonitor = null;
|
public QueueMonitor queueMonitor = null;
|
||||||
|
|
||||||
|
boolean effectsUpdating = false; // crude lock
|
||||||
|
|
||||||
void buildToolbar(Container ob) {
|
void buildToolbar(Container ob) {
|
||||||
Debug.trace();
|
Debug.trace();
|
||||||
toolBar = new MainToolBar(this);
|
toolBar = new MainToolBar(this);
|
||||||
@@ -637,10 +639,12 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Debug.trace();
|
Debug.trace();
|
||||||
Debug.d(e);
|
Debug.d(e);
|
||||||
|
if (effectsUpdating) return;
|
||||||
if (selectedSentence != null) {
|
if (selectedSentence != null) {
|
||||||
int i = effectChain.getSelectedIndex();
|
int i = effectChain.getSelectedIndex();
|
||||||
KVPair<String, String> p = effectChain.getItemAt(i);
|
KVPair<String, String> p = effectChain.getItemAt(i);
|
||||||
if (p == null) return;
|
if (p == null) return;
|
||||||
|
System.err.println("I want to select effect " + p.getKey());
|
||||||
selectedSentence.setEffectChain(p.getKey());
|
selectedSentence.setEffectChain(p.getKey());
|
||||||
updateWaveform(true);
|
updateWaveform(true);
|
||||||
}
|
}
|
||||||
@@ -823,8 +827,6 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
locked.setSelected(s.isLocked());
|
locked.setSelected(s.isLocked());
|
||||||
attention.setSelected(s.getAttentionFlag());
|
attention.setSelected(s.getAttentionFlag());
|
||||||
|
|
||||||
setEffectChain(s.getEffectChain());
|
|
||||||
|
|
||||||
postSentenceGap.setEnabled(!s.isLocked());
|
postSentenceGap.setEnabled(!s.isLocked());
|
||||||
gainPercent.setEnabled(!s.isLocked());
|
gainPercent.setEnabled(!s.isLocked());
|
||||||
reprocessAudioFFT.setEnabled(!s.isLocked());
|
reprocessAudioFFT.setEnabled(!s.isLocked());
|
||||||
@@ -3109,8 +3111,8 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
|
|
||||||
public void updateEffectChains(TreeMap<String, EffectGroup> effs) {
|
public void updateEffectChains(TreeMap<String, EffectGroup> effs) {
|
||||||
Debug.trace();
|
Debug.trace();
|
||||||
int sel = effectChain.getSelectedIndex();
|
effectsUpdating = true;
|
||||||
KVPair<String, String> ent = effectChain.getItemAt(sel);
|
System.err.println("Updating effect chains");
|
||||||
while (effectChain.getItemCount() > 0) {
|
while (effectChain.getItemCount() > 0) {
|
||||||
effectChain.removeItemAt(0);
|
effectChain.removeItemAt(0);
|
||||||
}
|
}
|
||||||
@@ -3122,15 +3124,40 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
KVPair<String, String> p = new KVPair<String, String>(k, e.toString());
|
KVPair<String, String> p = new KVPair<String, String>(k, e.toString());
|
||||||
effectChain.addItem(p);
|
effectChain.addItem(p);
|
||||||
}
|
}
|
||||||
if (ent != null) {
|
if (selectedSentence != null) {
|
||||||
setEffectChain(ent.getKey());
|
String key = selectedSentence.getEffectChain();
|
||||||
// } else {
|
for (int i = 0; i < effectChain.getItemCount(); i++) {
|
||||||
// setEffectChain(getBook().getDefaultEffect());
|
KVPair<String, String> p = effectChain.getItemAt(i);
|
||||||
|
if (p.getKey().equals(key)) {
|
||||||
|
effectChain.setSelectedIndex(i);
|
||||||
|
effectsUpdating = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
effectsUpdating = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showSelectedEffectChain(String key) {
|
||||||
|
Debug.trace();
|
||||||
|
effectsUpdating = true;
|
||||||
|
System.err.println("Looking for effect " + key + "...");
|
||||||
|
for (int i = 0; i < effectChain.getItemCount(); i++) {
|
||||||
|
KVPair<String, String> p = effectChain.getItemAt(i);
|
||||||
|
System.err.println(" Testing " + p.getKey() + "...");
|
||||||
|
if (p.getKey().equals(key)) {
|
||||||
|
System.err.println(" Found it.");
|
||||||
|
effectChain.setSelectedIndex(i);
|
||||||
|
effectsUpdating = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
effectsUpdating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEffectChain(String key) {
|
public void setEffectChain(String key) {
|
||||||
Debug.trace();
|
Debug.trace();
|
||||||
|
System.err.println("Setting effect " + key);
|
||||||
for (int i = 0; i < effectChain.getItemCount(); i++) {
|
for (int i = 0; i < effectChain.getItemCount(); i++) {
|
||||||
KVPair<String, String> p = effectChain.getItemAt(i);
|
KVPair<String, String> p = effectChain.getItemAt(i);
|
||||||
if (p.getKey().equals(key)) {
|
if (p.getKey().equals(key)) {
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ public class Book extends BookTreeNode {
|
|||||||
}
|
}
|
||||||
AudiobookRecorder.window.setBookNotes(notes);
|
AudiobookRecorder.window.setBookNotes(notes);
|
||||||
AudiobookRecorder.window.noiseFloorLabel.setNoiseFloor(getNoiseFloorDB());
|
AudiobookRecorder.window.noiseFloorLabel.setNoiseFloor(getNoiseFloorDB());
|
||||||
// AudiobookRecorder.window.updateEffectChains(effects);
|
AudiobookRecorder.window.updateEffectChains(effects);
|
||||||
TreeNode p = getParent();
|
TreeNode p = getParent();
|
||||||
if (p instanceof BookTreeNode) {
|
if (p instanceof BookTreeNode) {
|
||||||
BookTreeNode btn = (BookTreeNode)p;
|
BookTreeNode btn = (BookTreeNode)p;
|
||||||
@@ -594,9 +594,7 @@ public class Book extends BookTreeNode {
|
|||||||
Debug.trace();
|
Debug.trace();
|
||||||
effects = new TreeMap<String,EffectGroup>();
|
effects = new TreeMap<String,EffectGroup>();
|
||||||
loadEffectsFromFolder(new File(Options.get("path.storage"), "System"));
|
loadEffectsFromFolder(new File(Options.get("path.storage"), "System"));
|
||||||
if (location != null) {
|
loadEffectsFromFolder(getLocation());
|
||||||
loadEffectsFromFolder(location);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadEffectsFromFolder(File dir) {
|
public void loadEffectsFromFolder(File dir) {
|
||||||
|
|||||||
@@ -1763,6 +1763,7 @@ public class Sentence extends BookTreeNode implements Cacheable {
|
|||||||
Debug.trace();
|
Debug.trace();
|
||||||
AudiobookRecorder.setSelectedSentence(this);
|
AudiobookRecorder.setSelectedSentence(this);
|
||||||
AudiobookRecorder.window.setSentenceNotes(notes);
|
AudiobookRecorder.window.setSentenceNotes(notes);
|
||||||
|
AudiobookRecorder.window.showSelectedEffectChain(getEffectChain());
|
||||||
TreeNode p = getParent();
|
TreeNode p = getParent();
|
||||||
if (p instanceof BookTreeNode) {
|
if (p instanceof BookTreeNode) {
|
||||||
BookTreeNode btn = (BookTreeNode)p;
|
BookTreeNode btn = (BookTreeNode)p;
|
||||||
|
|||||||
Reference in New Issue
Block a user