[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77W8KBXHH113Q2P520HVQEX":3,"skill-same:01M77W8KBXHH113Q2P520HVQEX":42},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":27,"install":28,"resources":41},"01M77W8KBXHH113Q2P520HVQEX","impl",null,"johnson-cooper\u002Fsolara","johnson-cooper","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F129237833?v=4","01M77W77NPX34PNKYKJGW9GHE8","Cooper Johnson","01M77W77PE71KVTKQCGJYV7Z0X",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimpl\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"# SKILL: DSP IMPLEMENTATION\n**Goal:** Implement audio processing where parameters control DSP\n**Focus:** PluginProcessor.h, PluginProcessor.cpp\n**Output Location:** `plugins\u002F[Name]\u002FSource\u002F`\n\n---\n\n## 📊 PHASE 4: CODE (DSP Implementation)\n\n**Trigger:** `\u002Fimpl [Name]` (after DESIGN phase complete)\n**Input:** Reads `plugins\u002F[Name]\u002Fstatus.json` and `.ideas\u002Fparameter-spec.md`\n**Prerequisites:** Architecture plan complete, UI framework selected\n\n**State Validation:**\n```powershell\n# Import state management module\n. \"$PSScriptRoot\\..\\scripts\\state-management.ps1\"\n\n# Validate prerequisites\nif (-not (Test-PluginState -PluginPath \"plugins\\[Name]\" -RequiredPhase \"design_complete\" -RequiredFiles @(\".ideas\u002Farchitecture.md\", \".ideas\u002Fplan.md\"))) {\n    Write-Error \"Prerequisites not met. Complete design phase first.\"\n    exit 1\n}\n\n# Check framework selection\n$state = Get-PluginState -PluginPath \"plugins\\[Name]\"\nif ($state.ui_framework -eq \"pending\") {\n    Write-Error \"UI framework not selected. Cannot proceed with implementation.\"\n    exit 1\n}\nWrite-Host \"Framework: $($state.ui_framework)\" -ForegroundColor Cyan\n```\n\n---\n\n## 🎨 PHASE 4.0: DESIGN-TO-FRAMEWORK CONVERSION (CRITICAL - BEFORE DSP CODE)\n\n**Framework Routing:**\n- If `ui_framework == webview`: use templates from `templates\u002Fwebview\u002F`\n- If `ui_framework == visage`: use templates from `templates\u002Fvisage\u002F` and **do not** generate HTML\n\n**IMPORTANT:** This phase converts the approved design specifications into framework-specific code. User must approve the conversion before DSP implementation begins.\n\n### 4.0.1 Read Approved Design\n- Read `Design\u002Fv[N]-ui-spec.md` (latest approved version)\n- Read `Design\u002Fv[N]-style-guide.md` (latest approved version)\n- Read `.ideas\u002Fparameter-spec.md` for parameter definitions\n\n### 4.0.2 Framework-Specific Conversion\n\n**For WebView Framework:**\nConvert the approved design specs into production JUCE WebView code.\n\n**Create the required directory structure:**\n```\nplugins\u002F[Name]\u002FSource\u002Fui\u002F\n└───public\u002F\n    │   index.html          # Production UI based on approved design\n    │\n    └───js\u002F\n        │   index.js        # JUCE integration and parameter binding\n        │\n        └───juce\u002F\n                check_native_interop.js  # Development utility\n                index.js                # JUCE frontend library\n```\n\n**Implementation Steps:**\n1. **Create directories:** `plugins\u002F[Name]\u002FSource\u002Fui\u002Fpublic\u002F` and subdirectories\n2. **Copy JUCE frontend library:** Copy `modules\u002Fjuce_gui_extra\u002Fnative\u002Fjavascript\u002Findex.js` to `js\u002Fjuce\u002Findex.js`\n3. **Create interop checker:** Generate `js\u002Fjuce\u002Fcheck_native_interop.js` for development\n4. **Convert design to HTML:** Transform approved design specs into `index.html` with embedded CSS\n5. **Generate JavaScript:** Create `js\u002Findex.js` with parameter state setup and UI controls\n\n**Conversion Process:**\n- Extract layout, colors, and styling from `v[N]-style-guide.md`\n- Extract control specifications from `v[N]-ui-spec.md`\n- Generate HTML structure matching the approved design\n- Implement interactive controls using JUCE parameter states\n- Apply approved color palette and visual style\n\n**Example Output (based on approved design):**\n\n**ui\u002Fpublic\u002Findex.html:**\n```html\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n  \u003Cmeta charset=\"UTF-8\">\n  \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  \u003Ctitle>[Name] Plugin\u003C\u002Ftitle>\n  \u003Cscript type=\"module\" src=\"js\u002Findex.js\">\u003C\u002Fscript>\n  \u003Cstyle>\n    \u002F* Styles based on approved v[N]-style-guide.md *\u002F\n    body {\n        background: [approved-background-color];\n        color: [approved-text-color];\n        font-family: [approved-font-family];\n        margin: 0;\n        padding: 20px;\n    }\n    \u002F* Additional styles from approved design *\u002F\n  \u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003C!-- Layout based on approved v[N]-ui-spec.md -->\n  \u003Cdiv id=\"plugin-ui\">\n    \u003C!-- Controls generated from parameter-spec.md -->\n  \u003C\u002Fdiv>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n**ui\u002Fpublic\u002Fjs\u002Findex.js:**\n```javascript\nimport * as Juce from \".\u002Fjuce\u002Findex.js\";\n\n\u002F\u002F Initialize parameter states from parameter-spec.md\nconst parameterStates = {};\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n    \u002F\u002F Create UI controls based on approved design\n    initializeUI();\n    console.log(\"WebView UI initialized from approved design\");\n});\n\nfunction initializeUI() {\n    \u002F\u002F Generate controls based on v[N]-ui-spec.md specifications\n    \u002F\u002F Bind to JUCE parameter states\n}\n```\n\n**USER APPROVAL REQUIRED - CRITICAL STOP POINT:**\n```\n✅ Design converted to WebView code\n\nFiles created:\n- plugins\u002F[Name]\u002FSource\u002Fui\u002Fpublic\u002Findex.html\n- plugins\u002F[Name]\u002FSource\u002Fui\u002Fpublic\u002Fjs\u002Findex.js\n- plugins\u002F[Name]\u002FSource\u002Fui\u002Fpublic\u002Fjs\u002Fjuce\u002Findex.js\n\n⚠️ **MANDATORY STOP** - You MUST test the WebView setup before proceeding to DSP implementation!\n\nWhat would you like to do?\n1. Test WebView - Open plugins\u002F[Name]\u002FSource\u002Fui\u002Fpublic\u002Findex.html in browser and verify appearance\n2. Approve - Proceed with DSP implementation (confirms WebView GUI is acceptable)\n3. Revise - Make changes to the conversion\n\n**YOU MUST CHOOSE OPTION 1 OR 2 BEFORE CONTINUING**\n**DO NOT PROCEED TO PHASE 4.1 WITHOUT USER APPROVAL**\n\nChoose (1-3): _\n```\n\n**Approval Validation:**\n- If user chooses 1: Wait for user to test and return to this menu\n- If user chooses 2: Mark WebView GUI as approved and proceed to Phase 4.1\n- If user chooses 3: Allow revisions to the design conversion\n\n**For Visage Framework:**\nConvert approved design to Visage C++ code (Source\u002FVisageControls.h).\nUse templates from `templates\u002Fvisage\u002F` and the shared host in `common\u002FVisageJuceHost.h`.\n\n---\n\n## ✅ VISAGE IMPLEMENTATION CHECKLIST (MANDATORY)\n\n**Before proceeding to DSP implementation, validate Visage setup:**\n\n```powershell\n.\\scripts\\validate-visage-setup.ps1 -PluginName [Name]\n```\n\n### Mandatory Checklist (All Must Pass):\n1. ✅ **CMakeLists.txt links Visage**\n   - Contains `visage::visage` in `target_link_libraries`\n2. ✅ **Visage controls exist**\n   - `Source\u002FVisageControls.h` present\n3. ✅ **Editor uses Visage host**\n   - `PluginEditor.h` includes `VisageJuceHost.h`\n   - Editor inherits `VisagePluginEditor`\n4. ✅ **No WebView-only flags**\n   - `NEEDS_WEBVIEW2 TRUE` and `JUCE_WEB_BROWSER=1` not present\n\n---\n\n## ✅ WEBVIEW IMPLEMENTATION CHECKLIST (MANDATORY)\n\n**CRITICAL:** When implementing WebView plugins, you MUST verify ALL 8 points below. Use templates from `templates\u002Fwebview\u002F` and run validation script.\n\n### WebView Setup Validation (Run Before DSP Implementation)\n\n**Before proceeding to Phase 4.1, validate WebView setup:**\n\n```powershell\n# Run validation script\n.\\scripts\\validate-webview-setup.ps1 -PluginName [Name]\n```\n\n### Mandatory Checklist (All Must Pass):\n\n1. ✅ **CMakeLists.txt embeds web files**\n   - Contains `juce_add_binary_data([Name]_WebUI ...)`\n   - Links binary data target: `target_link_libraries([Name] PRIVATE [Name]_WebUI ...)`\n   - Has `NEEDS_WEBVIEW2 TRUE` in `juce_add_plugin()`\n   - Has compile definitions: `JUCE_WEB_BROWSER=1` and `JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING=1`\n\n2. ✅ **WebBrowserComponent uses WebView2 backend**\n   - `.withBackend(WebBrowserComponent::Options::Backend::webview2)` is present\n   - NOT using default backend (must be explicit)\n\n3. ✅ **WebBrowserComponent has user data folder**\n   - `.withUserDataFolder(File::getSpecialLocation(File::SpecialLocationType::tempDirectory))` is present\n   - Required for Windows plugins to work\n\n4. ✅ **Native integration enabled**\n   - `.withNativeIntegrationEnabled()` is present\n   - Enables JavaScript ↔ C++ communication\n\n5. ✅ **Resource provider implemented**\n   - `.withResourceProvider([this](const auto& url) { return getResource(url); })` is present\n   - `getResource()` function exists and loads from embedded zip\n   - `getZipFile()` helper function exists\n\n6. ✅ **Parameter relays created BEFORE WebBrowserComponent**\n   - Relays created before `std::make_unique\u003CWebBrowserComponent>()`\n   - Relays passed via `.withOptionsFrom(*relay)` for each parameter\n\n7. ✅ **Parameter attachments created AFTER WebBrowserComponent**\n   - Attachments created after `addAndMakeVisible(*webView)`\n   - Attachments connect parameters to relays\n\n8. ✅ **Web content loaded via resource provider**\n   - Uses `webView->goToURL(WebBrowserComponent::getResourceProviderRoot())`\n   - NOT using `data:text\u002Fhtml;base64,...` or `loadHTML()`\n   - NOT using hardcoded HTML strings\n\n### 🔴 CRITICAL: Member Declaration Order (PluginEditor.h)\n\n**⚠️ #1 CAUSE OF DAW CRASHES - VERIFY THIS FIRST**\n\nC++ destroys members in REVERSE order of declaration. If WebView is declared before relays, it will be destroyed AFTER relays, causing a crash when it tries to access freed relay memory.\n\n**✅ CORRECT ORDER (in PluginEditor.h):**\n```cpp\nprivate:\n    \u002F\u002F 1. RELAYS FIRST (destroyed last)\n    juce::WebSliderRelay gainRelay { \"GAIN\" };\n\n    \u002F\u002F 2. WEBVIEW SECOND (destroyed middle)\n    std::unique_ptr\u003Cjuce::WebBrowserComponent> webView;\n\n    \u002F\u002F 3. ATTACHMENTS LAST (destroyed first)\n    std::unique_ptr\u003Cjuce::WebSliderParameterAttachment> gainAttachment;\n```\n\n**❌ WRONG ORDER (causes DAW crash on unload):**\n```cpp\nprivate:\n    std::unique_ptr\u003Cjuce::WebBrowserComponent> webView;  \u002F\u002F ❌ Too early!\n    juce::WebSliderRelay gainRelay { \"GAIN\" };           \u002F\u002F ❌ Too late!\n```\n\n**Verification:** Run validation script before building:\n```powershell\n.\\scripts\\validate-webview-member-order.ps1 -PluginName [Name]\n```\n\nSee: `.claude\u002Ftroubleshooting\u002Fresolutions\u002Fwebview-member-order-crash.md`\n\n---\n\n### Common Mistakes to Avoid:\n\n❌ **DON'T:** Declare webView before relays in header file\n✅ **DO:** Always use order: Relays → WebView → Attachments\n\n❌ **DON'T:** Use data URIs (`data:text\u002Fhtml;base64,...`)\n✅ **DO:** Use `getResourceProviderRoot()` with embedded files\n\n❌ **DON'T:** Create WebBrowserComponent without WebView2 backend\n✅ **DO:** Explicitly specify `.withBackend(webview2)`\n\n❌ **DON'T:** Create parameter attachments before WebBrowserComponent\n✅ **DO:** Create relays → WebBrowserComponent → attachments (in that order)\n\n❌ **DON'T:** Skip resource provider\n✅ **DO:** Implement `getResource()` function to serve embedded files\n\n❌ **DON'T:** Forget to embed web files in CMakeLists.txt\n✅ **DO:** Use `juce_add_binary_data()` to embed all web UI files\n\n### Template Usage:\n\n**Copy templates from:** `templates\u002Fwebview\u002F`\n- `PluginEditor.h.template` → `Source\u002FPluginEditor.h`\n- `PluginEditor.cpp.template` → `Source\u002FPluginEditor.cpp`\n- `CMakeLists.txt.template` → `CMakeLists.txt`\n\n**Replace placeholders:**\n- `{{PLUGIN_NAME}}` → Your plugin class name\n- `{{PLUGIN_NAME_LOWER}}` → Lowercase plugin name\n- `{{PARAMETER_RELAYS}}` → Your parameter relay declarations\n- `{{CREATE_PARAMETER_RELAYS}}` → Code to create relays\n- `{{WITH_OPTIONS_FROM_RELAYS}}` → `.withOptionsFrom()` calls\n- `{{CREATE_PARAMETER_ATTACHMENTS}}` → Code to create attachments\n\n### If Validation Fails:\n\n1. Review error messages from validation script\n2. Check templates in `templates\u002Fwebview\u002F`\n3. Compare your code with JUCE example: `_tools\u002FJUCE\u002Fexamples\u002FPlugins\u002FWebViewPluginDemo.h`\n4. Ensure web files exist: `Source\u002Fui\u002Fpublic\u002Findex.html`, `js\u002Findex.js`, `js\u002Fjuce\u002Findex.js`\n5. Verify CMakeLists.txt embeds files correctly\n\n**DO NOT PROCEED TO DSP IMPLEMENTATION UNTIL ALL 8 CHECKS PASS**\n\n---\n\n## 🔧 PHASE 4.1: DSP IMPLEMENTATION\n\nRead `plugins\u002F[Name]\u002F.ideas\u002Fplan.md` to determine implementation approach:\n```\nComplexity Score: [N]\n\nIf score ≤2: Single-pass implementation (all at once)\nIf score ≥3: Phased implementation (multiple passes)\n```\n\n**Single-pass** (Simple plugins):\n- One implementation session\n- All DSP components at once\n- Example: Simple gain, filter, compressor\n\n**Phased** (Complex plugins):\n- Multiple implementation phases\n- Break into logical chunks\n- Example: Multi-band processing, synthesis engines\n\n---\n\n## 🔧 PHASE 4.1: DSP IMPLEMENTATION\n\n**Prerequisites:** UI structure must be created (Phase 4.0) before DSP implementation begins.\n\n### FOR SINGLE-PASS (Complexity ≤2):\n\n**Step 1: Read contracts**\n- `.ideas\u002Fcreative-brief.md` - Plugin purpose and behavior\n- `.ideas\u002Farchitecture.md` - DSP components and math\n- `.ideas\u002Fparameter-spec.md` - Parameter bindings\n\n**Step 2: Update PluginProcessor.h**\n\nAdd DSP member variables:\n```cpp\nprivate:\n    \u002F\u002F DSP Components from .ideas\u002Farchitecture.md\n    juce::dsp::Gain inputGain;\n    juce::dsp::IIR::Filter filter;\n    juce::dsp::Compressor compressor;\n    \n    \u002F\u002F State\n    double currentSampleRate = 44100.0;\n```\n\n**Step 3: Implement prepareToPlay()**\n\nInitialize DSP at sample rate:\n```cpp\nvoid prepareToPlay(double sampleRate, int samplesPerBlock) override\n{\n    currentSampleRate = sampleRate;\n    \n    juce::dsp::ProcessSpec spec;\n    spec.sampleRate = sampleRate;\n    spec.maximumBlockSize = samplesPerBlock;\n    spec.numChannels = getTotalNumOutputChannels();\n    \n    inputGain.prepare(spec);\n    filter.prepare(spec);\n    compressor.prepare(spec);\n}\n```\n\n**Step 4: Implement processBlock()**\n\nAdd DSP processing:\n```cpp\nvoid processBlock(juce::AudioBuffer& buffer,\n                  juce::MidiBuffer& midiMessages) override\n{\n    juce::ScopedNoDenormals noDenormals;\n    \n    \u002F\u002F Get parameter values from APVTS\n    auto gainValue = apvts.getRawParameterValue(\"gain\")->load();\n    auto thresholdValue = apvts.getRawParameterValue(\"threshold\")->load();\n    \n    \u002F\u002F Update DSP components\n    inputGain.setGainDecibels(gainValue);\n    compressor.setThreshold(thresholdValue);\n    \n    \u002F\u002F Process audio\n    juce::dsp::AudioBlock block(buffer);\n    juce::dsp::ProcessContextReplacing context(block);\n    \n    inputGain.process(context);\n    filter.process(context);\n    compressor.process(context);\n}\n```\n\n**Step 5: Connect parameters to DSP**\n\nEnsure all parameters from `.ideas\u002Fparameter-spec.md` are:\n- Read from APVTS in processBlock using the unified parameter handling system\n- Applied to DSP components with proper validation and smoothing\n- Mapped correctly (linear, logarithmic, exponential as specified)\n- Consistent with parameter ranges defined in the specification\n\n**Consistency Verification:**\n```cpp\n\u002F\u002F Verify parameter consistency during development\n#ifdef DEBUG\nvoid verifyParameterConsistency()\n{\n    \u002F\u002F Check that parameter IDs match between spec and implementation\n    \u002F\u002F This helps catch typos and ensures all specified parameters are implemented\n    const auto& parameters = apvts.processor.getParameters();\n    for (int i = 0; i \u003C parameters.size(); ++i)\n    {\n        auto* param = dynamic_cast\u003Cjuce::AudioProcessorParameterWithID*>(parameters[i]);\n        if (param != nullptr)\n        {\n            \u002F\u002F Verify this parameter exists in parameter-spec.md\n            \u002F\u002F (Implementation would read and parse the spec file)\n        }\n    }\n}\n#endif\n```\n\n---\n\n### FOR PHASED (Complexity ≥3):\n\n**plan.md will define phases like:**\n```markdown\n### Phase 4.1.1: Core Processing\n- Input\u002Foutput gain\n- Basic filtering\n\n### Phase 4.1.2: Dynamics\n- Compressor\n- Limiter\n\n### Phase 4.1.3: Modulation\n- LFO\n- Envelope follower\n```\n\n**Execute each phase sequentially:**\n\n1. **Phase 4.1.1** - Implement core components\n   - Add member variables\n   - Update prepareToPlay()\n   - Add to processBlock()\n   - **Build and test**\n   - **Git commit**\n\n2. **Phase 4.1.2** - Add dynamics components\n   - Build on Phase 4.1.1 code (preserve everything)\n   - Add new components\n   - **Build and test**\n   - **Git commit**\n\n3. **Phase 4.1.3** - Add modulation\n   - Build on Phase 4.1.2 code\n   - Complete implementation\n   - **Build and test**\n   - **Git commit**\n\n**Decision menu after each phase:**\n```\n✓ Phase 4.1.1 complete\n\nProgress: 1 of 3 phases\n\nWhat's next?\n1. Continue to Phase 4.1.2 (recommended)\n2. Test current state in DAW\n3. Review Phase 4.1.1 code\n4. Pause here\n\nChoose (1-4): _\n```\n\n---\n\n## 🎯 CRITICAL IMPLEMENTATION RULES\n\n### Real-Time Safety:\n- **NO heap allocations in processBlock()** - Pre-allocate in prepareToPlay()\n- **NO locks in audio thread** - Use atomic values for parameter access\n- **NO file I\u002FO in processBlock()** - All resources loaded beforehand\n- Use `juce::ScopedNoDenormals` at start of processBlock()\n\n### 🔄 UNIFIED PARAMETER HANDLING SYSTEM\n\n#### Parameter Validation & Range Checking\n```cpp\n\u002F\u002F Helper function for parameter validation\nfloat validateParameter(float value, float minVal, float maxVal, const char* paramName)\n{\n    if (value \u003C minVal || value > maxVal)\n    {\n        \u002F\u002F Log warning but clamp to valid range\n        jassertfalse; \u002F\u002F Debug warning\n        return juce::jlimit(minVal, maxVal, value);\n    }\n    return value;\n}\n\n\u002F\u002F In processBlock() - with validation\nauto* gainParam = apvts.getRawParameterValue(\"gain\");\nfloat rawGainValue = gainParam->load();\nfloat validatedGain = validateParameter(rawGainValue, -60.0f, 24.0f, \"gain\");\ninputGain.setGainDecibels(validatedGain);\n```\n\n#### Parameter Smoothing (Anti-Zipper Noise)\n```cpp\n\u002F\u002F Member variables for smoothed parameters\njuce::SmoothedValue\u003Cfloat> smoothedGain;\njuce::SmoothedValue\u003Cfloat> smoothedCutoff;\njuce::SmoothedValue\u003Cfloat> smoothedResonance;\n\n\u002F\u002F In prepareToPlay()\nvoid prepareToPlay(double sampleRate, int samplesPerBlock) override\n{\n    \u002F\u002F Initialize smoothing with appropriate time constants\n    smoothedGain.reset(sampleRate, 0.020); \u002F\u002F 20ms for gain\n    smoothedCutoff.reset(sampleRate, 0.050); \u002F\u002F 50ms for filter\n    smoothedResonance.reset(sampleRate, 0.010); \u002F\u002F 10ms for resonance\n}\n\n\u002F\u002F In processBlock() - with smoothing\nauto* gainParam = apvts.getRawParameterValue(\"gain\");\nsmoothedGain.setTargetValue(gainParam->load());\n\nfor (int sample = 0; sample \u003C numSamples; ++sample)\n{\n    float currentGain = smoothedGain.getNextValue();\n    \u002F\u002F Apply to DSP with per-sample smoothing\n    inputGain.setGainDecibels(currentGain);\n}\n```\n\n#### Parameter Mapping Templates\n```cpp\n\u002F\u002F Template for different parameter types\nenum class ParameterType\n{\n    Linear,\n    Logarithmic,\n    Exponential,\n    Boolean\n};\n\n\u002F\u002F Parameter mapping helper\nfloat mapParameter(float normalizedValue, ParameterType type, float minVal, float maxVal)\n{\n    switch (type)\n    {\n        case ParameterType::Linear:\n            return juce::jmap(normalizedValue, 0.0f, 1.0f, minVal, maxVal);\n            \n        case ParameterType::Logarithmic:\n            return juce::jmap(juce::jlimit(0.0f, 1.0f, normalizedValue),\n                             0.0f, 1.0f, minVal, maxVal, true);\n            \n        case ParameterType::Exponential:\n            return minVal * std::pow(maxVal \u002F minVal, normalizedValue);\n            \n        case ParameterType::Boolean:\n            return normalizedValue > 0.5f ? maxVal : minVal;\n            \n        default:\n            return normalizedValue;\n    }\n}\n\n\u002F\u002F Usage example\nauto* cutoffParam = apvts.getRawParameterValue(\"cutoff\");\nfloat normalizedCutoff = cutoffParam->load();\nfloat mappedCutoff = mapParameter(normalizedCutoff,\n                                 ParameterType::Logarithmic,\n                                 20.0f, 20000.0f);\n*filter.coefficients = juce::dsp::IIR::Coefficients::makeLowPass(\n    sampleRate, mappedCutoff);\n```\n\n#### Consistency Verification\n```cpp\n\u002F\u002F Helper to verify parameter consistency between spec and implementation\nvoid verifyParameterConsistency()\n{\n    \u002F\u002F This should be called during development\u002Fdebug builds\n    #ifdef DEBUG\n    \u002F\u002F Check that all parameters in parameter-spec.md are implemented\n    \u002F\u002F This is a development-time check, not runtime\n    #endif\n}\n```\n\n### Parameter Binding:\n```cpp\n\u002F\u002F Standardized parameter binding pattern\nvoid processBlock(juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages) override\n{\n    juce::ScopedNoDenormals noDenormals;\n    \n    \u002F\u002F 1. Read all parameters with validation\n    auto* gainParam = apvts.getRawParameterValue(\"gain\");\n    auto* cutoffParam = apvts.getRawParameterValue(\"cutoff\");\n    auto* resonanceParam = apvts.getRawParameterValue(\"resonance\");\n    \n    \u002F\u002F 2. Update smoothed values\n    smoothedGain.setTargetValue(gainParam->load());\n    smoothedCutoff.setTargetValue(cutoffParam->load());\n    smoothedResonance.setTargetValue(resonanceParam->load());\n    \n    \u002F\u002F 3. Process audio with per-sample parameter updates\n    const int numSamples = buffer.getNumSamples();\n    \n    for (int sample = 0; sample \u003C numSamples; ++sample)\n    {\n        \u002F\u002F Get current smoothed values\n        float currentGain = smoothedGain.getNextValue();\n        float currentCutoff = smoothedCutoff.getNextValue();\n        float currentResonance = smoothedResonance.getNextValue();\n        \n        \u002F\u002F Apply to DSP components\n        inputGain.setGainDecibels(currentGain);\n        \n        \u002F\u002F Update filter with mapped values\n        float mappedCutoff = mapParameter(currentCutoff,\n                                         ParameterType::Logarithmic,\n                                         20.0f, 20000.0f);\n        float mappedResonance = mapParameter(currentResonance,\n                                           ParameterType::Linear,\n                                           0.1f, 10.0f);\n        \n        *filter.coefficients = juce::dsp::IIR::Coefficients::makeLowPass(\n            currentSampleRate, mappedCutoff, mappedResonance);\n        \n        \u002F\u002F Process this sample\n        juce::dsp::AudioBlock block(buffer.getArrayOfWritePointers(),\n                                   buffer.getNumChannels(), 1);\n        juce::dsp::ProcessContextReplacing context(block);\n        \n        inputGain.process(context);\n        filter.process(context);\n    }\n}\n```\n\n### Edge Cases:\n```cpp\n\u002F\u002F Handle zero-length buffers\nif (buffer.getNumSamples() == 0)\n    return;\n\n\u002F\u002F Handle silent input\nauto totalNumInputChannels = getTotalNumInputChannels();\nauto totalNumOutputChannels = getTotalNumOutputChannels();\n\nfor (auto i = totalNumInputChannels; i \u003C totalNumOutputChannels; ++i)\n    buffer.clear(i, 0, buffer.getNumSamples());\n```\n\n### Buffer Management:\n```cpp\n\u002F\u002F Pre-allocate buffers in prepareToPlay()\nvoid prepareToPlay(double sampleRate, int samplesPerBlock) override\n{\n    tempBuffer.setSize(2, samplesPerBlock);\n    \u002F\u002F Use tempBuffer in processBlock() - no allocation\n}\n```\n\n---\n\n## ✅ PHASE 4.2: BUILD & VERIFY\n\nAfter implementation complete:\n\n**Step 1: Validate JUCE\u002FCMake setup**\n```powershell\n# Import state management module\n. \"$PSScriptRoot\\..\\scripts\\state-management.ps1\"\n\n# Validate prerequisites using standardized function\nif (-not (Validate-PhasePrerequisites -PluginPath \"plugins\\[Name]\" -CurrentPhase \"code\" -RequiredPhase \"design_complete\" -RequiredFiles @(\".ideas\u002Farchitecture.md\", \".ideas\u002Fplan.md\"))) {\n    Write-Host \"ERROR: Prerequisites not met. Complete design phase first.\" -ForegroundColor Red\n    exit 1\n}\n\n# Check JUCE installation\nif (-not (Test-Path \"C:\\JUCE\")) {\n    Write-Host \"ERROR: JUCE not found at C:\\JUCE\" -ForegroundColor Red\n    Write-Host \"Please install JUCE 8 and set up the project correctly\" -ForegroundColor Yellow\n    exit 1\n}\n\n# Check CMake availability\nif (-not (Get-Command cmake -ErrorAction SilentlyContinue)) {\n    Write-Host \"ERROR: CMake not found\" -ForegroundColor Red\n    Write-Host \"Please install CMake and ensure it's in your PATH\" -ForegroundColor Yellow\n    exit 1\n}\n\n# Validate project structure\nif (-not (Test-Path \"CMakeLists.txt\")) {\n    Write-Host \"ERROR: CMakeLists.txt not found in project root\" -ForegroundColor Red\n    exit 1\n}\n\n# Validate canvas implementation for WebView framework\nif ($state.ui_framework -eq \"webview\") {\n    if (-not (Test-CanvasImplementation -PluginPath \"plugins\\[Name]\")) {\n        Write-Host \"ERROR: Canvas implementation required for WebView framework\" -ForegroundColor Red\n        Write-Host \"WebView plugins must use HTML5 Canvas API with JUCE frontend library\" -ForegroundColor Yellow\n        Write-Host \"Please ensure Design\u002Findex.html uses canvas-based rendering\" -ForegroundColor Yellow\n        exit 1\n    }\n}\n```\n\n**Step 2: Build plugin**\n```powershell\n# Build plugin with validation\ntry {\n    powershell -ExecutionPolicy Bypass -File .\\scripts\\build-and-install.ps1 -PluginName [Name]\n    Write-Host \"Build completed successfully\" -ForegroundColor Green\n} catch {\n    Write-Host \"Build failed: $($_.Exception.Message)\" -ForegroundColor Red\n    Write-Host \"Please check the build script and JUCE configuration\" -ForegroundColor Yellow\n    exit 1\n}\n```\n\n**If build fails:**\n1. Read error messages carefully\n2. Verify JUCE modules are properly included\n3. Ensure CMakeLists.txt is correctly configured\n4. Fix issues and rebuild\n\n**If build succeeds:**\n- Plugin compiles with DSP processing\n- Parameters control audio engine\n- JUCE\u002FCMake integration validated\n- Ready for testing\n\n---\n\n## 🧪 PHASE 4.3: AUTOMATED TESTING\n\nRun 5 automated tests:\n\n1. **Build test** - Compiles successfully (already passed)\n2. **Load test** - Plugin loads in DAW without crash\n3. **Process test** - Audio processing works\n4. **Parameter test** - Parameters affect audio output\n5. **State test** - Save\u002Fload preserves settings\n\n**If tests fail:** Cannot proceed to SHIP phase until audio engine is stable.\n\n---\n\n## 🎨 PHASE 4.4: GUI DECISION GATE\n\n**CRITICAL CHOICE:** Custom UI or headless?\n```\n✓ Audio Engine Working\n\nDSP components: [N]\nParameters: [N]\nTests: All passed\n\nWhat type of interface?\n\n1. Add custom UI - WebView interface with mockup\n2. Ship headless - DAW controls only (fast path)\n3. Test in DAW first\n\nChoose (1-3): _\n```\n\n### Option 1: Custom UI Path\n- Check for existing mockup in `.ideas\u002Fmockups\u002F`\n- If none: Invoke ui-mockup skill\n- If exists: Proceed to SHIP phase (Phase 5)\n\n### Option 2: Headless Path\n- Generate minimal PluginEditor (simple window)\n- DAW provides parameter controls automatically\n- Fast path to v1.0.0\n- Can add custom UI later via `\u002Fimprove [Name]`\n\n### Option 3: Test First\n- Load plugin in DAW\n- Verify DSP behavior\n- Return to decision menu\n\n---\n\n## 📦 PHASE 4.5: STATE MANAGEMENT\n\nEnsure plugin state saves\u002Floads correctly:\n```cpp\n\u002F\u002F getStateInformation()\nvoid getStateInformation(juce::MemoryBlock& destData) override\n{\n    auto state = apvts.copyState();\n    std::unique_ptr xml(state.createXml());\n    copyXmlToBinary(*xml, destData);\n}\n\n\u002F\u002F setStateInformation()\nvoid setStateInformation(const void* data, int sizeInBytes) override\n{\n    std::unique_ptr xmlState(getXmlFromBinary(data, sizeInBytes));\n    \n    if (xmlState.get() != nullptr)\n        if (xmlState->hasTagName(apvts.state.getType()))\n            apvts.replaceState(juce::ValueTree::fromXml(*xmlState));\n}\n```\n\n**Critical:** State must preserve all parameter values between sessions.\n\n---\n\n## 🔄 VERSIONING & COMMITS\n\n**Git commit after each phase:**\n```powershell\n# Backup state before commit\nBackup-PluginState -PluginPath \"plugins\\[Name]\"\n\ngit add plugins\u002F[Name]\u002FSource\u002F\ngit add plugins\u002F[Name]\u002F.ideas\u002Fplan.md\ngit commit -m \"feat([Name]): Phase 4.1 DSP - [Phase description]\n\nImplemented: [list components]\nParameters connected: [N]\nReal-time safe: Yes\n\nGenerated with Kilo Code\"\n```\n\n**For single-pass:**\n```powershell\n# Backup state before final commit\nBackup-PluginState -PluginPath \"plugins\\[Name]\"\n\ngit commit -m \"feat([Name]): Phase 4 CODE complete\n\nAll DSP components implemented\n[N] parameters connected\nReal-time safe audio processing\n\nGenerated with Kilo Code\"\n```\n\n**Update state after implementation:**\n```powershell\n# Mark implementation complete using standardized function\nComplete-Phase -PluginPath \"plugins\\[Name]\" -Phase \"code\" -Updates @{\n  \"validation.code_complete\" = $true\n  \"validation.tests_passed\" = $false  # Will be set after testing\n}\n```\n\n---\n\n## 🎵 COMMON DSP PATTERNS\n\n### Gain\u002FVolume Control:\n```cpp\njuce::dsp::Gain gain;\ngain.setGainDecibels(dbValue);\ngain.process(context);\n```\n\n### Filtering:\n```cpp\njuce::dsp::IIR::Filter filter;\n*filter.coefficients = juce::dsp::IIR::Coefficients::makeLowPass(\n    sampleRate, cutoffFreq, resonance);\nfilter.process(context);\n```\n\n### Compression:\n```cpp\njuce::dsp::Compressor compressor;\ncompressor.setThreshold(thresholdDb);\ncompressor.setRatio(ratio);\ncompressor.setAttack(attackMs);\ncompressor.setRelease(releaseMs);\ncompressor.process(context);\n```\n\n### Smoothing (Anti-Zipper):\n```cpp\njuce::SmoothedValue smoothedGain;\nsmoothedGain.reset(sampleRate, 0.05); \u002F\u002F 50ms ramp\n\n\u002F\u002F In processBlock\nsmoothedGain.setTargetValue(newGainValue);\nfor (int sample = 0; sample \u003C numSamples; ++sample)\n{\n    float currentGain = smoothedGain.getNextValue();\n    \u002F\u002F Apply currentGain to audio\n}\n```\n\n---\n\n## 📚 INTEGRATION\n\n**Invoked by:**\n- Natural language: \"Implement DSP for [Name]\"\n- After Phase 3 (DESIGN) complete\n- Part of plugin-workflow automation\n\n**Updates:**\n- `Source\u002FPluginProcessor.h` - DSP member variables\n- `Source\u002FPluginProcessor.cpp` - Audio processing logic\n- `PLUGINS.md` - Phase status\n- `plugins\u002F[Name]\u002Fstatus.json` - Project state\n\n**Next phase:**\n- Phase 5: SHIP (if headless chosen or custom UI complete)\n\n---\n\n## ⚠️ CRITICAL REMINDERS\n\n1. **Real-time safety** - No allocations in audio thread\n2. **Parameter zero-drift** - Use exact IDs from parameter-spec.md\n3. **Use unified parameter system** - Always validate, smooth, and map parameters\n4. **Test after each phase** - Verify before continuing\n5. **Commit frequently** - Preserve progress\n6. **Edge cases** - Handle silent input, zero buffers\n7. **Build from root** - Not from plugin directory\n8. **Consistency check** - Verify all spec parameters are implemented\n\n---\n\n## 🐛 TROUBLESHOOTING\n\n**Build errors:**\n- Verify JUCE module includes\n- Check parameter ID typos\n\n**No audio output:**\n- Verify processBlock() called\n- Check channel routing\n- Verify DSP components initialized in prepareToPlay()\n\n**Crackling\u002Fartifacts:**\n- Add parameter smoothing\n- Check buffer size handling\n- Verify real-time safety (no allocations)\n\n**Parameters don't respond:**\n- Verify APVTS getRawParameterValue() calls\n- Check parameter ID strings match spec\n- Verify parameter ranges correct\n",{},"main","12b9e0c7363e91ca0140b9c7f1c6c37c10d2eafb",".claude\u002Fskills\u002Fimpl","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper","2026-07-01 07:58:33",{"source":7,"skillName":5,"commands":29,"prompt":39,"zipAvailable":40},[30,33,36],{"tool":31,"command":32},"npx","npx skills add johnson-cooper\u002Fsolara --skill impl",{"tool":34,"command":35},"bunx","bunx skills add johnson-cooper\u002Fsolara --skill impl",{"tool":37,"command":38},"pnpm","pnpm dlx skills add johnson-cooper\u002Fsolara --skill impl","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimpl\u002FSKILL.md",true,[],[43,49,55,61,67,73],{"skillNo":44,"name":45,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":46,"categories":47,"keywords":48,"publishedAt":18},"01M77WA1DG7127E93ZCEJN9920","skill_troubleshooting","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.kilocode\u002Fskills\u002Fskill_troubleshooting\u002FSKILL.md",[],[],{"skillNo":50,"name":51,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":18},"01M77WA08NK9TBCTFKVHBD5Z2Q","skill_testing","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.kilocode\u002Fskills\u002Fskill_testing\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M77W9Y67EC89BY21MYH3ZE34","skill_planning","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.kilocode\u002Fskills\u002Fskill_planning\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M77W9TKWJN8QQWHJNNJM27NH","skill_packaging","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.kilocode\u002Fskills\u002Fskill_packaging\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M77W9NG6DFVNY6PMPM09VHEE","skill_implementation","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.kilocode\u002Fskills\u002Fskill_implementation\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M77W9KCB9VRE83Q6PHK6RDMK","skill_ideation","https:\u002F\u002Fgithub.com\u002Fjohnson-cooper\u002Fsolara\u002Fblob\u002Fmain\u002F.kilocode\u002Fskills\u002Fskill_ideation\u002FSKILL.md",[],[]]