Skip to content

Commit e894456

Browse files
committed
[update] specification.
1 parent 65cbbee commit e894456

1 file changed

Lines changed: 20 additions & 53 deletions

File tree

docs/specs/audio-devices.md

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ document_id: "audio-device-abstraction-2026-01-28"
44
status: "draft"
55
created: "2026-01-28T22:59:00Z"
66
version: "0.1.7"
7-
last_updated: "2026-01-29T04:49:53Z"
7+
version: "0.1.8"
8+
last_updated: "2026-01-29T20:40:49Z"
89
engine_workspace_version: "2023.1.30"
910
wgpu_version: "26.0.1"
1011
shader_backend_default: "naga"
@@ -589,14 +590,24 @@ Feature gating requirements
589590
- [ ] Unsupported configurations reported via `AudioError::UnsupportedConfig`
590591
- Documentation and Examples
591592
- [ ] `docs/features.md` updated with audio feature documentation
592-
- [ ] Example added demonstrating audible playback (behind `audio-device`)
593-
- [ ] `lambda-rs` audio facade and examples implemented
593+
- [ ] Example added demonstrating audible playback (behind `audio-output-device`)
594+
- [ ] `lambda-rs` audio facade implemented
594595

595596
For each checked item, include a reference to a commit, pull request, or file
596597
path that demonstrates the implementation.
597598

598599
## Verification and Testing
599600

601+
Example (lambda-rs facade)
602+
603+
This example is the primary application-facing reference.
604+
605+
- Add `crates/lambda-rs/examples/audio_sine_wave.rs` (feature:
606+
`audio-output-device`) that:
607+
- Prints `lambda_rs::audio::enumerate_output_devices()` output.
608+
- Builds the default output device via the facade builder and plays a
609+
deterministic 440 Hz tone for at least 2 seconds.
610+
600611
Unit tests (crate: `lambda-rs-platform`)
601612

602613
- Builder defaults
@@ -608,67 +619,23 @@ Unit tests (crate: `lambda-rs-platform`)
608619

609620
Commands
610621

622+
- `cargo test -p lambda-rs --features audio-output-device -- --nocapture`
611623
- `cargo test -p lambda-rs-platform --features audio-device -- --nocapture`
612624

613625
Manual checks
614626

615-
- Run a minimal smoke executable (example or integration runnable) that:
616-
- Prints `enumerate_devices` output.
617-
- Calls `AudioDeviceBuilder::new().build_with_output_callback(...)` and
618-
plays a deterministic test tone for at least 2 seconds.
619-
620-
Example (platform layer)
621-
622-
This example is workspace-internal and exists to validate the platform layer in
623-
isolation. Applications MUST use the `lambda-rs` facade instead.
624-
625-
- Add `crates/lambda-rs-platform/examples/audio_sine_wave.rs` (feature:
626-
`audio-device`) that:
627-
- Prints `enumerate_devices()` output.
628-
- Builds the default output device with a 440 Hz sine wave generator via
629-
`build_with_output_callback`.
630-
- Plays for 2 seconds and exits.
631-
632-
Example sketch
633-
634-
```rust
635-
let mut phase: f32 = 0.0;
636-
let frequency_hz: f32 = 440.0;
637-
638-
let _device = AudioDeviceBuilder::new()
639-
.with_sample_rate(48_000)
640-
.with_channels(2)
641-
.build_with_output_callback(move |writer, info| {
642-
let channels = info.channels as usize;
643-
let frames = writer.frames();
644-
let phase_step = 2.0 * std::f32::consts::PI * frequency_hz
645-
/ info.sample_rate as f32;
646-
647-
for frame_index in 0..frames {
648-
let sample = phase.sin() * 0.10;
649-
phase += phase_step;
650-
651-
for channel_index in 0..channels {
652-
writer.set_sample(frame_index, channel_index, sample);
653-
}
654-
}
655-
})?;
656-
```
657-
658-
Example (lambda-rs facade)
659-
660-
- Add `crates/lambda-rs/examples/audio_sine_wave.rs` (feature:
661-
`audio-output-device`) that:
662-
- Prints `lambda_rs::audio::enumerate_output_devices()` output.
663-
- Builds the default output device via the facade builder and plays the same
664-
deterministic tone.
627+
- Run the `lambda-rs` facade example and confirm audible playback for at least
628+
2 seconds.
629+
- `cargo run -p lambda-rs --example audio_sine_wave --features audio-output-device`
665630

666631
## Compatibility and Migration
667632

668633
- None. No existing audio APIs exist in the workspace.
669634

670635
## Changelog
671636

637+
- 2026-01-29 (v0.1.8) — Make the `lambda-rs` facade example the primary
638+
reference and remove the platform example requirement.
672639
- 2026-01-29 (v0.1.7) — Rename the platform audio implementation module to
673640
`lambda-rs-platform::cpal` to reflect the internal backend.
674641
- 2026-01-29 (v0.1.6) — Specify `lambda-rs` as the only supported

0 commit comments

Comments
 (0)