diff --git a/CHANGELOG.md b/CHANGELOG.md index d2cfa7ff9..50d765234 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ All notable changes to this project will be documented in this file. - [#2131] Breakpoint list dialog - ExportAssets tag - show first item as description in the tree when there is only single item - [#2134] FLA Export - split main timeline into scenes when DefineSceneAndFrameLabelData tag is present -- [#2132] Show and export streamed sound (SoundStreamHead/SoundStreamBlock) in frame ranges +- [#2132] Show and export streamed sound (SoundStreamHead/SoundStreamBlock) in frame ranges (+ take scenes into account) - FLA export - show export time - [#2138] Morphshapes - detect classic easing - FLA export - option to disable fixing of shapes diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index e4d0ed345..241957034 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle; import com.jpexs.decompiler.flash.exporters.commonshape.Matrix; import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter; import com.jpexs.decompiler.flash.tags.DefineScalingGridTag; +import com.jpexs.decompiler.flash.tags.DefineSceneAndFrameLabelDataTag; import com.jpexs.decompiler.flash.tags.DefineSpriteTag; import com.jpexs.decompiler.flash.tags.DoActionTag; import com.jpexs.decompiler.flash.tags.DoInitActionTag; @@ -583,7 +584,14 @@ public class Timeline { boolean frameHasSound = false; int frame = 0; SoundStreamHeadTypeTag head = null; + List sceneOffsets = new ArrayList<>(); for (Tag t : tags) { + if (containerId == -1 && (t instanceof DefineSceneAndFrameLabelDataTag)) { + DefineSceneAndFrameLabelDataTag sceneFrameData = (DefineSceneAndFrameLabelDataTag) t; + for (Long offset : sceneFrameData.sceneOffsets) { + sceneOffsets.add((int) (long) offset); + } + } if (t instanceof SoundStreamHeadTypeTag) { head = (SoundStreamHeadTypeTag) t; head.setCharacterId(containerId); @@ -608,12 +616,20 @@ public class Timeline { if (t instanceof ShowFrameTag) { frame++; - if (frameHasSound) { + if (frameHasSound) { numFramesNoSound = 0; } else { numFramesNoSound++; } frameHasSound = false; + if (sceneOffsets.contains(frame)) { + if (range.endFrame > -1) { + ranges.add(range); + } + range = new SoundStreamFrameRange(head); + range.startFrame = -1; + range.endFrame = -1; + } } if (ranges == null) {