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);
if (isSoundtrack) {
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[]{true, false, false, false});
container.put("requires", requiresTemp); // Pull localization files for patching.
}
} else {

View File

@ -40,7 +40,7 @@
</component>
</children>
</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"/>
<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"/>
@ -54,7 +54,7 @@
<children>
<component id="adce7" class="javax.swing.JButton" binding="cancelBtn">
<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>
<properties>
<background color="-2271221"/>
@ -67,25 +67,27 @@
</component>
<hspacer id="8ecbf">
<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>
</hspacer>
<component id="b6c2f" class="javax.swing.JCheckBox" binding="checkAdditive">
<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>
<properties>
<enabled value="false"/>
<focusPainted value="false"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<opaque value="false"/>
<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"/>
</properties>
</component>
<component id="a7b02" class="javax.swing.JButton" binding="saveBtn">
<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>
<properties>
<background color="-2271221"/>
@ -96,6 +98,21 @@
<text value="Save"/>
</properties>
</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>
</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">

View File

@ -73,10 +73,12 @@ public class Suggs implements ActionListener, ListSelectionListener {
private JCheckBox checkAdditive;
private JButton spDeleteBtn;
private JButton mpDeleteBtn;
private JCheckBox checkNormalize;
private Scooter progressDialog;
JFrame parent;
int curIndex = -1;
boolean normalizeVolumes = false;
public class AudioTrack {
public File path; // file name
@ -85,7 +87,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
public long size; // file size in bytes
public boolean noConvert;
}
private static List<AudioTrack> tracklist = new ArrayList<AudioTrack>();
private List<AudioTrack> tracklist = new ArrayList<AudioTrack>();
private File sptrack;
private File mptrack;
@ -379,6 +381,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
private void save() {
frame.setEnabled(false);
frame.setAlwaysOnTop(false);
normalizeVolumes = checkNormalize.isSelected();
Main.deleteDir(new File(System.getProperty("user.home") + "/.firestar/temp/")); // starts with clean temp
new Thread(() -> {
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();
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/");
p.waitFor();
} catch (IOException | InterruptedException ex) {