Skip to content

Conversation

@damiangr
Copy link

@damiangr damiangr commented Nov 5, 2025

Description

This PR adds the ability to embed NAM model files (.nam) and impulse response files (.wav) directly into DAW session/project files, making sessions fully portable and self-contained.

Features

  • Automatic Embedding: When saving a session, NAM models and IR files are encoded and embedded in the plugin state
  • Automatic Extraction: When loading a session, embedded files are extracted to temporary files and loaded automatically
  • Backward Compatible: Sessions without embedded data continue to work with file paths as before
  • Cross-Platform: Designed to work on Windows, macOS, and Linux

Benefits

  • Share sessions without worrying about missing model/IR files
  • Old projects remain playable even if original files are moved/deleted
  • Team members can open sessions without manual file management

Implementation

  • Modified SerializeState() to embed file contents in session data
  • Modified UnserializeState() to detect and extract embedded files automatically
  • Added _StageModelFromData() and _StageIRFromData() helper methods for loading from memory
  • Maintain backward compatibility with file path references
  • Update AudioDSPTools submodule to include SIGFPE fix (depends on Fix SIGFPE crash - Initialize mRawAudioSampleRate and validate sample… AudioDSPTools#24)

PR Checklist

  • Did you format your code using format.bash?
  • Does the VST3 plugin pass all of the unit tests in the VST3PluginTestHost?
    • Windows - Validated with pluginval (strictness level 5) - SUCCESS
    • macOS - Unable to test: VMware Sonoma 14.7.2 + Xcode 16.2 environment has NanoVG/Metal incompatibility issues. Recommend testing via GitHub Actions CI which uses Xcode 15.x.
  • Does your PR add, remove, or rename any plugin parameters? No
  • Does your PR add or remove any graphical assets? No

Testing Notes

Windows (Validated ✅)

  • Build: Visual Studio 2022, x64 Release
  • Validation: pluginval v1.x, strictness level 5
  • Results: All tests passed (audio processing, automation, state save/restore, editor, bus configuration)

macOS (Limited Testing ⚠️)

Note: Local macOS testing was not possible due to environmental constraints:

  • Test environment: VMware Sonoma 14.7.2 + Xcode 16.2
  • Issue: NanoVG/Metal incompatibility causing image loading crashes (not related to this PR)
  • Official v0.7.13 release also crashes in this environment
  • Recommendation: Please test via GitHub Actions CI, which uses Xcode 15.x and should work correctly

The embedding code itself is platform-independent and uses standard C++ file I/O. The implementation should work on macOS, but comprehensive validation via CI is recommended.

Dependencies

Files Changed

  • AudioDSPTools: Updated submodule to include SIGFPE fix from PR Fixes #24
  • NeuralAmpModeler.cpp: Embedding/extraction logic and helper methods (333 lines added)
  • NeuralAmpModeler.h: Added mNAMData and mIRData member variables
  • Unserialization.cpp: Added embedded data extraction logic (75 lines added)

- Implement Base64 encoding/decoding for NAM models (.nam) and IR files (.wav)
- Add SerializeState() to embed file contents in session data
- Add UnserializeState() to extract embedded files automatically
- Add _StageModelFromData() and _StageIRFromData() helper methods
- Maintain backward compatibility with file path references
- Update AudioDSPTools submodule to include SIGFPE fix (PR sdatkinson#24)

This makes sessions fully portable and self-contained.

Testing:
- Windows: Builds successfully, validated with pluginval (strictness 5)
- macOS: Limited testing due to environmental constraints
- Recommend CI testing for comprehensive validation
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