Skip to content

Fix linked sound export in Animate and SWFLite paths#45

Open
Tutez64 wants to merge 1 commit intoopenfl:masterfrom
Tutez64:fix/swf-linked-sound-export
Open

Fix linked sound export in Animate and SWFLite paths#45
Tutez64 wants to merge 1 commit intoopenfl:masterfrom
Tutez64:fix/swf-linked-sound-export

Conversation

@Tutez64
Copy link
Copy Markdown
Contributor

@Tutez64 Tutez64 commented Mar 30, 2026

Summary

This PR fixes linked sound export for the Animate export path and aligns the SWFLite path with the same linkage discovery improvements.

Previously, SWFs containing DefineSound assets could work in AIR while producing empty or incomplete audio exports in the Animate pipeline, because linked sound symbols were not exported as bundle assets. In addition, linkage discovery was less robust than needed for some real-world SWFs.

Changes

  • Animate export:

    • export DefineSound symbols as bundled audio assets
    • preserve linked class names for sound symbols
    • support direct export of MP3 and PCM-backed sounds
    • wrap PCM-backed sounds into WAV for standard asset loading
    • add runtime resolution of linked sound symbols in AnimateLibrary
  • SWFLite export:

    • align linkage symbol discovery with the Animate path
    • add fallback discovery from parsed tags, raw tags, and original SWF bytes
    • preserve linked sound class names for collected sound symbols
    • centralize soundFormat -> SoundType mapping
    • fix Speex mapping to the correct SWF sound format value
  • Runtime integration:

    • allow preprocessed sound symbols to be instantiated as Sound objects

Why

Some SWFs contain valid linked sound symbols that are not reliably recovered from the higher-level parsed structures alone. This PR makes symbol discovery more robust and ensures linked sounds are exported in a form usable by the Animate/OpenFL asset pipeline.

Scope / current limitations

This PR intentionally keeps sound container export narrow:

  • MP3 is exported directly
  • uncompressed PCM formats are exported as WAV
  • other SWF sound compression modes are detected but not yet exported as standard audio assets in the Animate path

Validation

Validated with a real game asset, and here's a standalone repro: SWFSoundExportRepro.zip

Note

This PR requires #40.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant