refactor: code quality improvements#15
Merged
Merged
Conversation
- Replace assert_eq! in audio callback with graceful error handling to prevent DAW crashes on channel mismatch (outputs silence instead) - Add 21 unit tests to voidmic_core (previously 0): NoiseFloorTracker (5), ThreeBandEq (3), LookaheadLimiter (4), VoidProcessor (6), FrameAdapter (3) - Extract FrameAdapter to voidmic_core to deduplicate ring buffer interleave/process/deinterleave pattern shared by plugin and LV2 - Split gui.rs (1424 lines) into 8 focused modules: app.rs, engine.rs, tray.rs, devices.rs, controls.rs, advanced.rs, wizard.rs, mod.rs - Fix pre-existing clippy warnings (too_many_arguments, collapsible_else_if)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four code quality improvements for the v1.0 roadmap:
1. Graceful Error Handling in Audio Callback
assert_eq!inprocess_frame()with a guard clause that outputs silence on channel mismatch2. Core Unit Tests (21 new tests)
3. Ring Buffer Adapter Extraction
FrameAdapterstruct invoidmic_coreencapsulates the interleave, ring buffer, process, deinterleave patternplugin/lib.rsandlv2/lib.rsto use it (around 80 lines of duplicated code removed)ringbufdependency from plugin and LV2 crates4. GUI Module Split
gui.rs(1,424 lines) into 8 focused modules undergui/:mod.rs— module declarationsapp.rs— VoidMicApp struct, constructor, eframe::App implengine.rs— start/stop/toggle enginetray.rs— tray icon constants and loadingdevices.rs— device selectors, get_devices, virtual cable installercontrols.rs— presets, threshold/suppression slidersadvanced.rs— EQ, VAD, AGC, bypass, spectrum, jitterwizard.rs— first-run wizard (5 steps)Also fixes
Verification
cargo build --workspace— cleancargo clippy --workspace -- -D warnings— 0 warningscargo test --workspace— 37 tests pass (16 app + 21 core)Stats
19 files changed, 1978 insertions, 1559 deletions