Added global effects disable and fixed caching problems
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -115,6 +115,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
SourceDataLine play = null;
|
SourceDataLine play = null;
|
||||||
|
|
||||||
|
boolean effectsEnabled = true;
|
||||||
|
|
||||||
public TargetDataLine microphone = null;
|
public TargetDataLine microphone = null;
|
||||||
public AudioInputStream microphoneStream = null;
|
public AudioInputStream microphoneStream = null;
|
||||||
|
|
||||||
@@ -395,7 +397,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedSentence != null) {
|
if (selectedSentence != null) {
|
||||||
selectedSentence.autoTrimSampleFFT();
|
selectedSentence.autoTrimSampleFFT();
|
||||||
sampleWaveform.setData(selectedSentence.getDoubleAudioData());
|
sampleWaveform.setData(selectedSentence.getDoubleAudioData(effectsEnabled));
|
||||||
sampleWaveform.setMarkers(selectedSentence.getStartOffset(), selectedSentence.getEndOffset());
|
sampleWaveform.setMarkers(selectedSentence.getStartOffset(), selectedSentence.getEndOffset());
|
||||||
sampleWaveform.setAltMarkers(selectedSentence.getStartCrossing(), selectedSentence.getEndCrossing());
|
sampleWaveform.setAltMarkers(selectedSentence.getStartCrossing(), selectedSentence.getEndCrossing());
|
||||||
postSentenceGap.setValue(selectedSentence.getPostGap());
|
postSentenceGap.setValue(selectedSentence.getPostGap());
|
||||||
@@ -408,7 +410,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedSentence != null) {
|
if (selectedSentence != null) {
|
||||||
selectedSentence.autoTrimSamplePeak();
|
selectedSentence.autoTrimSamplePeak();
|
||||||
sampleWaveform.setData(selectedSentence.getDoubleAudioData());
|
sampleWaveform.setData(selectedSentence.getDoubleAudioData(effectsEnabled));
|
||||||
sampleWaveform.setMarkers(selectedSentence.getStartOffset(), selectedSentence.getEndOffset());
|
sampleWaveform.setMarkers(selectedSentence.getStartOffset(), selectedSentence.getEndOffset());
|
||||||
sampleWaveform.setAltMarkers(selectedSentence.getStartCrossing(), selectedSentence.getEndCrossing());
|
sampleWaveform.setAltMarkers(selectedSentence.getStartCrossing(), selectedSentence.getEndCrossing());
|
||||||
postSentenceGap.setValue(selectedSentence.getPostGap());
|
postSentenceGap.setValue(selectedSentence.getPostGap());
|
||||||
@@ -421,7 +423,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedSentence != null) {
|
if (selectedSentence != null) {
|
||||||
selectedSentence.normalize();
|
selectedSentence.normalize();
|
||||||
sampleWaveform.setData(selectedSentence.getDoubleAudioData());
|
sampleWaveform.setData(selectedSentence.getDoubleAudioData(effectsEnabled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -464,7 +466,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
JSpinner ob = (JSpinner)e.getSource();
|
JSpinner ob = (JSpinner)e.getSource();
|
||||||
if (selectedSentence != null) {
|
if (selectedSentence != null) {
|
||||||
selectedSentence.setGain((Integer)ob.getValue() / 100d);
|
selectedSentence.setGain((Integer)ob.getValue() / 100d);
|
||||||
sampleWaveform.setData(selectedSentence.getDoubleAudioData());
|
sampleWaveform.setData(selectedSentence.getDoubleAudioData(effectsEnabled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -579,7 +581,6 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
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;
|
||||||
CacheManager.removeFromCache(selectedSentence);
|
|
||||||
selectedSentence.setEffectChain(p.getKey());
|
selectedSentence.setEffectChain(p.getKey());
|
||||||
updateWaveform();
|
updateWaveform();
|
||||||
}
|
}
|
||||||
@@ -1920,7 +1921,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
if (n instanceof Sentence) {
|
if (n instanceof Sentence) {
|
||||||
Sentence s = (Sentence)n;
|
Sentence s = (Sentence)n;
|
||||||
selectedSentence = s;
|
selectedSentence = s;
|
||||||
sampleWaveform.setData(s.getDoubleAudioData());
|
sampleWaveform.setData(s.getDoubleAudioData(effectsEnabled));
|
||||||
sampleWaveform.setMarkers(s.getStartOffset(), s.getEndOffset());
|
sampleWaveform.setMarkers(s.getStartOffset(), s.getEndOffset());
|
||||||
s.updateCrossings();
|
s.updateCrossings();
|
||||||
sampleWaveform.setAltMarkers(s.getStartCrossing(), s.getEndCrossing());
|
sampleWaveform.setAltMarkers(s.getStartCrossing(), s.getEndCrossing());
|
||||||
@@ -2184,7 +2185,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
play.drain();
|
play.drain();
|
||||||
|
|
||||||
bookTree.scrollPathToVisible(new TreePath(s.getPath()));
|
bookTree.scrollPathToVisible(new TreePath(s.getPath()));
|
||||||
data = s.getPCMData();
|
data = s.getPCMData(effectsEnabled);
|
||||||
for (int pos = 0; pos < data.length; pos += PLAYBACK_CHUNK_SIZE) {
|
for (int pos = 0; pos < data.length; pos += PLAYBACK_CHUNK_SIZE) {
|
||||||
sampleWaveform.setPlayMarker(pos / format.getFrameSize());
|
sampleWaveform.setPlayMarker(pos / format.getFrameSize());
|
||||||
int l = data.length - pos;
|
int l = data.length - pos;
|
||||||
@@ -2280,7 +2281,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
play.drain();
|
play.drain();
|
||||||
|
|
||||||
bookTree.scrollPathToVisible(new TreePath(s.getPath()));
|
bookTree.scrollPathToVisible(new TreePath(s.getPath()));
|
||||||
data = s.getPCMData();
|
data = s.getPCMData(effectsEnabled);
|
||||||
|
|
||||||
int startPos = 0;
|
int startPos = 0;
|
||||||
int endPos = data.length / format.getFrameSize();
|
int endPos = data.length / format.getFrameSize();
|
||||||
@@ -2367,17 +2368,17 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
data = getRoomNoise(Utils.s2i(Options.get("catenation.pre-chapter")));
|
data = getRoomNoise(Utils.s2i(Options.get("catenation.pre-chapter")));
|
||||||
play.write(data, 0, data.length);
|
play.write(data, 0, data.length);
|
||||||
}
|
}
|
||||||
data = s.getPCMData();
|
data = s.getPCMData(effectsEnabled);
|
||||||
DefaultMutableTreeNode next = s.getNextSibling();
|
DefaultMutableTreeNode next = s.getNextSibling();
|
||||||
// if (next != null) {
|
if (next != null) {
|
||||||
// Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
// public void run() {
|
public void run() {
|
||||||
// Sentence ns = (Sentence)next;
|
Sentence ns = (Sentence)next;
|
||||||
// ns.getProcessedAudioData(); // Cache it
|
ns.getProcessedAudioData(effectsEnabled); // Cache it
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// t.start();
|
t.start();
|
||||||
// }
|
}
|
||||||
for (int pos = 0; pos < data.length; pos += PLAYBACK_CHUNK_SIZE) {
|
for (int pos = 0; pos < data.length; pos += PLAYBACK_CHUNK_SIZE) {
|
||||||
sampleWaveform.setPlayMarker(pos / format.getFrameSize());
|
sampleWaveform.setPlayMarker(pos / format.getFrameSize());
|
||||||
int l = data.length - pos;
|
int l = data.length - pos;
|
||||||
@@ -2904,7 +2905,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
if (rawAudio.isSelected()) {
|
if (rawAudio.isSelected()) {
|
||||||
sampleWaveform.setData(selectedSentence.getRawAudioData());
|
sampleWaveform.setData(selectedSentence.getRawAudioData());
|
||||||
} else {
|
} else {
|
||||||
sampleWaveform.setData(selectedSentence.getDoubleAudioData());
|
sampleWaveform.setData(selectedSentence.getDoubleAudioData(effectsEnabled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3313,4 +3314,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
doCutSplit.setEnabled(false);
|
doCutSplit.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEffectsEnabled(boolean b) {
|
||||||
|
effectsEnabled = b;
|
||||||
|
System.err.println("Effects Enabled: " + b);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ public class CacheManager {
|
|||||||
if (ob.lockedInCache()) {
|
if (ob.lockedInCache()) {
|
||||||
cache.add(ob);
|
cache.add(ob);
|
||||||
} else {
|
} else {
|
||||||
|
if (ob instanceof Sentence) {
|
||||||
|
Sentence s = (Sentence)ob;
|
||||||
|
s.debug("Normal removal from cache");
|
||||||
|
}
|
||||||
ob.clearCache();
|
ob.clearCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,6 +31,10 @@ public class CacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeFromCache(Cacheable c) {
|
public static void removeFromCache(Cacheable c) {
|
||||||
|
if (c instanceof Sentence) {
|
||||||
|
Sentence s = (Sentence)c;
|
||||||
|
s.debug("Manual removal from cache");
|
||||||
|
}
|
||||||
cache.remove(c);
|
cache.remove(c);
|
||||||
c.clearCache();
|
c.clearCache();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,5 @@ public class Icons {
|
|||||||
static public final ImageIcon cut = new ImageIcon(Icons.class.getResource("icons/cut.png"));
|
static public final ImageIcon cut = new ImageIcon(Icons.class.getResource("icons/cut.png"));
|
||||||
static public final ImageIcon docut = new ImageIcon(Icons.class.getResource("icons/do-cut.png"));
|
static public final ImageIcon docut = new ImageIcon(Icons.class.getResource("icons/do-cut.png"));
|
||||||
static public final ImageIcon playto = new ImageIcon(Icons.class.getResource("icons/play-to.png"));
|
static public final ImageIcon playto = new ImageIcon(Icons.class.getResource("icons/play-to.png"));
|
||||||
|
static public final ImageIcon disable = new ImageIcon(Icons.class.getResource("icons/disable-effects.png"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ public class MainToolBar extends JToolBar {
|
|||||||
JButtonSpacePlay playtoSentence;
|
JButtonSpacePlay playtoSentence;
|
||||||
JButtonSpacePlay stopPlaying;
|
JButtonSpacePlay stopPlaying;
|
||||||
JButtonSpacePlay eq;
|
JButtonSpacePlay eq;
|
||||||
JToggleButton mic;
|
JToggleButtonSpacePlay mic;
|
||||||
|
|
||||||
|
JToggleButtonSpacePlay disableEffects;
|
||||||
|
|
||||||
AudiobookRecorder root;
|
AudiobookRecorder root;
|
||||||
|
|
||||||
@@ -129,6 +131,28 @@ public class MainToolBar extends JToolBar {
|
|||||||
|
|
||||||
add(mic);
|
add(mic);
|
||||||
|
|
||||||
|
addSeparator();
|
||||||
|
|
||||||
|
disableEffects = new JToggleButtonSpacePlay(Icons.disable, "Disable effects", new ActionListener() {
|
||||||
|
Color bgCol = null;
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JToggleButton b = (JToggleButton)e.getSource();
|
||||||
|
if (b.isSelected()) {
|
||||||
|
root.setEffectsEnabled(false);
|
||||||
|
bgCol = b.getBackground();
|
||||||
|
b.setBackground(Color.RED);
|
||||||
|
} else {
|
||||||
|
root.setEffectsEnabled(true);
|
||||||
|
if (bgCol != null) {
|
||||||
|
b.setBackground(bgCol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
add(disableEffects);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setFloatable(false);
|
setFloatable(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("Start recording based purge");
|
||||||
CacheManager.removeFromCache(this);
|
CacheManager.removeFromCache(this);
|
||||||
|
|
||||||
recordingThread = new RecordingThread(getTempFile(), getFile(), Options.getAudioFormat());
|
recordingThread = new RecordingThread(getTempFile(), getFile(), Options.getAudioFormat());
|
||||||
@@ -182,11 +183,9 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("Stop recording based purge");
|
||||||
CacheManager.removeFromCache(this);
|
CacheManager.removeFromCache(this);
|
||||||
|
|
||||||
audioData = null;
|
|
||||||
processedAudio = null;
|
|
||||||
|
|
||||||
if (!id.equals("room-noise")) {
|
if (!id.equals("room-noise")) {
|
||||||
autoTrimSample(true);
|
autoTrimSample(true);
|
||||||
if (Options.getBoolean("process.sphinx")) {
|
if (Options.getBoolean("process.sphinx")) {
|
||||||
@@ -225,7 +224,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
samples = getProcessedAudioData();
|
samples = getProcessedAudioData();
|
||||||
}
|
}
|
||||||
if (samples == null) {
|
if (samples == null) {
|
||||||
System.err.println("Error: loading data failed!");
|
debug("Error: loading data failed!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,6 +587,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
|
debug("Clearing cached data");
|
||||||
audioData = null;
|
audioData = null;
|
||||||
processedAudio = null;
|
processedAudio = null;
|
||||||
storedFormat = null;
|
storedFormat = null;
|
||||||
@@ -721,6 +721,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
if (g == gain) return;
|
if (g == gain) return;
|
||||||
|
|
||||||
if (gain != g) {
|
if (gain != g) {
|
||||||
|
debug("Gain based purge");
|
||||||
CacheManager.removeFromCache(this);
|
CacheManager.removeFromCache(this);
|
||||||
}
|
}
|
||||||
gain = g;
|
gain = g;
|
||||||
@@ -767,6 +768,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
proc.waitFor();
|
proc.waitFor();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
debug("External editor based purge");
|
||||||
CacheManager.removeFromCache(Sentence.this);
|
CacheManager.removeFromCache(Sentence.this);
|
||||||
AudiobookRecorder.window.updateWaveform();
|
AudiobookRecorder.window.updateWaveform();
|
||||||
}
|
}
|
||||||
@@ -793,7 +795,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (backupNumber == -1) {
|
if (backupNumber == -1) {
|
||||||
System.err.println("Out of backup space!");
|
debug("Out of backup space!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,6 +859,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("External processor based purge");
|
||||||
CacheManager.removeFromCache(Sentence.this);
|
CacheManager.removeFromCache(Sentence.this);
|
||||||
AudiobookRecorder.window.updateWaveform();
|
AudiobookRecorder.window.updateWaveform();
|
||||||
}
|
}
|
||||||
@@ -900,6 +903,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("Undo based purge");
|
||||||
CacheManager.removeFromCache(this);
|
CacheManager.removeFromCache(this);
|
||||||
AudiobookRecorder.window.updateWaveform();
|
AudiobookRecorder.window.updateWaveform();
|
||||||
}
|
}
|
||||||
@@ -1074,6 +1078,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("Write based purge");
|
||||||
CacheManager.removeFromCache(this);
|
CacheManager.removeFromCache(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1124,7 +1129,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
File f = getFile();
|
File f = getFile();
|
||||||
try {
|
try {
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
System.err.println("TODO: Race condition: wav file doesn't exist yet");
|
debug("TODO: Race condition: wav file doesn't exist yet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AudioInputStream s = AudioSystem.getAudioInputStream(f);
|
AudioInputStream s = AudioSystem.getAudioInputStream(f);
|
||||||
@@ -1156,8 +1161,15 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized public double[][] getProcessedAudioData() {
|
synchronized public double[][] getProcessedAudioData() {
|
||||||
|
return getProcessedAudioData(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public double[][] getProcessedAudioData(boolean effectsEnabled) {
|
||||||
loadFile();
|
loadFile();
|
||||||
if (processedAudio != null) return processedAudio;
|
if (processedAudio != null) {
|
||||||
|
debug("Returning cached data");
|
||||||
|
return processedAudio;
|
||||||
|
}
|
||||||
|
|
||||||
if (audioData == null) return null;
|
if (audioData == null) return null;
|
||||||
processedAudio = new double[audioData.length][2];
|
processedAudio = new double[audioData.length][2];
|
||||||
@@ -1171,21 +1183,26 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
String def = AudiobookRecorder.window.getDefaultEffectsChain();
|
String def = AudiobookRecorder.window.getDefaultEffectsChain();
|
||||||
Effect eff = AudiobookRecorder.window.effects.get(def);
|
Effect eff = AudiobookRecorder.window.effects.get(def);
|
||||||
|
|
||||||
if (eff != null) {
|
if (effectsEnabled) {
|
||||||
eff.init(getAudioFormat().getFrameRate());
|
debug("Processing audio effects");
|
||||||
eff.process(processedAudio);
|
if (eff != null) {
|
||||||
}
|
eff.init(getAudioFormat().getFrameRate());
|
||||||
|
eff.process(processedAudio);
|
||||||
|
}
|
||||||
|
|
||||||
if (effectChain != null) {
|
if (effectChain != null) {
|
||||||
// Don't double up the default chain
|
// Don't double up the default chain
|
||||||
if (!effectChain.equals(def)) {
|
if (!effectChain.equals(def)) {
|
||||||
eff = AudiobookRecorder.window.effects.get(effectChain);
|
eff = AudiobookRecorder.window.effects.get(effectChain);
|
||||||
if (eff != null) {
|
if (eff != null) {
|
||||||
eff.init(getAudioFormat().getFrameRate());
|
eff.init(getAudioFormat().getFrameRate());
|
||||||
eff.process(processedAudio);
|
eff.process(processedAudio);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("Processing done");
|
||||||
|
|
||||||
// Add final master gain stage
|
// Add final master gain stage
|
||||||
for (int i = 0; i < processedAudio.length; i++) {
|
for (int i = 0; i < processedAudio.length; i++) {
|
||||||
@@ -1193,15 +1210,25 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
processedAudio[i][RIGHT] *= gain;
|
processedAudio[i][RIGHT] *= gain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("Gain applied");
|
||||||
|
|
||||||
return processedAudio;
|
return processedAudio;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double[][] getDoubleAudioData() {
|
public double[][] getDoubleAudioData() {
|
||||||
return getProcessedAudioData();
|
return getDoubleAudioData(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[][] getDoubleAudioData(boolean effectsEnabled) {
|
||||||
|
return getProcessedAudioData(effectsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double[][] getCroppedAudioData() {
|
public double[][] getCroppedAudioData() {
|
||||||
double[][] inSamples = getDoubleAudioData();
|
return getCroppedAudioData(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[][] getCroppedAudioData(boolean effectsEnabled) {
|
||||||
|
double[][] inSamples = getDoubleAudioData(effectsEnabled);
|
||||||
if (inSamples == null) return null;
|
if (inSamples == null) return null;
|
||||||
updateCrossings();
|
updateCrossings();
|
||||||
|
|
||||||
@@ -1216,7 +1243,11 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getPCMData() {
|
public byte[] getPCMData() {
|
||||||
double[][] croppedData = getCroppedAudioData();
|
return getPCMData(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getPCMData(boolean effectsEnabled) {
|
||||||
|
double[][] croppedData = getCroppedAudioData(effectsEnabled);
|
||||||
if (croppedData == null) return null;
|
if (croppedData == null) return null;
|
||||||
int length = croppedData.length;
|
int length = croppedData.length;
|
||||||
byte[] pcmData = new byte[length * 4];
|
byte[] pcmData = new byte[length * 4];
|
||||||
@@ -1239,6 +1270,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
|
|
||||||
public void setEffectChain(String key) {
|
public void setEffectChain(String key) {
|
||||||
if ((effectChain != null) && (!effectChain.equals(key))) {
|
if ((effectChain != null) && (!effectChain.equals(key))) {
|
||||||
|
debug("Effects chain based purge");
|
||||||
CacheManager.removeFromCache(this);
|
CacheManager.removeFromCache(this);
|
||||||
}
|
}
|
||||||
effectChain = key;
|
effectChain = key;
|
||||||
@@ -1285,4 +1317,8 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void debug(String txt) {
|
||||||
|
System.err.println(id + ": " + txt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user