Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@olilarkin
Copy link
Member

Adds a new example that uses Visage for the UI

https://github.com/VitalAudio/visage

@olilarkin olilarkin changed the title WIP: Add IPlugVisage Example Add IPlugVisage Example Feb 12, 2025
@claude
Copy link

claude bot commented Dec 21, 2025

Code Review: IPlugVisage Example

This PR adds a new example demonstrating Visage UI integration with iPlug2. Overall, this is a valuable addition that shows alternative UI approaches. Here are my findings:

✅ Strengths

  1. Good example structure - Follows iPlug2 conventions with clean separation of Plugin.h/cpp and config.h
  2. Comprehensive project files - Includes all platform configurations (macOS, iOS, Windows, Web)
  3. Proper licensing - Examples code includes MIT license headers from Visage
  4. Documentation - Includes README and setup script

🔍 Code Quality Issues

Critical Issues

  1. README description mismatch (README.md:2)

    • States "A basic volume control effect plug-in with IGraphics GUI"
    • Should be "...with Visage GUI" since this example specifically uses Visage, not IGraphics
  2. Missing include guard/file (IPlugVisage.h:6)

    • References #include "showcase.h" but this file appears to be copied from Visage examples
    • Need to verify showcase.h/cpp are properly included in build targets
  3. Lambda capture by reference in UI callback (IPlugVisage.cpp:38)

    • mEditor->onDraw() = [&](visage::Canvas& canvas) captures this by reference
    • If the lambda outlives the object, this creates dangling references
    • Consider explicit capture: [this] or ensure proper lifetime management
  4. Unused ShaderCompiler (IPlugVisage.cpp:35-36)

    • compiler is created as local variable but goes out of scope immediately
    • Either remove it or make it a member if shader hot-reloading is needed
  5. Hardcoded shader path (IPlugVisage.cpp:16)

    • return (folderPath / "visage/examples/shaders").string();
    • This assumes specific directory structure that may not exist in built plugins
    • Should handle missing directory gracefully or use bundled resources

Style & Convention Issues

  1. Copyright year (config.h:9)

    • "Copyright 2020 Acme Inc" should probably be 2025 or current year
  2. Config inconsistency (config.h:26, config/IPlugVisage-mac.xcconfig:26)

    • config.h sets NO_IGRAPHICS in preprocessor but PLUG_HAS_UI 1
    • This is intentional for Visage but could confuse developers copying this example
    • Add comment explaining this is specific to Visage UI
  3. Unnecessary OnIdle override (IPlugVisage.cpp:25-27)

    • Empty implementation - can be removed unless planned for future use
  4. Missing const correctness (IPlugVisage.cpp:60)

    • OnParentWindowResize(int width, int height) - parameters could be const
  5. gitignore typo (.gitignore:23)

    • .DS_Stor* should be .DS_Store* (missing 'e')

⚠️ Potential Issues

  1. Build dependency management

    • get_visage.sh clones Visage but project files reference hardcoded paths
    • No verification that Visage is built before building this example
    • Consider adding build instructions or CMakeLists.txt integration
  2. ProcessBlock performance (IPlugVisage.cpp:78-88)

    • Nested loop could benefit from processing channels in outer loop for better cache locality
    • Current implementation is fine for simple gain but worth noting for educational purposes
  3. Window lifecycle (IPlugVisage.cpp:69-76)

    • CloseWindow() calls mWindow.reset() but doesn't check if editor is still attached
    • Order of operations looks correct but could add null checks for safety
  4. Missing error handling

    • OpenWindow doesn't handle allocation failures or Visage initialization errors
    • Should consider returning nullptr and checking in host if critical setup fails

📝 Documentation

  1. Missing build instructions

    • README should mention:
      • Need to run get_visage.sh first
      • Visage build requirements (CMake, etc.)
      • Platform-specific setup steps
  2. Example scope unclear

    • Is this meant to be a minimal example or showcase of Visage features?
    • The showcase frame suggests comprehensive demo, but README says "basic volume control"

🔒 Security & Performance

  1. No security issues identified - Standard plugin code
  2. Realtime-safe ProcessBlock - No allocations, locks, or file I/O ✓

🧪 Test Coverage

  • No automated tests included (typical for examples)
  • Manual testing instructions would be helpful

Recommendations

Must fix before merge:

  • Fix README description
  • Fix lambda capture or document lifetime guarantees
  • Handle shader path more robustly
  • Fix .gitignore typo

Should fix:

  • Update copyright year
  • Add build instructions to README
  • Remove unused ShaderCompiler or make it functional
  • Remove empty OnIdle() override
  • Add comment explaining NO_IGRAPHICS usage

Nice to have:

  • Add error handling in OpenWindow
  • Improve ProcessBlock loop order for educational value
  • Add CMake integration example

This is a solid example that will help users integrate Visage. With the critical fixes above, it will be ready to merge. Thanks for contributing this!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants