Added playback speed option
This commit is contained in:
@@ -2183,7 +2183,9 @@ public class AudiobookRecorder extends JFrame {
|
||||
try {
|
||||
|
||||
AudioFormat sampleformat = s.getAudioFormat();
|
||||
AudioFormat format = new AudioFormat(sampleformat.getSampleRate(), 16, 2, true, false);
|
||||
float sampleRate = sampleformat.getSampleRate();
|
||||
sampleRate *= toolBar.getPlaybackSpeed();
|
||||
AudioFormat format = new AudioFormat(sampleRate, 16, 2, true, false);
|
||||
|
||||
play = AudioSystem.getSourceDataLine(format, Options.getPlaybackMixer());
|
||||
play.open(format);
|
||||
@@ -2421,7 +2423,9 @@ public class AudiobookRecorder extends JFrame {
|
||||
try {
|
||||
|
||||
AudioFormat sampleformat = s.getAudioFormat();
|
||||
AudioFormat format = new AudioFormat(sampleformat.getSampleRate(), 16, 2, true, false);
|
||||
float sampleRate = sampleformat.getSampleRate();
|
||||
sampleRate *= toolBar.getPlaybackSpeed();
|
||||
AudioFormat format = new AudioFormat(sampleRate, 16, 2, true, false);
|
||||
play = AudioSystem.getSourceDataLine(format, Options.getPlaybackMixer());
|
||||
play.open(format);
|
||||
play.start();
|
||||
|
||||
@@ -19,6 +19,8 @@ public class MainToolBar extends JToolBar {
|
||||
JButtonSpacePlay eq;
|
||||
JToggleButtonSpacePlay mic;
|
||||
|
||||
JComboBox<String> playbackSpeed;
|
||||
|
||||
JToggleButtonSpacePlay disableEffects;
|
||||
|
||||
AudiobookRecorder root;
|
||||
@@ -129,6 +131,7 @@ public class MainToolBar extends JToolBar {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
add(mic);
|
||||
|
||||
addSeparator();
|
||||
@@ -152,7 +155,19 @@ public class MainToolBar extends JToolBar {
|
||||
|
||||
add(disableEffects);
|
||||
|
||||
addSeparator();
|
||||
|
||||
add(new JLabel("Playback speed: "));
|
||||
playbackSpeed = new JComboBox<String>(new String[] {
|
||||
"0.75x",
|
||||
"1.00x",
|
||||
"1.25x",
|
||||
"1.50x",
|
||||
"1.75x"
|
||||
});
|
||||
|
||||
playbackSpeed.setSelectedIndex(1);
|
||||
add(playbackSpeed);
|
||||
|
||||
setFloatable(false);
|
||||
}
|
||||
@@ -161,4 +176,9 @@ public class MainToolBar extends JToolBar {
|
||||
playtoSentence.setEnabled(b);
|
||||
}
|
||||
|
||||
public float getPlaybackSpeed() {
|
||||
int v = playbackSpeed.getSelectedIndex();
|
||||
return 0.75f + (0.25f * v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user