fix playlist zombification

This commit is contained in:
Downforce Agent 2024-07-21 16:58:27 -05:00
parent 68a0dcba49
commit f11dfc5378
3 changed files with 32 additions and 7 deletions

View File

@ -222,8 +222,8 @@ public class Clifford implements ActionListener {
container.put("loaderversion", 1); container.put("loaderversion", 1);
if (isSoundtrack) { if (isSoundtrack) {
ArrayList<boolean[]> requiresTemp = new ArrayList<>(); ArrayList<boolean[]> requiresTemp = new ArrayList<>();
requiresTemp.add(new boolean[]{true, false, false, false});
requiresTemp.add(new boolean[]{false, true, false, false}); requiresTemp.add(new boolean[]{false, true, false, false});
requiresTemp.add(new boolean[]{true, false, false, false});
container.put("requires", requiresTemp); // Pull localization files for patching. container.put("requires", requiresTemp); // Pull localization files for patching.
} }
} else { } else {

View File

@ -40,7 +40,7 @@
</component> </component>
</children> </children>
</scrollpane> </scrollpane>
<grid id="eb54e" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="eb54e" layout-manager="GridLayoutManager" row-count="3" column-count="3" 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"/>
<constraints> <constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@ -54,7 +54,7 @@
<children> <children>
<component id="adce7" class="javax.swing.JButton" binding="cancelBtn"> <component id="adce7" class="javax.swing.JButton" binding="cancelBtn">
<constraints> <constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/> <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<background color="-2271221"/> <background color="-2271221"/>
@ -67,25 +67,27 @@
</component> </component>
<hspacer id="8ecbf"> <hspacer id="8ecbf">
<constraints> <constraints>
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="0" column="0" row-span="3" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</hspacer> </hspacer>
<component id="b6c2f" class="javax.swing.JCheckBox" binding="checkAdditive"> <component id="b6c2f" class="javax.swing.JCheckBox" binding="checkAdditive">
<constraints> <constraints>
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/> <grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="10" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<enabled value="false"/> <enabled value="false"/>
<focusPainted value="false"/>
<font name="Exo 2"/> <font name="Exo 2"/>
<foreground color="-1"/> <foreground color="-1"/>
<opaque value="false"/> <opaque value="false"/>
<text value="Append to default playlist"/> <text value="Append to default playlist"/>
<toolTipText value="Check this box to add your playlist to the existing in-game one instead of overwriting it."/>
<visible value="false"/> <visible value="false"/>
</properties> </properties>
</component> </component>
<component id="a7b02" class="javax.swing.JButton" binding="saveBtn"> <component id="a7b02" class="javax.swing.JButton" binding="saveBtn">
<constraints> <constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/> <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<background color="-2271221"/> <background color="-2271221"/>
@ -96,6 +98,21 @@
<text value="Save"/> <text value="Save"/>
</properties> </properties>
</component> </component>
<component id="2252b" class="javax.swing.JCheckBox" binding="checkNormalize">
<constraints>
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="10" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="true"/>
<focusPainted value="false"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<opaque value="false"/>
<text value="Normalize Volumes"/>
<toolTipText value="Prevents sound effects from drowning out the music, but may reduce sound quality. This process is SKIPPED for ATRAC9 files since they are never transcoded!"/>
<visible value="true"/>
</properties>
</component>
</children> </children>
</grid> </grid>
<grid id="cc2" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="cc2" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">

View File

@ -73,10 +73,12 @@ public class Suggs implements ActionListener, ListSelectionListener {
private JCheckBox checkAdditive; private JCheckBox checkAdditive;
private JButton spDeleteBtn; private JButton spDeleteBtn;
private JButton mpDeleteBtn; private JButton mpDeleteBtn;
private JCheckBox checkNormalize;
private Scooter progressDialog; private Scooter progressDialog;
JFrame parent; JFrame parent;
int curIndex = -1; int curIndex = -1;
boolean normalizeVolumes = false;
public class AudioTrack { public class AudioTrack {
public File path; // file name public File path; // file name
@ -85,7 +87,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
public long size; // file size in bytes public long size; // file size in bytes
public boolean noConvert; public boolean noConvert;
} }
private static List<AudioTrack> tracklist = new ArrayList<AudioTrack>(); private List<AudioTrack> tracklist = new ArrayList<AudioTrack>();
private File sptrack; private File sptrack;
private File mptrack; private File mptrack;
@ -379,6 +381,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
private void save() { private void save() {
frame.setEnabled(false); frame.setEnabled(false);
frame.setAlwaysOnTop(false); frame.setAlwaysOnTop(false);
normalizeVolumes = checkNormalize.isSelected();
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)+1; // Accounting for processes int progressSize = tracklist.size()+(sptrack != null?1:0)+(mptrack != null?1:0)+1; // Accounting for processes
@ -423,6 +426,11 @@ public class Suggs implements ActionListener, ListSelectionListener {
p.waitFor(); p.waitFor();
at.path = new File(Main.inpath + "temp/ffmpeg/" + at.path.getName() + ".wav"); at.path = new File(Main.inpath + "temp/ffmpeg/" + at.path.getName() + ".wav");
} }
if (normalizeVolumes) { // normalize tracks
Process p = Main.exec(new String[]{Main.inpath + "ffmpeg.exe", "-i", at.path.getPath(), "-filter:a loudnorm=linear=true:i=-5.0:lra=7.0:tp=0.0", "ffmpeg/" + at.path.getName() + "_normalized.wav"}, Main.inpath + "temp/");
p.waitFor();
at.path = new File(Main.inpath + "temp/ffmpeg/" + at.path.getName() + "_normalized.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) {