Moved opengl to CLI option

This commit is contained in:
2020-02-17 11:48:13 +00:00
parent 75873b9e8c
commit ed75718d34
3 changed files with 18 additions and 5 deletions

View File

@@ -315,12 +315,18 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
CLI.addParameter("debug", "", Boolean.class, "Enable debug output");
CLI.addParameter("trace", "", Boolean.class, "Enable function tracing");
CLI.addParameter("opengl", "", Boolean.class, "Enable OpenGL graphical acceleration");
String[] argv = CLI.process(args);
Debug.debugEnabled = CLI.isSet("debug");
Debug.traceEnabled = CLI.isSet("trace");
if (CLI.isSet("opengl")) {
Properties props = System.getProperties();
props.setProperty("sun.java2d.opengl", "true");
}
processQueue = new ArrayDeque<Runnable>();
try {
@@ -1080,8 +1086,6 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
public static void main(String args[]) {
Debug.trace();
Properties props = System.getProperties();
props.setProperty("sun.java2d.opengl", "true");
try {
config.load(AudiobookRecorder.class.getResourceAsStream("config.txt"));
} catch (Exception e) {

View File

@@ -522,6 +522,10 @@ public class Options extends JDialog {
validFormats.add(new AudioFormat(96000f, 16, 2, true, false));
validFormats.add(new AudioFormat(96000f, 24, 1, true, false));
validFormats.add(new AudioFormat(96000f, 24, 2, true, false));
validFormats.add(new AudioFormat(192000f, 16, 1, true, false));
validFormats.add(new AudioFormat(192000f, 16, 2, true, false));
validFormats.add(new AudioFormat(192000f, 24, 1, true, false));
validFormats.add(new AudioFormat(192000f, 24, 2, true, false));
Mixer.Info[] info = AudioSystem.getMixerInfo();
for (Mixer.Info i : info) {
@@ -554,10 +558,11 @@ public class Options extends JDialog {
}
static KVPair[] getSampleRateList() {
KVPair[] l = new KVPair[3];
KVPair[] l = new KVPair[4];
l[0] = new KVPair<String, String>("44100", "44100");
l[1] = new KVPair<String, String>("48000", "48000");
l[2] = new KVPair<String, String>("96000", "96000");
l[2] = new KVPair<String, String>("192000", "192000");
return l;
}
@@ -789,9 +794,10 @@ public class Options extends JDialog {
}
public static KVPair[] getResolutionList() {
KVPair[] pairs = new KVPair[2];
KVPair[] pairs = new KVPair[3];
pairs[0] = new KVPair<String, String>("16", "16 Bit");
pairs[1] = new KVPair<String, String>("24", "24 Bit");
pairs[1] = new KVPair<String, String>("32", "32 Bit");
return pairs;
}

View File

@@ -133,7 +133,10 @@ public class Sentence extends BookTreeNode implements Cacheable {
try {
running = true;
recording = true;
byte[] buf = new byte[1024]; //AudiobookRecorder.window.microphone.getBufferSize()];
final int numFrames = 512;
final int bufSize = numFrames * format.getFrameSize();
byte[] buf = new byte[bufSize]; //AudiobookRecorder.window.microphone.getBufferSize()];
FileOutputStream fos = new FileOutputStream(tempFile);
int len = 0;
Microphone.flush();