Compare commits
3
Commits
851223fa9f
...
1d8534e39c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d8534e39c | ||
|
|
f46ca4c066 | ||
|
|
13f82e3866 |
No files matched your search
@@ -24,7 +24,7 @@
|
|||||||
<borderPainted value="false"/>
|
<borderPainted value="false"/>
|
||||||
<foreground color="-2271221"/>
|
<foreground color="-2271221"/>
|
||||||
<indeterminate value="false"/>
|
<indeterminate value="false"/>
|
||||||
<stringPainted value="true"/>
|
<stringPainted value="false"/>
|
||||||
<value value="0"/>
|
<value value="0"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -125,7 +125,9 @@
|
|||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties>
|
||||||
|
<disabledTextColor color="-10124141"/>
|
||||||
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="f7802" class="javax.swing.JLabel">
|
<component id="f7802" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
@@ -143,7 +145,9 @@
|
|||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties>
|
||||||
|
<disabledTextColor color="-10124141"/>
|
||||||
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<grid id="27515" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="27515" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
@@ -337,7 +341,7 @@
|
|||||||
<text value="no track"/>
|
<text value="no track"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="c11e8" class="javax.swing.JLabel" binding="dSSize">
|
<component id="c11e8" class="javax.swing.JLabel" binding="dSSize">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -347,7 +351,7 @@
|
|||||||
<text value="no size"/>
|
<text value="no size"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="8480f" class="javax.swing.JLabel" binding="dMSize">
|
<component id="8480f" class="javax.swing.JLabel" binding="dMSize">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.DocumentEvent;
|
||||||
|
import javax.swing.event.DocumentListener;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -27,7 +29,6 @@ import java.awt.event.ActionListener;
|
|||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
@@ -86,6 +87,23 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
private File sptrack;
|
private File sptrack;
|
||||||
private File mptrack;
|
private File mptrack;
|
||||||
|
|
||||||
|
DocumentListener id3TagEditorHandler = new DocumentListener() {
|
||||||
|
@Override
|
||||||
|
public void insertUpdate(DocumentEvent documentEvent) {
|
||||||
|
updateSelectionToMatchTextFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeUpdate(DocumentEvent documentEvent) {
|
||||||
|
updateSelectionToMatchTextFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changedUpdate(DocumentEvent documentEvent) {
|
||||||
|
updateSelectionToMatchTextFields();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public Suggs(JFrame parent) {
|
public Suggs(JFrame parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
parent.setEnabled(false);
|
parent.setEnabled(false);
|
||||||
@@ -118,14 +136,25 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e)
|
public void windowClosing(WindowEvent e)
|
||||||
{
|
{
|
||||||
int result = JOptionPane.showConfirmDialog(frame, "Are you sure?\nAll unsaved changes will be lost.", "Soundtrack Mod Generator", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
if (!tracklist.isEmpty() || sptrack != null || mptrack != null) {
|
||||||
if (result == JOptionPane.YES_OPTION) {
|
int result = JOptionPane.showConfirmDialog(frame, "Are you sure?\nAll unsaved changes will be lost.", "Soundtrack Mod Generator", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||||
parent.setEnabled(true);
|
if (result == JOptionPane.NO_OPTION) {return;}
|
||||||
e.getWindow().dispose();
|
|
||||||
}
|
}
|
||||||
|
parent.setEnabled(true);
|
||||||
|
e.getWindow().dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fTitle.setText("");
|
||||||
|
fArtist.setText("");
|
||||||
|
dTrackNo.setText("\u200E");
|
||||||
|
dFileSize.setText("\u200E");
|
||||||
|
fTitle.setEnabled(false);
|
||||||
|
fArtist.setEnabled(false);
|
||||||
|
|
||||||
|
fTitle.getDocument().addDocumentListener(id3TagEditorHandler);
|
||||||
|
fArtist.getDocument().addDocumentListener(id3TagEditorHandler);
|
||||||
|
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,17 +165,12 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
if (actionEvent.getSource() == cancelBtn) {
|
if (actionEvent.getSource() == cancelBtn) {
|
||||||
int result = JOptionPane.showConfirmDialog(frame, "Are you sure?\nAll unsaved changes will be lost.", "Soundtrack Mod Generator", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
if (!tracklist.isEmpty() || sptrack != null || mptrack != null) {
|
||||||
if (result == JOptionPane.YES_OPTION) {
|
int result = JOptionPane.showConfirmDialog(frame, "Are you sure?\nAll unsaved changes will be lost.", "Soundtrack Mod Generator", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||||
parent.setEnabled(true);
|
if (result == JOptionPane.NO_OPTION) {return;}
|
||||||
frame.dispose();
|
|
||||||
}
|
}
|
||||||
} else
|
parent.setEnabled(true);
|
||||||
if (actionEvent.getSource() == fTitle || actionEvent.getSource() == fArtist) {
|
frame.dispose();
|
||||||
tracklist.get(curIndex).title = fTitle.getText();
|
|
||||||
tracklist.get(curIndex).artist = fArtist.getText();
|
|
||||||
InitializeSongListInGUI();
|
|
||||||
dSongList.setSelectedIndex(curIndex);
|
|
||||||
} else
|
} else
|
||||||
if (actionEvent.getSource() == addSongBtn) {addSong();} else
|
if (actionEvent.getSource() == addSongBtn) {addSong();} else
|
||||||
if (actionEvent.getSource() == deleteSongBtn) {remove(curIndex);} else
|
if (actionEvent.getSource() == deleteSongBtn) {remove(curIndex);} else
|
||||||
@@ -182,20 +206,43 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent listSelectionEvent) {
|
public void valueChanged(ListSelectionEvent listSelectionEvent) {
|
||||||
|
fTitle.getDocument().removeDocumentListener(id3TagEditorHandler);
|
||||||
|
fArtist.getDocument().removeDocumentListener(id3TagEditorHandler);
|
||||||
curIndex = dSongList.getSelectedIndex();
|
curIndex = dSongList.getSelectedIndex();
|
||||||
if (curIndex >= 0) {
|
if (curIndex >= 0) {
|
||||||
|
fTitle.setEnabled(true);
|
||||||
|
fArtist.setEnabled(true);
|
||||||
AudioTrack at = tracklist.get(curIndex);
|
AudioTrack at = tracklist.get(curIndex);
|
||||||
fTitle.setText(at.title);
|
fTitle.setText(at.title);
|
||||||
fArtist.setText(at.artist);
|
fArtist.setText(at.artist);
|
||||||
dTrackNo.setText(String.format("MT_%02d", curIndex+1));
|
dTrackNo.setText(String.format("MT_%02d", curIndex+1));
|
||||||
dFileSize.setText((at.size / 1000) + "kb");
|
dFileSize.setText(at.size + " B");
|
||||||
|
if (at.size > 1023) {
|
||||||
|
dFileSize.setText((at.size / 1024) + " KB");
|
||||||
|
}
|
||||||
|
if (at.size > 1048575) {
|
||||||
|
dFileSize.setText((at.size / 1048576) + " MB");
|
||||||
|
}
|
||||||
|
fTitle.getDocument().addDocumentListener(id3TagEditorHandler);
|
||||||
|
fArtist.getDocument().addDocumentListener(id3TagEditorHandler);
|
||||||
} else {
|
} else {
|
||||||
|
fTitle.setEnabled(false);
|
||||||
|
fArtist.setEnabled(false);
|
||||||
fTitle.setText("");
|
fTitle.setText("");
|
||||||
fArtist.setText("");
|
fArtist.setText("");
|
||||||
dTrackNo.setText("--");
|
dTrackNo.setText("\u200E");
|
||||||
dFileSize.setText("-kb");
|
dFileSize.setText("\u200E");
|
||||||
|
fTitle.getDocument().addDocumentListener(id3TagEditorHandler);
|
||||||
|
fArtist.getDocument().addDocumentListener(id3TagEditorHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSelectionToMatchTextFields() {
|
||||||
|
tracklist.get(curIndex).title = fTitle.getText();
|
||||||
|
tracklist.get(curIndex).artist = fArtist.getText();
|
||||||
|
InitializeSongListInGUI();
|
||||||
|
dSongList.setSelectedIndex(curIndex);
|
||||||
|
}
|
||||||
|
|
||||||
private void remove(int index) {
|
private void remove(int index) {
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@@ -219,6 +266,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeSongListInGUI() {
|
private void InitializeSongListInGUI() {
|
||||||
|
dSongList.removeListSelectionListener(this); // prevent weird bullshit
|
||||||
dSongList.clearSelection();
|
dSongList.clearSelection();
|
||||||
dSongList.removeAll();
|
dSongList.removeAll();
|
||||||
dSongList.setVisibleRowCount(tracklist.size());
|
dSongList.setVisibleRowCount(tracklist.size());
|
||||||
@@ -228,39 +276,55 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
String[] contents = new String[tracklist.size()];
|
String[] contents = new String[tracklist.size()];
|
||||||
while (i < tracklist.size()) {
|
while (i < tracklist.size()) {
|
||||||
|
String dTitleInList; // avoid editing the actual list
|
||||||
|
String dArtistInList; // otherwise we cause weird JTextField behavior
|
||||||
if (tracklist.get(i).title == null || tracklist.get(i).title.isEmpty())
|
if (tracklist.get(i).title == null || tracklist.get(i).title.isEmpty())
|
||||||
{tracklist.get(i).title = tracklist.get(i).path.getName();}
|
{dTitleInList = tracklist.get(i).path.getName();} else {dTitleInList = tracklist.get(i).title;}
|
||||||
if (tracklist.get(i).artist == null || tracklist.get(i).artist.isEmpty())
|
if (tracklist.get(i).artist == null || tracklist.get(i).artist.isEmpty())
|
||||||
{tracklist.get(i).artist = "???";}
|
{dArtistInList = "Unknown Artist";} else {dArtistInList = tracklist.get(i).artist;}
|
||||||
contents[i] = tracklist.get(i).artist + " - " + tracklist.get(i).title;
|
contents[i] = dArtistInList + " - " + dTitleInList;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
dSongList.setListData(contents);
|
dSongList.setListData(contents);
|
||||||
dSongList.setSelectedIndex(curIndex);
|
dSongList.setSelectedIndex(curIndex);
|
||||||
|
dSongList.addListSelectionListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JFileChooser commonSoundFilePicker(boolean multiselect) {
|
||||||
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
|
fileChooser.setMultiSelectionEnabled(multiselect);
|
||||||
|
fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));
|
||||||
|
fileChooser.setFileFilter(new FileNameExtensionFilter("All Compatible Files", "mp3", "ogg", "oga", "opus", "m4a", "3gp", "wav", "wave", "aif", "aiff", "aifc", "flac", "at9"));
|
||||||
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("MPEG Audio Layer 3", "mp3"));
|
||||||
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Ogg Audio", "ogg", "oga", "opus"));
|
||||||
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("AAC or MPEG-4 Audio", "m4a", "3gp"));
|
||||||
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("IBM/Microsoft WAVE", "wav", "wave"));
|
||||||
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Apple AIFF", "aif", "aiff", "aifc"));
|
||||||
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Free Lossless Audio Codec", "flac"));
|
||||||
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Sony ATRAC9", "at9"));
|
||||||
|
return fileChooser;
|
||||||
|
}
|
||||||
|
|
||||||
private void setSPMusic() {
|
private void setSPMusic() {
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = commonSoundFilePicker(false);
|
||||||
fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));
|
|
||||||
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("WAVE", "wav"));
|
|
||||||
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("ATRAC9", "at9"));
|
|
||||||
|
|
||||||
int result = fileChooser.showOpenDialog(frame);
|
int result = fileChooser.showOpenDialog(frame);
|
||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
File selectedFile = fileChooser.getSelectedFile();
|
File selectedFile = fileChooser.getSelectedFile();
|
||||||
sptrack = selectedFile;
|
sptrack = selectedFile;
|
||||||
dSTitle.setText(selectedFile.getName());
|
dSTitle.setText(selectedFile.getName());
|
||||||
dSSize.setText((selectedFile.length() / 1000) + "kb");
|
dSSize.setText(selectedFile.length() + " B");
|
||||||
|
if (selectedFile.length() > 1023) {
|
||||||
|
dSSize.setText((selectedFile.length() / 1024) + " KB");
|
||||||
|
}
|
||||||
|
if (selectedFile.length() > 1048575) {
|
||||||
|
dSSize.setText((selectedFile.length() / 1048576) + " MB");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMPMusic() {
|
private void setMPMusic() {
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = commonSoundFilePicker(false);
|
||||||
fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));
|
|
||||||
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("WAVE", "wav"));
|
|
||||||
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("ATRAC9", "at9"));
|
|
||||||
|
|
||||||
int result = fileChooser.showOpenDialog(frame);
|
int result = fileChooser.showOpenDialog(frame);
|
||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
File selectedFile = fileChooser.getSelectedFile();
|
File selectedFile = fileChooser.getSelectedFile();
|
||||||
@@ -271,11 +335,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addSong() {
|
private void addSong() {
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = commonSoundFilePicker(true);
|
||||||
fileChooser.setMultiSelectionEnabled(true);
|
|
||||||
fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));
|
|
||||||
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("WAVE", "wav"));
|
|
||||||
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("ATRAC9", "at9"));
|
|
||||||
|
|
||||||
int result = fileChooser.showOpenDialog(frame);
|
int result = fileChooser.showOpenDialog(frame);
|
||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
@@ -303,23 +363,29 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
frame.setAlwaysOnTop(false);
|
frame.setAlwaysOnTop(false);
|
||||||
Main.deleteDir(new File(System.getProperty("user.home") + "/.firestar/temp/")); // starts with clean temp
|
Main.deleteDir(new File(System.getProperty("user.home") + "/.firestar/temp/")); // starts with clean temp
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
int progressSize = tracklist.size()+(sptrack != null?1:0)+(mptrack != null?1:0)+3; // Accounting for processes
|
int progressSize = tracklist.size()+(sptrack != null?1:0)+(mptrack != null?1:0)+1; // Accounting for processes
|
||||||
|
|
||||||
progressDialog = new Scooter();
|
progressDialog = new Scooter();
|
||||||
progressDialog.showDialog("Soundtrack Mod Generator");
|
progressDialog.showDialog("Soundtrack Mod Generator");
|
||||||
progressDialog.setText("Generating audio files...");
|
progressDialog.setText("Generating audio files...");
|
||||||
progressDialog.setProgressMax(progressSize);
|
progressDialog.setProgressMax(progressSize);
|
||||||
progressDialog.setProgressValue(0);
|
progressDialog.setProgressValue(0);
|
||||||
|
progressDialog.progressBar.setStringPainted(false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new File(Main.inpath + "temp/data/audio/music").mkdirs();
|
new File(Main.inpath + "temp/data/audio/music").mkdirs();
|
||||||
FileOutputStream fos = new FileOutputStream(new File(Main.inpath + "temp/fscript"));
|
FileOutputStream fos = new FileOutputStream(new File(Main.inpath + "temp/fscript"));
|
||||||
PrintStream ps = new PrintStream(fos);
|
PrintStream ps = new PrintStream(fos);
|
||||||
ps.println("fscript 1");
|
ps.println("fscript 1");
|
||||||
ps.println("# AUTOGENERATED BY FIRESTAR");
|
ps.println("# AUTOGENERATED BY FIRESTAR");
|
||||||
|
new File(Main.inpath + "temp/ffmpeg/").mkdirs();
|
||||||
for (int i = 0; i < tracklist.size(); i++) {
|
for (int i = 0; i < tracklist.size(); i++) {
|
||||||
AudioTrack at = tracklist.get(i);
|
AudioTrack at = tracklist.get(i);
|
||||||
String trackno = String.format("%02d", i+1);
|
String trackno = String.format("%02d", i+1);
|
||||||
|
String oTitle;
|
||||||
|
if (at.title == null) {oTitle = "";} else {oTitle = at.title;}
|
||||||
|
String oArtist;
|
||||||
|
if (at.artist == null) {oArtist = "";} else {oArtist = at.artist;}
|
||||||
new File(Main.inpath + "temp/data/audio/music/" + trackno).mkdirs();
|
new File(Main.inpath + "temp/data/audio/music/" + trackno).mkdirs();
|
||||||
if (at.path.getName().endsWith(".at9")) {
|
if (at.path.getName().endsWith(".at9")) {
|
||||||
progressDialog.setText("Copying track " + (i+1) + " out of " + tracklist.size() + "...");
|
progressDialog.setText("Copying track " + (i+1) + " out of " + tracklist.size() + "...");
|
||||||
@@ -333,7 +399,12 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
} else {
|
} else {
|
||||||
progressDialog.setText("Encoding track " + (i+1) + " out of " + tracklist.size() + "...");
|
progressDialog.setText("Encoding track " + (i+1) + " out of " + tracklist.size() + "...");
|
||||||
try {
|
try {
|
||||||
System.out.println("Encoding track #" + (i+1) + " \"" + at.artist + " - " + at.title + "\"...");
|
System.out.println("Encoding track #" + (i+1) + " \"" + oArtist + " - " + oTitle + "\"...");
|
||||||
|
if (!at.path.getName().endsWith(".wav") && !at.path.getName().endsWith(".wave")) { // convert to WAV first if it's not readable by at9tool yet
|
||||||
|
Process p = Main.exec(new String[]{Main.inpath + "ffmpeg.exe", "-i", at.path.getPath(), "ffmpeg/" + at.path.getName() + ".wav"}, Main.inpath + "temp/");
|
||||||
|
p.waitFor();
|
||||||
|
at.path = new File(Main.inpath + "temp/ffmpeg/" + at.path.getName() + ".wav");
|
||||||
|
}
|
||||||
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", at.path.getPath(), "data/audio/music/" + trackno + "/music_stereo.at9"}, Main.inpath + "temp/");
|
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", at.path.getPath(), "data/audio/music/" + trackno + "/music_stereo.at9"}, Main.inpath + "temp/");
|
||||||
p.waitFor();
|
p.waitFor();
|
||||||
} catch (IOException | InterruptedException ex) {
|
} catch (IOException | InterruptedException ex) {
|
||||||
@@ -342,7 +413,8 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
}
|
}
|
||||||
String ocmd = "modify";
|
String ocmd = "modify";
|
||||||
if (i >= 12) ocmd = "create";
|
if (i >= 12) ocmd = "create";
|
||||||
ps.println("file \"data/plugins/languages/american/entries.xml\" xml "+ocmd+" StringTable.entry#MT_"+trackno+" set attribute \"string\" \""+at.artist.replace("\"", "\\\"")+"\\n"+at.title.replace("\"", "\\\"")+"\"");
|
String oArtistLine = oArtist.replace("\"", "\\\"")+"\\n";
|
||||||
|
ps.println("file \"data/plugins/languages/american/entries.xml\" xml "+ocmd+" StringTable.entry#MT_"+trackno+" set attribute \"string\" \""+oArtistLine+oTitle.replace("\"", "\\\"")+"\"");
|
||||||
ps.println("file \"data/audio/music/"+trackno+"/music_stereo.fft\" delete");
|
ps.println("file \"data/audio/music/"+trackno+"/music_stereo.fft\" delete");
|
||||||
progressDialog.setProgressValue(i+1);
|
progressDialog.setProgressValue(i+1);
|
||||||
}
|
}
|
||||||
@@ -354,6 +426,11 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
if (sptrack.exists()) {
|
if (sptrack.exists()) {
|
||||||
try {
|
try {
|
||||||
System.out.println("Encoding singleplayer frontend track...");
|
System.out.println("Encoding singleplayer frontend track...");
|
||||||
|
if (!sptrack.getName().endsWith(".wav") && !sptrack.getName().endsWith(".wave")) { // convert to WAV first if it's not readable by at9tool yet
|
||||||
|
Process p = Main.exec(new String[]{Main.inpath + "ffmpeg.exe", "-i", sptrack.getPath(), "ffmpeg/" + sptrack.getName() + ".wav"}, Main.inpath + "temp/");
|
||||||
|
p.waitFor();
|
||||||
|
sptrack = new File(Main.inpath + "temp/ffmpeg/" + sptrack.getName() + ".wav");
|
||||||
|
}
|
||||||
new File(Main.inpath + "temp/data/audio/music/FEMusic").mkdirs();
|
new File(Main.inpath + "temp/data/audio/music/FEMusic").mkdirs();
|
||||||
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", sptrack.getPath(), "data/audio/music/FEMusic/frontend_stereo.at9"}, System.getProperty("user.home") + "/.firestar/temp/");
|
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", sptrack.getPath(), "data/audio/music/FEMusic/frontend_stereo.at9"}, System.getProperty("user.home") + "/.firestar/temp/");
|
||||||
p.waitFor();
|
p.waitFor();
|
||||||
@@ -369,6 +446,11 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
try {
|
try {
|
||||||
assert(mptrack.exists());
|
assert(mptrack.exists());
|
||||||
System.out.println("Encoding multiplayer frontend track...");
|
System.out.println("Encoding multiplayer frontend track...");
|
||||||
|
if (!mptrack.getName().endsWith(".wav") && !mptrack.getName().endsWith(".wave")) { // convert to WAV first if it's not readable by at9tool yet
|
||||||
|
Process p = Main.exec(new String[]{Main.inpath + "ffmpeg.exe", "-i", mptrack.getPath(), "ffmpeg/" + mptrack.getName() + ".wav"}, Main.inpath + "temp/");
|
||||||
|
p.waitFor();
|
||||||
|
mptrack = new File(Main.inpath + "temp/ffmpeg/" + mptrack.getName() + ".wav");
|
||||||
|
}
|
||||||
new File(Main.inpath + "temp/data/audio/music/FEDemoMusic").mkdirs();
|
new File(Main.inpath + "temp/data/audio/music/FEDemoMusic").mkdirs();
|
||||||
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", mptrack.getPath(), "data/audio/music/FEDemoMusic/frontend_stereo.at9"}, System.getProperty("user.home") + "/.firestar/temp/");
|
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", mptrack.getPath(), "data/audio/music/FEDemoMusic/frontend_stereo.at9"}, System.getProperty("user.home") + "/.firestar/temp/");
|
||||||
p.waitFor();
|
p.waitFor();
|
||||||
@@ -438,6 +520,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||||||
|
|
||||||
progressDialog.destroyDialog();
|
progressDialog.destroyDialog();
|
||||||
frame.dispose();
|
frame.dispose();
|
||||||
|
Main.deleteDir(new File(Main.inpath + "temp/ffmpeg/"));
|
||||||
Clifford saveDialog = new Clifford();
|
Clifford saveDialog = new Clifford();
|
||||||
saveDialog.isSoundtrack = true;
|
saveDialog.isSoundtrack = true;
|
||||||
saveDialog.Action(frame, new File(Main.inpath + "temp/"));
|
saveDialog.Action(frame, new File(Main.inpath + "temp/"));
|
||||||
|
|||||||
Reference in new issue
Block a user