Added options tooltips
This commit is contained in:
BIN
deps/commons-lang3.jar
LFS
vendored
Normal file
BIN
deps/commons-lang3.jar
LFS
vendored
Normal file
Binary file not shown.
BIN
deps/commons-text.jar
LFS
vendored
Normal file
BIN
deps/commons-text.jar
LFS
vendored
Normal file
Binary file not shown.
BIN
resources/uk/co/majenko/audiobookrecorder/icons/tooltip.png
Normal file
BIN
resources/uk/co/majenko/audiobookrecorder/icons/tooltip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -4106,7 +4106,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
String filename = f.getName();
|
String filename = f.getName();
|
||||||
if (filename.startsWith(".")) continue;
|
if (filename.startsWith(".")) continue;
|
||||||
if (filename.startsWith("backup")) continue;
|
if (filename.startsWith("backup")) continue;
|
||||||
if (filename.equals("room-noise")) continue;
|
if (filename.equals("room-noise.wav")) continue;
|
||||||
if (filename.endsWith(".wav")) {
|
if (filename.endsWith(".wav")) {
|
||||||
String id = filename.substring(0, filename.length() - 4);
|
String id = filename.substring(0, filename.length() - 4);
|
||||||
Debug.d("Testing orphanicity of", id);
|
Debug.d("Testing orphanicity of", id);
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public class Icons {
|
|||||||
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"));
|
static public final ImageIcon disable = new ImageIcon(Icons.class.getResource("icons/disable-effects.png"));
|
||||||
static public final ImageIcon manuscript = new ImageIcon(Icons.class.getResource("icons/manuscript.png"));
|
static public final ImageIcon manuscript = new ImageIcon(Icons.class.getResource("icons/manuscript.png"));
|
||||||
|
static public final ImageIcon tooltip = new ImageIcon(Icons.class.getResource("icons/tooltip.png"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ import java.util.prefs.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import javax.swing.tree.*;
|
import javax.swing.tree.*;
|
||||||
|
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
|
||||||
public class Options extends JDialog {
|
public class Options extends JDialog {
|
||||||
|
|
||||||
JTabbedPane tabs;
|
JTabbedPane tabs;
|
||||||
|
|
||||||
GridBagConstraints constraint;
|
GridBagConstraints constraint;
|
||||||
|
|
||||||
public static ArrayList<EffectGroup> effectChains;
|
|
||||||
|
|
||||||
JComboBox<KVPair> mixerList;
|
JComboBox<KVPair> mixerList;
|
||||||
JComboBox<KVPair> playbackList;
|
JComboBox<KVPair> playbackList;
|
||||||
JComboBox<KVPair> channelList;
|
JComboBox<KVPair> channelList;
|
||||||
@@ -72,7 +72,7 @@ public class Options extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JComboBox<KVPair> addDropdown(JPanel panel, String label, KVPair[] options, String def) {
|
JComboBox<KVPair> addDropdown(JPanel panel, String label, KVPair[] options, String def, String tip) {
|
||||||
JLabel l = new JLabel(label);
|
JLabel l = new JLabel(label);
|
||||||
constraint.gridx = 0;
|
constraint.gridx = 0;
|
||||||
constraint.gridwidth = 1;
|
constraint.gridwidth = 1;
|
||||||
@@ -83,6 +83,9 @@ public class Options extends JDialog {
|
|||||||
JComboBox<KVPair> o = new JComboBox<KVPair>(options);
|
JComboBox<KVPair> o = new JComboBox<KVPair>(options);
|
||||||
constraint.gridx = 1;
|
constraint.gridx = 1;
|
||||||
panel.add(o, constraint);
|
panel.add(o, constraint);
|
||||||
|
Tip t = new Tip(tip);
|
||||||
|
constraint.gridx = 2;
|
||||||
|
panel.add(t, constraint);
|
||||||
|
|
||||||
for (KVPair p : options) {
|
for (KVPair p : options) {
|
||||||
if (p.key.equals(def)) {
|
if (p.key.equals(def)) {
|
||||||
@@ -113,7 +116,7 @@ public class Options extends JDialog {
|
|||||||
constraint.gridy++;
|
constraint.gridy++;
|
||||||
}
|
}
|
||||||
|
|
||||||
JTextField addTextField(JPanel panel, String label, String def) {
|
JTextField addTextField(JPanel panel, String label, String def, String tip) {
|
||||||
JLabel l = new JLabel(label);
|
JLabel l = new JLabel(label);
|
||||||
constraint.gridx = 0;
|
constraint.gridx = 0;
|
||||||
constraint.gridwidth = 1;
|
constraint.gridwidth = 1;
|
||||||
@@ -127,13 +130,18 @@ public class Options extends JDialog {
|
|||||||
constraint.fill = GridBagConstraints.HORIZONTAL;
|
constraint.fill = GridBagConstraints.HORIZONTAL;
|
||||||
panel.add(a, constraint);
|
panel.add(a, constraint);
|
||||||
|
|
||||||
|
Tip t = new Tip(tip);
|
||||||
|
constraint.gridx = 2;
|
||||||
|
panel.add(t, constraint);
|
||||||
|
|
||||||
|
|
||||||
constraint.fill = GridBagConstraints.NONE;
|
constraint.fill = GridBagConstraints.NONE;
|
||||||
|
|
||||||
constraint.gridy++;
|
constraint.gridy++;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
JTextField[] addTwoField(JPanel panel, String def1, String def2) {
|
JTextField[] addTwoField(JPanel panel, String def1, String def2, String tip) {
|
||||||
JTextField a = new JTextField(def1);
|
JTextField a = new JTextField(def1);
|
||||||
constraint.gridx = 0;
|
constraint.gridx = 0;
|
||||||
constraint.fill = GridBagConstraints.HORIZONTAL;
|
constraint.fill = GridBagConstraints.HORIZONTAL;
|
||||||
@@ -144,13 +152,18 @@ public class Options extends JDialog {
|
|||||||
panel.add(b, constraint);
|
panel.add(b, constraint);
|
||||||
constraint.fill = GridBagConstraints.NONE;
|
constraint.fill = GridBagConstraints.NONE;
|
||||||
|
|
||||||
|
Tip t = new Tip(tip);
|
||||||
|
constraint.gridx = 2;
|
||||||
|
panel.add(t, constraint);
|
||||||
|
|
||||||
|
|
||||||
constraint.gridy++;
|
constraint.gridy++;
|
||||||
return new JTextField[] { a, b };
|
return new JTextField[] { a, b };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JTextField addFilePath(JPanel panel, String label, String path, boolean dironly) {
|
JTextField addFilePath(JPanel panel, String label, String path, boolean dironly, String tip) {
|
||||||
JLabel l = new JLabel(label);
|
JLabel l = new JLabel(label);
|
||||||
constraint.gridx = 0;
|
constraint.gridx = 0;
|
||||||
constraint.gridwidth = 1;
|
constraint.gridwidth = 1;
|
||||||
@@ -212,6 +225,10 @@ public class Options extends JDialog {
|
|||||||
constraint.fill = GridBagConstraints.HORIZONTAL;
|
constraint.fill = GridBagConstraints.HORIZONTAL;
|
||||||
panel.add(p, constraint);
|
panel.add(p, constraint);
|
||||||
|
|
||||||
|
Tip t = new Tip(tip);
|
||||||
|
constraint.gridx = 2;
|
||||||
|
panel.add(t, constraint);
|
||||||
|
|
||||||
constraint.fill = GridBagConstraints.NONE;
|
constraint.fill = GridBagConstraints.NONE;
|
||||||
|
|
||||||
constraint.gridy++;
|
constraint.gridy++;
|
||||||
@@ -238,7 +255,7 @@ public class Options extends JDialog {
|
|||||||
constraint.gridy++;
|
constraint.gridy++;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSpinner addSpinner(JPanel panel, String label, int min, int max, int step, int value, String suffix) {
|
JSpinner addSpinner(JPanel panel, String label, int min, int max, int step, int value, String suffix, String tip) {
|
||||||
JLabel l = new JLabel(label);
|
JLabel l = new JLabel(label);
|
||||||
constraint.gridx = 0;
|
constraint.gridx = 0;
|
||||||
constraint.gridwidth = 1;
|
constraint.gridwidth = 1;
|
||||||
@@ -258,6 +275,10 @@ public class Options extends JDialog {
|
|||||||
|
|
||||||
constraint.fill = GridBagConstraints.HORIZONTAL;
|
constraint.fill = GridBagConstraints.HORIZONTAL;
|
||||||
panel.add(p, constraint);
|
panel.add(p, constraint);
|
||||||
|
Tip t = new Tip(tip);
|
||||||
|
constraint.gridx = 2;
|
||||||
|
panel.add(t, constraint);
|
||||||
|
|
||||||
|
|
||||||
constraint.fill = GridBagConstraints.NONE;
|
constraint.fill = GridBagConstraints.NONE;
|
||||||
|
|
||||||
@@ -266,11 +287,16 @@ public class Options extends JDialog {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JCheckBox addCheckBox(JPanel panel, String label, boolean state) {
|
JCheckBox addCheckBox(JPanel panel, String label, boolean state, String tip) {
|
||||||
constraint.gridx = 1;
|
constraint.gridx = 1;
|
||||||
JCheckBox cb = new JCheckBox(label);
|
JCheckBox cb = new JCheckBox(label);
|
||||||
cb.setSelected(state);
|
cb.setSelected(state);
|
||||||
panel.add(cb, constraint);
|
panel.add(cb, constraint);
|
||||||
|
Tip t = new Tip(tip);
|
||||||
|
constraint.gridx = 2;
|
||||||
|
panel.add(t, constraint);
|
||||||
|
|
||||||
|
|
||||||
constraint.gridy++;
|
constraint.gridy++;
|
||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
@@ -298,95 +324,71 @@ public class Options extends JDialog {
|
|||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
|
|
||||||
mixerList = addDropdown(optionsPanel, "Recording device:", getRecordingMixerList(), get("audio.recording.device"));
|
mixerList = addDropdown(optionsPanel, "Recording device:", getRecordingMixerList(), get("audio.recording.device"), "This is the system device to record through");
|
||||||
channelList = addDropdown(optionsPanel, "Channels:", getChannelCountList(), get("audio.recording.channels"));
|
channelList = addDropdown(optionsPanel, "Channels:", getChannelCountList(), get("audio.recording.channels"), "How many channels do you want to record - stereo or mono?");
|
||||||
rateList = addDropdown(optionsPanel, "Sample rate:", getSampleRateList(), get("audio.recording.samplerate"));
|
rateList = addDropdown(optionsPanel, "Sample rate:", getSampleRateList(), get("audio.recording.samplerate"), "The higher the sample rate the better the quality, but the bigger the files.");
|
||||||
bitDepth = addDropdown(optionsPanel, "Sample resolution:", getResolutionList(), get("audio.recording.resolution"));
|
bitDepth = addDropdown(optionsPanel, "Sample resolution:", getResolutionList(), get("audio.recording.resolution"), "The higher the resolution the better the quality, but the bigger the files.");
|
||||||
trimMethod = addDropdown(optionsPanel, "Auto-trim method:", getTrimMethods(), get("audio.recording.trim"));
|
trimMethod = addDropdown(optionsPanel, "Auto-trim method:", getTrimMethods(), get("audio.recording.trim"), "None: don't auto-trim. FFT: Compare the FFT profile of blocks to the room noise profile and trim silent blocks, Peak: Look for the start and end rise and fall points");
|
||||||
fftThreshold = addSpinner(optionsPanel, "FFT threshold:", 0, 100, 1, getInteger("audio.recording.trim.fft"), "");
|
fftThreshold = addSpinner(optionsPanel, "FFT threshold:", 0, 100, 1, getInteger("audio.recording.trim.fft"), "", "This specifies the difference (in hundredths) between the power of FFT buckets in a sample block compared to the overall power of the same FFT bucket in the room noise. Raising this number makes the FFT trimming less sensitive.");
|
||||||
fftBlockSize = addDropdown(optionsPanel, "FFT Block size:", getFFTBlockSizes(), get("audio.recording.trim.blocksize"));
|
fftBlockSize = addDropdown(optionsPanel, "FFT Block size:", getFFTBlockSizes(), get("audio.recording.trim.blocksize"), "How large an FFT block should be when processing. Larger values increase sensitivity but at the epxense of resolution.");
|
||||||
maxGainVariance = addSpinner(optionsPanel, "Maximum gain variance:", 0, 100, 1, getInteger("audio.recording.variance"), "");
|
maxGainVariance = addSpinner(optionsPanel, "Maximum gain variance:", 0, 100, 1, getInteger("audio.recording.variance"), "", "This is how much the gain is allowed to vary by from phrase to phrase when normalizing an entire chapter.");
|
||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
|
|
||||||
playbackList = addDropdown(optionsPanel, "Playback device:", getPlaybackMixerList(), get("audio.playback.device"));
|
playbackList = addDropdown(optionsPanel, "Playback device:", getPlaybackMixerList(), get("audio.playback.device"), "Which device to play back through");
|
||||||
playbackBlockSize = addDropdown(optionsPanel, "Playback Block size:", getPlaybackBlockSizes(), get("audio.playback.blocksize"));
|
playbackBlockSize = addDropdown(optionsPanel, "Playback Block size:", getPlaybackBlockSizes(), get("audio.playback.blocksize"), "How big the playback buffer should be. Larger is smoother playback but the playback marker in the waveform becomes more out of sync");
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
storageFolder = addFilePath(optionsPanel, "Storage folder:", get("path.storage"), true);
|
storageFolder = addFilePath(optionsPanel, "Storage folder:", get("path.storage"), true, "This is where all your working audiobooks are stored.");
|
||||||
archiveFolder = addFilePath(optionsPanel, "Archive folder:", get("path.archive"), true);
|
archiveFolder = addFilePath(optionsPanel, "Archive folder:", get("path.archive"), true, "This is where audiobooks are archived to.");
|
||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
|
|
||||||
preChapterGap = addSpinner(optionsPanel, "Default pre-chapter gap:", 0, 5000, 100, getInteger("catenation.pre-chapter"), "ms");
|
preChapterGap = addSpinner(optionsPanel, "Default pre-chapter gap:", 0, 5000, 100, getInteger("catenation.pre-chapter"), "ms", "How much room noise to add at the beginning of a chapter.");
|
||||||
postChapterGap = addSpinner(optionsPanel, "Default post-chapter gap:", 0, 5000, 100, getInteger("catenation.post-chapter"), "ms");
|
postChapterGap = addSpinner(optionsPanel, "Default post-chapter gap:", 0, 5000, 100, getInteger("catenation.post-chapter"), "ms", "How much room noise to add to the end of a chapter.");
|
||||||
postSentenceGap = addSpinner(optionsPanel, "Default post-sentence gap:", 0, 5000, 100, getInteger("catenation.post-sentence"), "ms");
|
postSentenceGap = addSpinner(optionsPanel, "Default post-sentence gap:", 0, 5000, 100, getInteger("catenation.post-sentence"), "ms", "How much room noise to add between normal sentences.");
|
||||||
shortSentenceGap = addSpinner(optionsPanel, "Short post-sentence gap:", 0, 5000, 100, getInteger("catenation.short-sentence"), "ms");
|
shortSentenceGap = addSpinner(optionsPanel, "Short post-sentence gap:", 0, 5000, 100, getInteger("catenation.short-sentence"), "ms", "How much room noise to add between 'continuations'.");
|
||||||
postParagraphGap = addSpinner(optionsPanel, "Default post-paragraph gap:", 0, 5000, 100, getInteger("catenation.post-paragraph"), "ms");
|
postParagraphGap = addSpinner(optionsPanel, "Default post-paragraph gap:", 0, 5000, 100, getInteger("catenation.post-paragraph"), "ms", "How much room noise to add between paragraphs.");
|
||||||
postSectionGap = addSpinner(optionsPanel, "Default post-section gap:", 0, 5000, 100, getInteger("catenation.post-section"), "ms");
|
postSectionGap = addSpinner(optionsPanel, "Default post-section gap:", 0, 5000, 100, getInteger("catenation.post-section"), "ms", "How much room noise to add between sections.");
|
||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
|
|
||||||
ffmpegLocation = addFilePath(optionsPanel, "FFMPEG location:", get("path.ffmpeg"), false);
|
ffmpegLocation = addFilePath(optionsPanel, "FFMPEG location:", get("path.ffmpeg"), false, "Path to your ffmpeg executable.");
|
||||||
bitRate = addDropdown(optionsPanel, "Export bitrate:", getBitrates(), get("audio.export.bitrate"));
|
bitRate = addDropdown(optionsPanel, "Export bitrate:", getBitrates(), get("audio.export.bitrate"), "The MP3 bitrate to produce");
|
||||||
channels = addDropdown(optionsPanel, "Export channels:", getChannelCountList(), get("audio.export.channels"));
|
channels = addDropdown(optionsPanel, "Export channels:", getChannelCountList(), get("audio.export.channels"), "Mono or stereo MP3 production");
|
||||||
exportRate = addDropdown(optionsPanel, "Export sample rate:", getSampleRateList(), get("audio.export.samplerate"));
|
exportRate = addDropdown(optionsPanel, "Export sample rate:", getSampleRateList(), get("audio.export.samplerate"), "Sample frequency of the produced MP3");
|
||||||
|
|
||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
|
|
||||||
enableParsing = addCheckBox(optionsPanel, "Enable automatic speech-to-text (**SLOW**)", getBoolean("process.sphinx"));
|
enableParsing = addCheckBox(optionsPanel, "Enable automatic speech-to-text (**SLOW**)", getBoolean("process.sphinx"), "This will automatically start recognising the speech in every sentence you record. This can really slow down recording though so it's recommended to leave it turned off and do your recognition afterwards as a batch operation.");
|
||||||
speechCommand = addTextField(optionsPanel, "Speech to text command (must take 1 filename parameter):", get("process.command"));
|
speechCommand = addTextField(optionsPanel, "Speech to text command (must take 1 filename parameter):", get("process.command"), "This specifies what command to run to recognize the speech. This command must take only one parameter, which is the full path of the WAV file. It should return (on standard output) the recognised speech.");
|
||||||
workerThreads = addSpinner(optionsPanel, "Worker threads:", 1, 100, 1, getInteger("process.threads"), "");
|
workerThreads = addSpinner(optionsPanel, "Worker threads:", 1, 100, 1, getInteger("process.threads"), "", "How many concurrent threads to run when processing speech. This should ideally be no more than the number of CPU cores you have in your computer.");
|
||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
|
|
||||||
externalEditor = addTextField(optionsPanel, "External Editor Command", get("editor.external"));
|
externalEditor = addTextField(optionsPanel, "External Editor Command", get("editor.external"), "The program to run when you select 'Open in external editor'.");
|
||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
|
|
||||||
cacheSize = addSpinner(optionsPanel, "Cache size:", 2, 100, 1, getInteger("cache.size"), "");
|
cacheSize = addSpinner(optionsPanel, "Cache size:", 2, 100, 1, getInteger("cache.size"), "", "How many phrases to keep cached in memory at once. More gives a smoother editing experience, but you can easily run out of memory if you are not careful.");
|
||||||
|
|
||||||
addSeparator(optionsPanel);
|
addSeparator(optionsPanel);
|
||||||
tabs.add("Options", new JScrollPane(optionsPanel));
|
tabs.add("Options", new JScrollPane(optionsPanel));
|
||||||
|
|
||||||
JPanel effectChains = new JPanel();
|
|
||||||
effectChains.setLayout(new BorderLayout());
|
|
||||||
|
|
||||||
JPanel effectDetails = new JPanel() {
|
|
||||||
public Dimension getPreferredSize() {
|
|
||||||
return new Dimension(200, 400);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
DefaultTreeModel m = new DefaultTreeModel(new DefaultMutableTreeNode("Effect Chains"));
|
|
||||||
|
|
||||||
JTree effectChainTree = new JTree(m);
|
|
||||||
effectChains.add(effectChainTree, BorderLayout.CENTER);
|
|
||||||
effectChains.add(effectDetails, BorderLayout.EAST);
|
|
||||||
|
|
||||||
tabs.add("Effects Chains", new JScrollPane(effectChains));
|
|
||||||
|
|
||||||
JPanel startScript = new JPanel();
|
JPanel startScript = new JPanel();
|
||||||
startScript.setLayout(new BorderLayout());
|
startScript.setLayout(new BorderLayout());
|
||||||
|
startScript.setBorder(new EmptyBorder(15, 15, 15, 15));
|
||||||
startupScript = new JTextArea(get("scripts.startup"));
|
startupScript = new JTextArea(get("scripts.startup"));
|
||||||
|
startupScript.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
|
startupScript.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
|
||||||
startScript.add(startupScript, BorderLayout.CENTER);
|
startScript.add(startupScript, BorderLayout.CENTER);
|
||||||
tabs.add("Startup Script", startScript);
|
tabs.add("Startup Script", startScript);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JPanel effects = new JPanel();
|
|
||||||
effects.setLayout(new GridBagLayout());
|
|
||||||
constraint.gridx = 0;
|
|
||||||
constraint.gridy = 0;
|
|
||||||
constraint.gridwidth = 1;
|
|
||||||
constraint.gridheight = 1;
|
|
||||||
|
|
||||||
etherealOffset = addSpinner(effects, "Ethereal Voice Offset", 0, 2000, 10, getInteger("effects.ethereal.offset"), "ms");
|
|
||||||
etherealIterations = addSpinner(effects, "Ethereal Voice Iterations", 1, 10, 1, getInteger("effects.ethereal.iterations"), "");
|
|
||||||
etherealAttenuation = addSpinner(effects, "Ethereal Voice Attenuation", 0, 100, 1, getInteger("effects.ethereal.attenuation"), "%");
|
|
||||||
|
|
||||||
tabs.add("Effects", effects);
|
|
||||||
|
|
||||||
|
|
||||||
JPanel processors = new JPanel();
|
JPanel processors = new JPanel();
|
||||||
processors.setLayout(new BorderLayout());
|
processors.setLayout(new BorderLayout());
|
||||||
@@ -411,19 +413,16 @@ public class Options extends JDialog {
|
|||||||
String command = get("editor.processor." + i + ".command");
|
String command = get("editor.processor." + i + ".command");
|
||||||
if (name == null || command == null) break;
|
if (name == null || command == null) break;
|
||||||
if (name.equals("") || command.equals("")) break;
|
if (name.equals("") || command.equals("")) break;
|
||||||
JTextField[] f = addTwoField(processorListPanel, name, command);
|
JTextField[] f = addTwoField(processorListPanel, name, command, "Specify the name of the operation (which will appear in context menus) and the command to run for that operation. The command should have parameters separated with :: and %f for the input filename and %o for the output filename.");
|
||||||
processorList.add(f);
|
processorList.add(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
JTextField[] f = addTwoField(processorListPanel, "", "");
|
JTextField[] f = addTwoField(processorListPanel, "", "", "Specify the name of the operation (which will appear in context menus) and the command to run for that operation. The command should have parameters separated with :: and %f for the input filename and %o for the output filename.");
|
||||||
processorList.add(f);
|
processorList.add(f);
|
||||||
|
|
||||||
tabs.add("Processors", processors);
|
tabs.add("Processors", processors);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add(tabs, BorderLayout.CENTER);
|
add(tabs, BorderLayout.CENTER);
|
||||||
|
|
||||||
setTitle("Options");
|
setTitle("Options");
|
||||||
@@ -608,10 +607,6 @@ public class Options extends JDialog {
|
|||||||
|
|
||||||
defaultPrefs.put("scripts.startup", "");
|
defaultPrefs.put("scripts.startup", "");
|
||||||
|
|
||||||
defaultPrefs.put("effects.ethereal.offset", "50");
|
|
||||||
defaultPrefs.put("effects.ethereal.iterations", "3");
|
|
||||||
defaultPrefs.put("effects.ethereal.attenuation", "50");
|
|
||||||
|
|
||||||
if (prefs == null) {
|
if (prefs == null) {
|
||||||
prefs = Preferences.userNodeForPackage(AudiobookRecorder.class);
|
prefs = Preferences.userNodeForPackage(AudiobookRecorder.class);
|
||||||
}
|
}
|
||||||
@@ -734,10 +729,6 @@ public class Options extends JDialog {
|
|||||||
set("audio.recording.trim.blocksize", ((KVPair)fftBlockSize.getSelectedItem()).key);
|
set("audio.recording.trim.blocksize", ((KVPair)fftBlockSize.getSelectedItem()).key);
|
||||||
set("audio.playback.blocksize", ((KVPair)playbackBlockSize.getSelectedItem()).key);
|
set("audio.playback.blocksize", ((KVPair)playbackBlockSize.getSelectedItem()).key);
|
||||||
|
|
||||||
set("effects.ethereal.offset", etherealOffset.getValue());
|
|
||||||
set("effects.ethereal.iterations", etherealIterations.getValue());
|
|
||||||
set("effects.ethereal.attenuation", etherealAttenuation.getValue());
|
|
||||||
|
|
||||||
set("scripts.startup", startupScript.getText());
|
set("scripts.startup", startupScript.getText());
|
||||||
|
|
||||||
int procNo = 0;
|
int procNo = 0;
|
||||||
@@ -832,51 +823,4 @@ public class Options extends JDialog {
|
|||||||
pairs[7] = new KVPair<String, String>("131072", "131072");
|
pairs[7] = new KVPair<String, String>("131072", "131072");
|
||||||
return pairs;
|
return pairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createEffectChains() {
|
|
||||||
effectChains = new ArrayList<EffectGroup>();
|
|
||||||
|
|
||||||
for (int i = 0; i < 999999; i++) {
|
|
||||||
if (get("effects." + i + ".name") == null) {
|
|
||||||
EffectGroup e = new EffectGroup(get("effects." + i + ".name"));
|
|
||||||
for (int j = 0; i < 999999; j++) {
|
|
||||||
String type = get("effects." + i + ".children." + j + ".type");
|
|
||||||
if (type == null) break;
|
|
||||||
|
|
||||||
if (type.equals("biquad")) {
|
|
||||||
int bqt = getInteger("effects." + i + ".children." + j + ".filtertype");
|
|
||||||
double fc = getDouble("effects." + i + ".children." + j + ".fc");
|
|
||||||
double q = getDouble("effects." + i + ".children." + j + ".q");
|
|
||||||
double gain = getDouble("effects." + i + ".children." + j + ".gain");
|
|
||||||
Biquad b = new Biquad(bqt, fc, q, gain);
|
|
||||||
e.addEffect(b);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.equals("amplifier")) {
|
|
||||||
double gain = getDouble("effects." + i + ".children." + j + ".gain");
|
|
||||||
Amplifier a = new Amplifier(gain);
|
|
||||||
e.addEffect(a);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.equals("delayline")) {
|
|
||||||
DelayLine l = new DelayLine();
|
|
||||||
for (int c = 0; c < 999999; c++) {
|
|
||||||
if (get("effects." + i + ".children." + j + ".lines." + c + ".samples") == null) break;
|
|
||||||
int samples = getInteger("effects." + i + ".children." + j + ".lines." + c + ".samples");
|
|
||||||
double gain = getDouble("effects." + i + ".children." + j + ".lines." + c + ".gain");
|
|
||||||
l.addDelayLine(samples, gain);
|
|
||||||
}
|
|
||||||
e.addEffect(l);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
effectChains.add(e);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
115
src/uk/co/majenko/audiobookrecorder/Tip.java
Normal file
115
src/uk/co/majenko/audiobookrecorder/Tip.java
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JToolTip;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.font.FontRenderContext;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import org.apache.commons.text.WordUtils;
|
||||||
|
|
||||||
|
public class Tip extends JLabel implements MouseListener {
|
||||||
|
String tip = null;
|
||||||
|
|
||||||
|
public Tip(String text) {
|
||||||
|
tip = WordUtils.wrap(text, 50);
|
||||||
|
|
||||||
|
setToolTipText(text);
|
||||||
|
setIcon(Icons.tooltip);
|
||||||
|
addMouseListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JToolTip createToolTip() {
|
||||||
|
JToolTip tt = new JToolTip() {
|
||||||
|
public String getTipText() {
|
||||||
|
return "*" + tip + "*";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paintComponent(Graphics g) {
|
||||||
|
|
||||||
|
Rectangle r = g.getClipBounds();
|
||||||
|
|
||||||
|
JLabel l = new JLabel();
|
||||||
|
|
||||||
|
AffineTransform affinetransform = new AffineTransform();
|
||||||
|
FontRenderContext frc = new FontRenderContext(affinetransform,true,true);
|
||||||
|
Font f = l.getFont().deriveFont(14f);
|
||||||
|
|
||||||
|
g.setColor(new Color(200, 200, 180));
|
||||||
|
g.fillRect(0, 0, r.width, r.height);
|
||||||
|
|
||||||
|
g.setColor(new Color(10, 10, 10));
|
||||||
|
g.setFont(f);
|
||||||
|
int y = 3;
|
||||||
|
String[] lines = tip.split("\n");
|
||||||
|
for (String line : lines) {
|
||||||
|
Rectangle2D bounds = f.getStringBounds(line, frc);
|
||||||
|
y += bounds.getHeight();
|
||||||
|
g.drawString(line, 5, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dimension getPreferredSize() {
|
||||||
|
|
||||||
|
JLabel l = new JLabel();
|
||||||
|
AffineTransform affinetransform = new AffineTransform();
|
||||||
|
FontRenderContext frc = new FontRenderContext(affinetransform,true,true);
|
||||||
|
Font f = l.getFont().deriveFont(14f);
|
||||||
|
|
||||||
|
String[] lines = tip.split("\n");
|
||||||
|
int w = 0;
|
||||||
|
int h = 0;
|
||||||
|
for (String line : lines) {
|
||||||
|
Rectangle2D bounds = f.getStringBounds(line, frc);
|
||||||
|
double fw = bounds.getWidth();
|
||||||
|
if (fw > w) w = (int)fw;
|
||||||
|
h += bounds.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
Dimension s = new Dimension(w + 10, h + 10);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
tt.removeAll();
|
||||||
|
JPanel p = new JPanel();
|
||||||
|
tt.add(p);
|
||||||
|
JLabel l = new JLabel(tip);
|
||||||
|
l.setBackground(new Color(200, 200, 180));
|
||||||
|
l.setForeground(new Color(0, 0, 0));
|
||||||
|
p.add(l);
|
||||||
|
return tt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseEntered(MouseEvent evt) {
|
||||||
|
// showTipWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseExited(MouseEvent evt) {
|
||||||
|
// hideTipWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mousePressed(MouseEvent evt) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(MouseEvent evt) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseClicked(MouseEvent evt) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user