-
-
Notifications
You must be signed in to change notification settings - Fork 318
Add FAUST back with interpreter backend, UI #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
9fb405f to
1bd90d4
Compare
1b677b2 to
573d006
Compare
WIP only arm64
573d006 to
1c2435c
Compare
PR Review: Add FAUST back with interpreter backend, UIThank you for bringing FAUST support back to iPlug2! This is a significant feature addition. Here's my detailed review: OverviewThis PR re-introduces FAUST (Functional Audio Stream) DSP integration using the interpreter backend rather than LLVM JIT compilation. The PR includes 100 files with a new example project Code Quality & Best PracticesPositive Aspects
Issues Identified1. Commented-Out Code (Medium Priority)Multiple instances of large commented blocks that should be removed or addressed:
Recommendation: Either implement these features or remove the commented code. Dead code creates maintenance burden. 2. TODO Comments (Medium Priority)Several unresolved TODOs in production code:
Recommendation: Address these before merging or create follow-up issues. 3. Error Handling (High Priority)IPlugFaustGen.cpp:98, 391, 409: Multiple assert(pFactory != nullptr); // Line 98
assert(mDSP); // Line 391
assert((mDSP->getNumInputs() <= mMaxNInputs)...); // Line 409Problem: Assertions are removed in release builds. Critical error conditions should have proper error handling. Recommendation: if (!pFactory) {
DBGMSG("ERROR: Failed to create interpreter factory\n");
return nullptr; // or handle gracefully
}IPlugFaustGen.cpp:332: Assertion with helpful message but will crash in release: assert(0 && "If you hit this assert it means the faust DSP file...");4. Potential Memory IssuesFaustCode.hpp:77-78: Raw static Faust1SIG0* newFaust1SIG0() { return (Faust1SIG0*)new Faust1SIG0(); }
static void deleteFaust1SIG0(Faust1SIG0* dsp) { delete dsp; }This is FAUST-generated code, but ensure lifecycle is properly managed. IPlugFaustGen.cpp:138, 261: Raw dsp_poly* pDspPoly = new mydsp_poly(pMonoDSP, nVoices, true);Should be managed by smart pointer or documented why raw pointer is necessary. Potential Bugs1. Auto-Recompile Timer (High Priority)IPlugFaustGen.cpp:536: Incorrect void FaustGen::SetAutoRecompile(bool enable)
{
if (enable) {
if (sTimer == nullptr)
sTimer = Timer::Create(std::bind(&FaustGen::OnTimer, this, std::placeholders::_1), ...);Problem: Fix: The timer needs to iterate over all instances or use a static callback. 2. File Watching Race Condition (Medium Priority)IPlugFaustGen.cpp:508-520: File modification checking could miss rapid changes: if (!Equal(newTime, oldTime)) {
WDL_MutexLock lock(&mMutex); // Lock AFTER checking, not before
recompile = true;
f.second->FreeDSPFactory();Issue: TOCTOU (Time-of-check-time-of-use) - file could change between stat and lock acquisition. Recommendation: Acquire lock before stat check, or document this is acceptable. 3. Missing NULL Check (Medium Priority)IPlugFaustDSP.cpp:41: UI removal without null check: GetUI()->RemoveAllControls();Recommendation: Verify Performance Considerations1. Realtime Safety Violation (Critical)IPlugFaust.cpp:116-121: Loop in ProcessBlock doing repeated work: for (auto s=0; s<nFrames; s++) {
pSender->ProcessBlock(tmp, 1, mCtrlTagStart + i);
}Problem: Calling Recommendation: Redesign sender API or batch properly. 2. Lambda Capture Allocation (Medium Priority)IPlugFaust.cpp:97: Lambda capture in audio callback: [&](sample** inputs, sample** outputs, int nFrames) //TODO:: badness capture = allocatedIssue: While the TODO notes this, lambda captures in realtime code should be verified as non-allocating. 3. Goto Usage (Low Priority - Style)IPlugFaustGen.cpp:158, 168, 179: Uses goto end;
...
end:
assert(pDSP);Note: While not inherently bad, modern C++ prefers RAII patterns. Consider refactoring to early returns. Security Concerns1. Path Injection (Low - Development Only)IPlugFaustDSP.cpp:32: Hardcoded path concatenation: filePath.Append("/IPlugFaustDSP.dsp");Note: Should be safe since this is development/debugging code, but validate paths if user-controllable. 2. DLL Hijacking (Low - Windows)IPlugFaustGen.cpp:351: Direct DLL directory manipulation: #ifdef OS_WIN
SetDllDirectoryA(FAUST_DLL_PATH);
#endifRecommendation: Ensure Test CoverageCritical Issue: No test files found in this PR. Recommendations:
Build SystemmacOS Build (build-faust-mac.sh)
Windows Build (build-faust-win.ps1)
Recommendation: If using interpreter backend only, simplify Windows build to match macOS approach. DocumentationREADME.md Issues
Recommendation: Update README to reflect interpreter-based approach. SummaryMust Fix Before Merge
Should Fix
Nice to Have
This is great work bringing FAUST back to iPlug2! The core architecture is solid. Addressing the critical issues above will make this production-ready. |
PR Review: Add FAUST back with interpreter backend, UIThis PR re-introduces FAUST integration to iPlug2 using the interpreter backend instead of LLVM. Here's my comprehensive review: OverviewThe PR adds comprehensive FAUST support with JIT compilation capabilities and a complete example project. The implementation is substantial (87 files changed) and includes build scripts, core integration files, and a full example plugin. Code Quality & Best PracticesStrengths:
Issues:
Potential Bugs & IssuesCritical:
Medium:
Performance ConsiderationsGood:
Concerns:
Security Concerns
Test CoverageMissing:
Recommendation: Add at least basic smoke tests for:
Architecture & DesignStrengths:
Suggestions:
DocumentationGood:
Needs Improvement:
Platform-Specific IssuesWindows:
macOS:
Style Compliance (per CLAUDE.md)✅ 2-space indentation Summary & RecommendationsBefore Merge:
Post-Merge:
Overall Assessment: Recommendation: Request changes to address critical bugs and code cleanup before merging. |
wip