Migrated code to JVM-11 compatability
This commit is contained in:
@@ -363,7 +363,6 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JPanel controlsTop = new JPanel();
|
JPanel controlsTop = new JPanel();
|
||||||
JPanel controlsBottom = new JPanel();
|
JPanel controlsBottom = new JPanel();
|
||||||
JToolBar controlsLeft = new JToolBar(JToolBar.VERTICAL);
|
JToolBar controlsLeft = new JToolBar(JToolBar.VERTICAL);
|
||||||
@@ -597,6 +596,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
setIconImage(Icons.appIcon.getImage());
|
setIconImage(Icons.appIcon.getImage());
|
||||||
|
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|
||||||
@@ -735,8 +735,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
JMenuObject rec = new JMenuObject("Recognise text from audio", s);
|
JMenuObject rec = new JMenuObject("Recognise text from audio", s);
|
||||||
JMenu moveMenu = new JMenu("Move sentence to...");
|
JMenu moveMenu = new JMenu("Move sentence to...");
|
||||||
|
|
||||||
for (Enumeration<Chapter> c = book.children(); c.hasMoreElements();) {
|
for (Enumeration c = book.children(); c.hasMoreElements();) {
|
||||||
Chapter chp = c.nextElement();
|
Chapter chp = (Chapter)c.nextElement();
|
||||||
JMenuObject2 m = new JMenuObject2(chp.getName(), s, chp);
|
JMenuObject2 m = new JMenuObject2(chp.getName(), s, chp);
|
||||||
m.addActionListener(new ActionListener() {
|
m.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@@ -858,8 +858,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (Enumeration<Chapter> bc = book.children(); bc.hasMoreElements();) {
|
for (Enumeration bc = book.children(); bc.hasMoreElements();) {
|
||||||
Chapter chp = bc.nextElement();
|
Chapter chp = (Chapter)bc.nextElement();
|
||||||
if (chp.getId().equals(c.getId())) {
|
if (chp.getId().equals(c.getId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -932,8 +932,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JMenuObject o = (JMenuObject)e.getSource();
|
JMenuObject o = (JMenuObject)e.getSource();
|
||||||
Chapter c = (Chapter)o.getObject();
|
Chapter c = (Chapter)o.getObject();
|
||||||
for (Enumeration<Sentence> s = c.children(); s.hasMoreElements();) {
|
for (Enumeration s = c.children(); s.hasMoreElements();) {
|
||||||
Sentence snt = s.nextElement();
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
if (!snt.isLocked()) {
|
if (!snt.isLocked()) {
|
||||||
snt.autoTrimSamplePeak();
|
snt.autoTrimSamplePeak();
|
||||||
}
|
}
|
||||||
@@ -945,8 +945,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JMenuObject o = (JMenuObject)e.getSource();
|
JMenuObject o = (JMenuObject)e.getSource();
|
||||||
Chapter c = (Chapter)o.getObject();
|
Chapter c = (Chapter)o.getObject();
|
||||||
for (Enumeration<Sentence> s = c.children(); s.hasMoreElements();) {
|
for (Enumeration s = c.children(); s.hasMoreElements();) {
|
||||||
Sentence snt = s.nextElement();
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
snt.setLocked(true);
|
snt.setLocked(true);
|
||||||
bookTreeModel.reload(snt);
|
bookTreeModel.reload(snt);
|
||||||
}
|
}
|
||||||
@@ -956,8 +956,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JMenuObject o = (JMenuObject)e.getSource();
|
JMenuObject o = (JMenuObject)e.getSource();
|
||||||
Chapter c = (Chapter)o.getObject();
|
Chapter c = (Chapter)o.getObject();
|
||||||
for (Enumeration<Sentence> s = c.children(); s.hasMoreElements();) {
|
for (Enumeration s = c.children(); s.hasMoreElements();) {
|
||||||
Sentence snt = s.nextElement();
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
snt.setLocked(false);
|
snt.setLocked(false);
|
||||||
bookTreeModel.reload(snt);
|
bookTreeModel.reload(snt);
|
||||||
}
|
}
|
||||||
@@ -1228,17 +1228,17 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
prefs.setProperty("audio.eq." + i, String.format("%.3f", book.equaliser.getChannel(i)));
|
prefs.setProperty("audio.eq." + i, String.format("%.3f", book.equaliser.getChannel(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Enumeration<Chapter> o = book.children(); o.hasMoreElements();) {
|
for (Enumeration o = book.children(); o.hasMoreElements();) {
|
||||||
|
|
||||||
Chapter c = o.nextElement();
|
Chapter c = (Chapter)o.nextElement();
|
||||||
String keybase = "chapter." + c.getId();
|
String keybase = "chapter." + c.getId();
|
||||||
prefs.setProperty(keybase + ".name", c.getName());
|
prefs.setProperty(keybase + ".name", c.getName());
|
||||||
prefs.setProperty(keybase + ".pre-gap", Integer.toString(c.getPreGap()));
|
prefs.setProperty(keybase + ".pre-gap", Integer.toString(c.getPreGap()));
|
||||||
prefs.setProperty(keybase + ".post-gap", Integer.toString(c.getPostGap()));
|
prefs.setProperty(keybase + ".post-gap", Integer.toString(c.getPostGap()));
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Enumeration<Sentence> s = c.children(); s.hasMoreElements();) {
|
for (Enumeration s = c.children(); s.hasMoreElements();) {
|
||||||
Sentence snt = s.nextElement();
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
prefs.setProperty(String.format("%s.sentence.%08d.id", keybase, i), snt.getId());
|
prefs.setProperty(String.format("%s.sentence.%08d.id", keybase, i), snt.getId());
|
||||||
prefs.setProperty(String.format("%s.sentence.%08d.text", keybase, i), snt.getText());
|
prefs.setProperty(String.format("%s.sentence.%08d.text", keybase, i), snt.getText());
|
||||||
prefs.setProperty(String.format("%s.sentence.%08d.post-gap", keybase, i), Integer.toString(snt.getPostGap()));
|
prefs.setProperty(String.format("%s.sentence.%08d.post-gap", keybase, i), Integer.toString(snt.getPostGap()));
|
||||||
@@ -1625,8 +1625,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public void exportAudio() {
|
public void exportAudio() {
|
||||||
|
|
||||||
|
|
||||||
for (Enumeration<Chapter> o = book.children(); o.hasMoreElements();) {
|
for (Enumeration o = book.children(); o.hasMoreElements();) {
|
||||||
Chapter c = o.nextElement();
|
Chapter c = (Chapter)o.nextElement();
|
||||||
ExportDialog ed = new ExportDialog("Exporting " + c.getName());
|
ExportDialog ed = new ExportDialog("Exporting " + c.getName());
|
||||||
|
|
||||||
ExportThread t = new ExportThread(c, ed);
|
ExportThread t = new ExportThread(c, ed);
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Chapter getChapterById(String id) {
|
public Chapter getChapterById(String id) {
|
||||||
for (Enumeration<Object>o = children(); o.hasMoreElements();) {
|
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||||
Object ob = o.nextElement();
|
Object ob = (Object)o.nextElement();
|
||||||
if (ob instanceof Chapter) {
|
if (ob instanceof Chapter) {
|
||||||
Chapter c = (Chapter)ob;
|
Chapter c = (Chapter)ob;
|
||||||
if (c.getId().equals(id)) {
|
if (c.getId().equals(id)) {
|
||||||
@@ -152,8 +152,8 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
public void renumberChapters() {
|
public void renumberChapters() {
|
||||||
int id = 1;
|
int id = 1;
|
||||||
|
|
||||||
for (Enumeration<Chapter> c = children(); c.hasMoreElements();) {
|
for (Enumeration c = children(); c.hasMoreElements();) {
|
||||||
Chapter chp = c.nextElement();
|
Chapter chp = (Chapter)c.nextElement();
|
||||||
if (Utils.s2i(chp.getId()) > 0) {
|
if (Utils.s2i(chp.getId()) > 0) {
|
||||||
chp.setId(String.format("%04d", id));
|
chp.setId(String.format("%04d", id));
|
||||||
id++;
|
id++;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
audioAttributes.setCodec("libmp3lame");
|
audioAttributes.setCodec("libmp3lame");
|
||||||
audioAttributes.setBitRate(Options.getInteger("audio.export.bitrate"));
|
audioAttributes.setBitRate(Options.getInteger("audio.export.bitrate"));
|
||||||
audioAttributes.setSamplingRate(Options.getInteger("audio.export.samplerate"));
|
audioAttributes.setSamplingRate(Options.getInteger("audio.export.samplerate"));
|
||||||
audioAttributes.setChannels(new Integer(2));
|
audioAttributes.setChannels(2); //new Integer(2));
|
||||||
attributes.setFormat("mp3");
|
attributes.setFormat("mp3");
|
||||||
attributes.setAudioAttributes(audioAttributes);
|
attributes.setAudioAttributes(audioAttributes);
|
||||||
|
|
||||||
@@ -145,10 +145,10 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
int kidno = 0;
|
int kidno = 0;
|
||||||
|
|
||||||
|
|
||||||
for (Enumeration<Sentence> s = children(); s.hasMoreElements();) {
|
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||||
kidno++;
|
kidno++;
|
||||||
if (exportDialog != null) exportDialog.setProgress(kidno * 1000 / kids);
|
if (exportDialog != null) exportDialog.setProgress(kidno * 1000 / kids);
|
||||||
Sentence snt = s.nextElement();
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
data = snt.getRawAudioData();
|
data = snt.getRawAudioData();
|
||||||
|
|
||||||
fullLength += data.length;
|
fullLength += data.length;
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
recognise();
|
recognise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int FFTBuckets = 1024;
|
public static final int FFTBuckets = 1024;
|
||||||
|
|||||||
Reference in New Issue
Block a user