Skip to content

feat!: add builders, parameter events and Wasm helpers - #72

Closed
google-labs-stitch[bot] wants to merge 3 commits into
mainfrom
stitch/add-builders-param-events-wasm-helpers-jm0-4b02594b-646f-4bcc-a8c2-edff175223a0
Closed

google-labs-stitch[bot] wants to merge 3 commits into
mainfrom
stitch/add-builders-param-events-wasm-helpers-jm0-4b02594b-646f-4bcc-a8c2-edff175223a0

Conversation

@google-labs-stitch

Copy link
Copy Markdown
Contributor

Summary

This change adds fluent builders, stage presets, partial WebAssembly configuration updates, granular parameter events, JSON-safe numeric types, and scale and MIDI helpers across Rust, WebAssembly, and TypeScript.

Changes

  • Configuration builders, presets, and Processor::update_config:
    • Add const fn with_* builders and stage presets to all 11 #[non_exhaustive] configuration structures (PrepareConfig, ProcessorConfig, CorrectionConfig, ResynthesisConfig, HarmonyConfig, PitchConfig, FormantConfig, PunchConfig, WarmConfig, AlienConfig, and ReverbConfig).
    • Add Processor::update_config in src/processor.rs to edit a stack copy of ProcessorConfig and validate the result before state or drain changes.
  • WebAssembly partial configurations and JSON-safe numbers:
    • Add #[serde(default)] to all 10 WebAssembly *Config structures and export DeepPartial<T> from src/wasm.rs and src/index.ts.
    • Accept DeepPartial<ProcessorConfig> in new Tunelet (WasmProcessor::new) and Tunelet.updateConfig (WasmProcessor::update_config).
    • Narrow ResynthesisConfig::random_seed from u64 to u32, serialize Feedback::processed_frames and Telemetry::processed_frames as JavaScript number values, and remove tsify(large_number_types_as_bigints).
  • Sub-stage and leaf parameter events:
    • Add Pitch, Correction, Formant, Harmony, and Parameter(ParameterControl) variants to ControlEvent in src/events.rs, and re-export ParameterControl from src/lib.rs.
    • Validate sequential configuration edits on a stack copy of ProcessorConfig in ValidatedEvents::new before frame 0, and apply them in Processor::apply without sibling overwrites.
  • Unified scales, Wasm helpers, and documentation:
    • Expand CorrectionScale with all seven modes from HarmonyScale, implement From<HarmonyScale> for CorrectionScale, and add HarmonyScale::note_mask from SCALE_TONES.
    • Export noteMaskFromKeyScale and parseMidiBytes from src/wasm.rs and src/index.ts.
    • Update src/lib.rs, src/index.ts, and README.md.

Generated crate documentation

Generated rustdoc overview

Verification

  • Passed cargo fmt --check, cargo build --locked --release, cargo clippy --locked --lib -- -D warnings, cargo clippy --locked --lib --target wasm32-unknown-unknown --features wasm -- -D warnings, RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps, and npm run build.
  • Verified external Rust construction and modification of all 11 *Config types without E0639, Processor::update_config rollback on invalid edits, independent ControlEvent::Parameter edits in one block with atomic preflight rejection, and HarmonyScale::HarmonicMinor snapping to B (71.0) in C.
  • Verified TypeScript and WebAssembly DeepPartial<ProcessorConfig> updates in new Tunelet and updateConfig, JSON.stringify compatibility on defaultConfig(), config(), feedback(), and telemetry(), noteMaskFromKeyScale("c", "harmonicMinor"), parseMidiBytes, and identical SHA-256 fixed-point PCM output against baseline renders.

Automated PR initiated by user @byteland-app via Stitch Loop.

- Add with_* builders and presets to all configuration types.
- Add Processor::update_config for validated configuration edits.
- Narrow ResynthesisConfig::random_seed from u64 to u32.
- Serialize processedFrames as a number in Wasm snapshots.
- Add sub-stage controls and ParameterControl to ControlEvent.
- Validate timed configuration edits sequentially on the stack.
- Unify CorrectionScale and NoteMask with all HarmonyScale modes.
- Accept DeepPartial<ProcessorConfig> in Tunelet and updateConfig.
- Export noteMaskFromKeyScale and parseMidiBytes from Wasm.
- Update the crate documentation, TypeScript exports and README.
- Pass frames and config to ValidatedEvents::new in Processor::validate
- Remove the obsolete check_frames helper from WasmProcessor
- Update the harmony_gain rustdoc on builders and parameter events
@byteland-app

Copy link
Copy Markdown
Contributor

Closing as superseded by #122 and #61. In addition to breaking bigint/u64 fields and weakening setConfig() validation, updateConfig() serializes the entire ProcessorConfig to JS, mutates it via Object.entries, and deserializes it back, which is slower than calling config() + setConfig(). This PR also has no CI checks.

@byteland-app
byteland-app deleted the stitch/add-builders-param-events-wasm-helpers-jm0-4b02594b-646f-4bcc-a8c2-edff175223a0 branch November 25, 2026 08:05
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Acknowledged: this pull request stays closed because #122 and #61 supersede it. #122 adds typed *ConfigPatch structures and patchConfig in Rust without full JavaScript serialization or Object.entries merges. #122 also keeps the u64 and bigint fields unchanged and keeps strict setConfig() validation. #61 adds scalar ParameterControl events with direct stage setters, and both open pull requests run the CI workflow. We made no further changes on this branch.

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