#2451 Importing sound ranges of different format than head by converting to uncompressed wav

This commit is contained in:
Jindra Petřík
2025-06-07 23:03:59 +02:00
parent ac9ceffae2
commit 2a8cddc7f9
7 changed files with 222 additions and 129 deletions
@@ -172,7 +172,6 @@ import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
import com.jpexs.decompiler.flash.tags.base.SoundImportException;
import com.jpexs.decompiler.flash.tags.base.SoundParametersMismatchException;
import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
import com.jpexs.decompiler.flash.tags.base.SoundTag;
import com.jpexs.decompiler.flash.tags.base.SymbolClassTypeTag;
@@ -5121,16 +5120,16 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
TreeItem ti0 = items.get(0);
File file = null;
if (ti0 instanceof SoundTag) {
if (ti0 instanceof SoundStreamFrameRange) {
/*if (ti0 instanceof SoundStreamFrameRange) {
SoundStreamFrameRange r = (SoundStreamFrameRange) ti0;
if (r.getSoundFormatId() == SoundFormat.FORMAT_MP3) {
file = showImportFileChooser("filter.sounds.mp3|*.mp3", false, "importsound");
} else {
file = showImportFileChooser("filter.sounds.wav|*.wav", false, "importsound");
}
} else {
file = showImportFileChooser("filter.sounds|*.mp3;*.wav|filter.sounds.mp3|*.mp3|filter.sounds.wav|*.wav", false, "importsound");
}
} else {*/
file = showImportFileChooser("filter.sounds|*.mp3;*.wav|filter.sounds.mp3|*.mp3|filter.sounds.wav|*.wav", false, "importsound");
//}
}
if (ti0 instanceof ImageTag) {
file = showImportFileChooser("filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp", true, "importimage");
@@ -5187,9 +5186,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
ViewMessages.showMessageDialog(this, translate("error.sound.rate").replace("%saplingRate%", samplingRateKhz).replace("%supportedRates%", String.join(", ", supportedRatesKhz)), translate("error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (SoundParametersMismatchException ex) {
ViewMessages.showMessageDialog(this, ex.getMessage(), translate("error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (SoundImportException ex) {
//ignore
}