Added #2259 Optional resampling sound to 44kHz on playback and on export

This commit is contained in:
Jindra Petřík
2024-07-20 20:53:27 +02:00
parent 502d44b06d
commit 6d8b631383
29 changed files with 317 additions and 72 deletions

View File

@@ -2194,7 +2194,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (export.isOptionEnabled(SoundExportMode.class)) {
ret.addAll(new SoundExporter().exportSounds(handler, selFile2 + File.separator + SoundExportSettings.EXPORT_FOLDER_NAME, sounds,
new SoundExportSettings(export.getValue(SoundExportMode.class)), evl));
new SoundExportSettings(export.getValue(SoundExportMode.class), export.isResampleWavEnabled()), evl));
}
if (export.isOptionEnabled(BinaryDataExportMode.class)) {
@@ -2258,7 +2258,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
singleScriptFile = false;
}
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(export.getValue(ScriptExportMode.class), singleScriptFile, false, export.isEmbedEnabled(), false);
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(export.getValue(ScriptExportMode.class), singleScriptFile, false, export.isEmbedEnabled(), false, export.isResampleWavEnabled());
String singleFileName = Path.combine(scriptsFolder, openable.getShortFileName() + scriptExportSettings.getFileExtension());
try (FileTextWriter writer = scriptExportSettings.singleFile ? new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(singleFileName)) : null) {
scriptExportSettings.singleFileWriter = writer;
@@ -2312,7 +2312,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (export.isOptionEnabled(SoundExportMode.class)) {
new SoundExporter().exportSounds(handler, Path.combine(selFile, SoundExportSettings.EXPORT_FOLDER_NAME), swf.getTags(),
new SoundExportSettings(export.getValue(SoundExportMode.class)), evl);
new SoundExportSettings(export.getValue(SoundExportMode.class), export.isResampleWavEnabled()), evl);
}
if (export.isOptionEnabled(BinaryDataExportMode.class)) {
@@ -2365,7 +2365,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
singleScriptFile = false;
}
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(export.getValue(ScriptExportMode.class), singleScriptFile, false, export.isEmbedEnabled(), false);
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(export.getValue(ScriptExportMode.class), singleScriptFile, false, export.isEmbedEnabled(), false, export.isResampleWavEnabled());
String singleFileName = Path.combine(scriptsFolder, swf.getShortFileName() + scriptExportSettings.getFileExtension());
try (FileTextWriter writer = scriptExportSettings.singleFile ? new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(singleFileName)) : null) {
scriptExportSettings.singleFileWriter = writer;
@@ -2415,7 +2415,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (export.isOptionEnabled(SoundExportMode.class)) {
for (SoundExportMode exportMode : SoundExportMode.values()) {
new SoundExporter().exportSounds(handler, Path.combine(selFile, SoundExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf.getTags(),
new SoundExportSettings(exportMode), evl);
new SoundExportSettings(exportMode, export.isResampleWavEnabled()), evl);
}
}
@@ -2482,7 +2482,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
singleScriptFile = false;
}
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(exportMode, singleScriptFile, false, export.isEmbedEnabled(), false);
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(exportMode, singleScriptFile, false, export.isEmbedEnabled(), false, export.isResampleWavEnabled());
String singleFileName = Path.combine(scriptsFolder, swf.getShortFileName() + scriptExportSettings.getFileExtension());
try (FileTextWriter writer = scriptExportSettings.singleFile ? new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(singleFileName)) : null) {
scriptExportSettings.singleFileWriter = writer;
@@ -5574,7 +5574,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
previewPanel.setImageReplaceButtonVisible(false, false, false, !((SoundTag) treeItem).isReadOnly() && ((SoundTag) treeItem).importSupported(), false, false, false);
if (!(treeItem instanceof SoundStreamHeadTypeTag)) {
try {
SoundTagPlayer soundThread = new SoundTagPlayer(null, (SoundTag) treeItem, Configuration.loopMedia.get() ? Integer.MAX_VALUE : 1, true);
SoundTagPlayer soundThread = new SoundTagPlayer(null, (SoundTag) treeItem, Configuration.loopMedia.get() ? Integer.MAX_VALUE : 1, true, Configuration.previewResampleSound.get());
if (!Configuration.autoPlaySounds.get()) {
soundThread.pause();
}