Added reprocess audio button to waveform display
This commit is contained in:
BIN
resources/uk/co/majenko/audiobookrecorder/icons/redo.png
Normal file
BIN
resources/uk/co/majenko/audiobookrecorder/icons/redo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -60,6 +60,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
JSpinner endOffset;
|
JSpinner endOffset;
|
||||||
JSpinner postSentenceGap;
|
JSpinner postSentenceGap;
|
||||||
|
|
||||||
|
JButton reprocessAudio;
|
||||||
|
|
||||||
Thread playingThread = null;
|
Thread playingThread = null;
|
||||||
|
|
||||||
Random rng = new Random();
|
Random rng = new Random();
|
||||||
@@ -228,6 +230,22 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
sampleControl.add(sampleWaveform, BorderLayout.CENTER);
|
sampleControl.add(sampleWaveform, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
reprocessAudio = new JButton(Icons.redo);
|
||||||
|
reprocessAudio.setToolTipText("Reprocess Audio");
|
||||||
|
reprocessAudio.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (selectedSentence != null) {
|
||||||
|
selectedSentence.autoTrimSample();
|
||||||
|
selectedSentence.recognise();
|
||||||
|
sampleWaveform.setData(selectedSentence.getAudioData());
|
||||||
|
sampleWaveform.setMarkers(selectedSentence.getStartOffset(), selectedSentence.getEndOffset());
|
||||||
|
startOffset.setValue(selectedSentence.getStartOffset());
|
||||||
|
endOffset.setValue(selectedSentence.getEndOffset());
|
||||||
|
postSentenceGap.setValue(selectedSentence.getPostGap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
startOffset = new JSpinner(new SteppedNumericSpinnerModel(0, 0, 1, 0));
|
startOffset = new JSpinner(new SteppedNumericSpinnerModel(0, 0, 1, 0));
|
||||||
startOffset.setPreferredSize(new Dimension(100, 20));
|
startOffset.setPreferredSize(new Dimension(100, 20));
|
||||||
endOffset = new JSpinner(new SteppedNumericSpinnerModel(0, 0, 1, 0));
|
endOffset = new JSpinner(new SteppedNumericSpinnerModel(0, 0, 1, 0));
|
||||||
@@ -265,6 +283,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
JPanel controls = new JPanel();
|
JPanel controls = new JPanel();
|
||||||
|
controls.add(reprocessAudio);
|
||||||
|
|
||||||
controls.add(new JLabel("Start Offset:"));
|
controls.add(new JLabel("Start Offset:"));
|
||||||
|
|
||||||
JButton startFastDown = new JButton("<<");
|
JButton startFastDown = new JButton("<<");
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public class Icons {
|
|||||||
static public ImageIcon recordRoom;
|
static public ImageIcon recordRoom;
|
||||||
static public ImageIcon save;
|
static public ImageIcon save;
|
||||||
|
|
||||||
|
static public ImageIcon redo;
|
||||||
|
|
||||||
static void loadIcons() {
|
static void loadIcons() {
|
||||||
book = new ImageIcon(Icons.class.getResource("icons/book.png"));
|
book = new ImageIcon(Icons.class.getResource("icons/book.png"));
|
||||||
chapter = new ImageIcon(Icons.class.getResource("icons/chapter.png"));
|
chapter = new ImageIcon(Icons.class.getResource("icons/chapter.png"));
|
||||||
@@ -32,6 +34,8 @@ public class Icons {
|
|||||||
recordRoom = new ImageIcon(Icons.class.getResource("icons/record-room.png"));
|
recordRoom = new ImageIcon(Icons.class.getResource("icons/record-room.png"));
|
||||||
save = new ImageIcon(Icons.class.getResource("icons/save.png"));
|
save = new ImageIcon(Icons.class.getResource("icons/save.png"));
|
||||||
|
|
||||||
|
redo = new ImageIcon(Icons.class.getResource("icons/redo.png"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user