Fully replaced sliders with textfields.

This commit is contained in:
serialexperiments0815 2025-12-12 22:42:41 +01:00
parent 154ca38fab
commit fa0a7307e0

View file

@ -35,13 +35,17 @@ public class SlowedAndReverbed {
JFormattedTextField outGainField = new JFormattedTextField(doubleFormater); JFormattedTextField outGainField = new JFormattedTextField(doubleFormater);
JFormattedTextField delayField = new JFormattedTextField(doubleFormater); JFormattedTextField delayField = new JFormattedTextField(doubleFormater);
JFormattedTextField decayField = new JFormattedTextField(doubleFormater); JFormattedTextField decayField = new JFormattedTextField(doubleFormater);
speedField.setValue(0.8);
inGainField.setValue(0.8);
outGainField.setValue(0.7);
delayField.setValue(100);
decayField.setValue(0.5);
JLabel pathLabel = new JLabel("No file selected"); JLabel pathLabel = new JLabel("No file selected");
JLabel speedLabel = new JLabel("Speed from 0.5 - 2.0"); JLabel speedLabel = new JLabel("Speed from 0.5 - 2.0");
JLabel inGainLabel = new JLabel("In-Gain from 0.0 - 1.0"); JLabel inGainLabel = new JLabel("In-Gain from 0.0 - 1.0");
JLabel outGainLabel = new JLabel("Out-Gain from 0.0 - 1.0"); JLabel outGainLabel = new JLabel("Out-Gain from 0.0 - 1.0");
JLabel delayLabel = new JLabel("delay from 0 - 2000"); JLabel delayLabel = new JLabel("delay from 0 - 2000");
JLabel decayLabel = new JLabel("decay from 0.0 - 1.0"); JLabel decayLabel = new JLabel("decay from 0.0 - 1.0");
JLabel reverbLabel = new JLabel("Reverb: 0%");
newButton.addActionListener(e -> { newButton.addActionListener(e -> {
@ -51,6 +55,21 @@ public class SlowedAndReverbed {
newButton.setText("Select new file"); newButton.setText("Select new file");
}); });
saveButton.addActionListener(e -> {
double speed = ((Number) speedField.getValue()).doubleValue();
double in = ((Number) inGainField.getValue()).doubleValue();
double out = ((Number) outGainField.getValue()).doubleValue();
double delay = ((Number) delayField.getValue()).doubleValue();
double decay = ((Number) decayField.getValue()).doubleValue();
double[] reverbList = {in,out,delay,decay};
try {
setFile(frame, filePath, reverbList, speed);
} catch (Exception ex) {
ex.printStackTrace();
return;
}
});
frame.setSize(400,600); frame.setSize(400,600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -75,7 +94,6 @@ public class SlowedAndReverbed {
panelMid.setLayout(new BoxLayout(panelMid, BoxLayout.Y_AXIS)); panelMid.setLayout(new BoxLayout(panelMid, BoxLayout.Y_AXIS));
panelMid.add(pathLabel); panelMid.add(pathLabel);
panelMid.add(reverbLabel);
panelMid.add(panelMidButtons); panelMid.add(panelMidButtons);
frame.add(panel, BorderLayout.NORTH); frame.add(panel, BorderLayout.NORTH);
@ -94,18 +112,6 @@ public class SlowedAndReverbed {
} }
public static double[] getReverbValues(int percentageValue){
int delay = 120;
double decay = 0.5, wet = percentageValue/100, dry = 1 - wet;
double[] reverbValues = {dry, wet, delay, decay};
return reverbValues;
}
public static double getSpeedValue(int percentageValue){
double speed = percentageValue/100.0;
return speed;
}
public static String getCodec(String inputPath){ public static String getCodec(String inputPath){
String codec; String codec;
@ -137,6 +143,7 @@ public class SlowedAndReverbed {
"-i", filePath, "-i", filePath,
"-filter:a", filterCmd, "-filter:a", filterCmd,
"-c:a", getCodec(pathSelected), "-c:a", getCodec(pathSelected),
"-b:a", "320k",
pathSelected pathSelected
}; };