Partial 96kHz support

This commit is contained in:
2018-09-27 11:05:56 +01:00
parent fab11f5755
commit 981f9bd539
7 changed files with 100 additions and 6 deletions
@@ -1619,8 +1619,18 @@ public class AudiobookRecorder extends JFrame {
bookTree.setSelectionPath(new TreePath(s.getPath()));
}
}
play.drain();
play.stop();
play.close();
play = null;
} catch (Exception e) {
playing = null;
if (play != null) {
play.drain();
play.stop();
play.close();
}
play = null;
}
toolBar.enableSentence();
toolBar.disableStop();
@@ -1720,6 +1730,8 @@ public class AudiobookRecorder extends JFrame {
} catch (Exception e) {
e.printStackTrace();
}
microphone = null;
microphoneStream = null;
}
public void execScript(String s) {
@@ -56,11 +56,20 @@ public class Equaliser extends JPanel {
}
}
});
JButton load = new JButton("Load from default");
load.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for (int i = 0; i < 31; i++) {
channels[i].setValue(Options.getFloat("audio.eq." + i));
}
}
});
JPanel buttons = new JPanel();
buttons.setLayout(new FlowLayout());
buttons.add(smooth);
buttons.add(def);
buttons.add(load);
add(buttons, BorderLayout.SOUTH);
}
@@ -345,7 +345,7 @@ public class Options extends JDialog {
TreeSet<KVPair> list = new TreeSet<KVPair>();
AudioFormat stereoFormat = new AudioFormat(44100f, 16, 2, true, false);
AudioFormat monoFormat = new AudioFormat(44100f, 16, 2, true, false);
AudioFormat monoFormat = new AudioFormat(44100f, 16, 1, true, false);
DataLine.Info stereoDIF = new DataLine.Info(TargetDataLine.class, stereoFormat);
DataLine.Info monoDIF = new DataLine.Info(TargetDataLine.class, monoFormat);
@@ -381,7 +381,7 @@ public class Options extends JDialog {
TreeSet<KVPair> list = new TreeSet<KVPair>();
AudioFormat stereoFormat = new AudioFormat(44100f, 16, 2, true, false);
AudioFormat monoFormat = new AudioFormat(44100f, 16, 2, true, false);
AudioFormat monoFormat = new AudioFormat(44100f, 16, 1, true, false);
DataLine.Info stereoDIF = new DataLine.Info(SourceDataLine.class, stereoFormat);
DataLine.Info monoDIF = new DataLine.Info(SourceDataLine.class, monoFormat);
@@ -497,8 +497,8 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
AudioFormat format = eq.getFormat();
// IIRControls controls = eq.getControls();
// AudiobookRecorder.window.book.equaliser.apply(controls, format.getChannels());
IIRControls controls = eq.getControls();
AudiobookRecorder.window.book.equaliser.apply(controls, format.getChannels());
int frameSize = format.getFrameSize();
@@ -511,7 +511,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
play.start();
byte[] buffer = new byte[50000];
byte[] buffer = new byte[1024];
eq.skip(pos);
@@ -660,6 +660,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
public int findNearestZeroCrossing(int pos, int range) {
int[] data = getAudioData();
if (data == null) return 0;
if (data.length == 0) return 0;
if (pos < 0) pos = 0;
if (pos >= data.length) pos = data.length-1;
@@ -49,6 +49,7 @@ public class Waveform extends JPanel {
int num = samples.length;
int step = num / w;
if (step == 0) return;
for (int n = 0; n < w; n++) {
int hcnt = 0;