mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-30 14:11:26 +00:00
Added #2259 Optional resampling sound to 44kHz on playback and on export
This commit is contained in:
@@ -33,7 +33,6 @@ import com.jpexs.decompiler.flash.exporters.modes.SpriteExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SymbolClassExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.TextExportMode;
|
||||
import com.jpexs.decompiler.flash.gui.tagtree.TagTreeModel;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineFont4Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
|
||||
@@ -57,6 +56,7 @@ import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -147,6 +147,8 @@ public class ExportDialog extends AppDialog {
|
||||
private JTextField zoomTextField = new JTextField();
|
||||
|
||||
private JCheckBox embedCheckBox;
|
||||
|
||||
private JCheckBox resampleWavCheckBox;
|
||||
|
||||
public <E> E getValue(Class<E> option) {
|
||||
for (int i = 0; i < optionClasses.length; i++) {
|
||||
@@ -172,6 +174,10 @@ public class ExportDialog extends AppDialog {
|
||||
public boolean isEmbedEnabled() {
|
||||
return embedCheckBox.isSelected();
|
||||
}
|
||||
|
||||
public boolean isResampleWavEnabled() {
|
||||
return resampleWavCheckBox.isSelected();
|
||||
}
|
||||
|
||||
public double getZoom() {
|
||||
return Double.parseDouble(zoomTextField.getText()) / 100;
|
||||
@@ -192,6 +198,12 @@ public class ExportDialog extends AppDialog {
|
||||
|
||||
Configuration.lastSelectedExportZoom.set(Double.parseDouble(zoomTextField.getText()) / 100);
|
||||
Configuration.lastSelectedExportFormats.set(cfg.toString());
|
||||
if (embedCheckBox.isVisible()) {
|
||||
Configuration.lastExportEnableEmbed.set(embedCheckBox.isSelected());
|
||||
}
|
||||
if (resampleWavCheckBox.isVisible()) {
|
||||
Configuration.lastExportResampleWav.set(resampleWavCheckBox.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean optionCanHandle(int optionIndex, Object e) {
|
||||
@@ -284,6 +296,8 @@ public class ExportDialog extends AppDialog {
|
||||
comboPanel.add(selectAllCheckBox);
|
||||
top += selectAllCheckBox.getHeight();
|
||||
|
||||
List<Class> visibleOptionClasses = new ArrayList<>();
|
||||
|
||||
boolean zoomable = false;
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
Class c = optionClasses[i];
|
||||
@@ -317,6 +331,8 @@ public class ExportDialog extends AppDialog {
|
||||
if (Arrays.asList(zoomClasses).contains(c)) {
|
||||
zoomable = true;
|
||||
}
|
||||
|
||||
visibleOptionClasses.add(c);
|
||||
|
||||
JLabel lab = new JLabel(translate(optionNames[i]));
|
||||
lab.setBounds(10, top, lab.getPreferredSize().width, lab.getPreferredSize().height);
|
||||
@@ -327,6 +343,7 @@ public class ExportDialog extends AppDialog {
|
||||
}
|
||||
|
||||
embedCheckBox = new JCheckBox(translate("embed"));
|
||||
embedCheckBox.setVisible(false);
|
||||
|
||||
boolean hasAs3 = false;
|
||||
if (exportables == null) {
|
||||
@@ -342,7 +359,8 @@ public class ExportDialog extends AppDialog {
|
||||
|
||||
int w = 10 + labWidth + 10 + checkBoxWidth + 10 + comboWidth + 10;
|
||||
|
||||
if (hasAs3 && Arrays.asList(optionClasses).contains(ScriptExportMode.class)) {
|
||||
if (hasAs3 && visibleOptionClasses.contains(ScriptExportMode.class)) {
|
||||
embedCheckBox.setVisible(true);
|
||||
top += 2;
|
||||
embedCheckBox.setBounds(10, top, embedCheckBox.getPreferredSize().width, embedCheckBox.getPreferredSize().height);
|
||||
comboPanel.add(embedCheckBox);
|
||||
@@ -353,8 +371,28 @@ public class ExportDialog extends AppDialog {
|
||||
}
|
||||
if (Configuration.lastExportEnableEmbed.get()) {
|
||||
embedCheckBox.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resampleWavCheckBox = new JCheckBox(translate("resampleWav"));
|
||||
resampleWavCheckBox.setVisible(false);
|
||||
|
||||
|
||||
if (embedCheckBox.isVisible() ||visibleOptionClasses.contains(SoundExportMode.class)) {
|
||||
top += 2;
|
||||
resampleWavCheckBox.setVisible(true);
|
||||
comboPanel.add(resampleWavCheckBox);
|
||||
if (Configuration.lastExportResampleWav.get()) {
|
||||
resampleWavCheckBox.setSelected(true);
|
||||
}
|
||||
|
||||
resampleWavCheckBox.setBounds(10, top, resampleWavCheckBox.getPreferredSize().width, resampleWavCheckBox.getPreferredSize().height);
|
||||
top += resampleWavCheckBox.getHeight();
|
||||
|
||||
if (resampleWavCheckBox.getWidth() + 10 > w) {
|
||||
w = resampleWavCheckBox.getWidth() + 10;
|
||||
}
|
||||
}
|
||||
|
||||
int zoomWidth = 50;
|
||||
if (zoomable) {
|
||||
|
||||
Reference in New Issue
Block a user