Skip to content

Commit 9031bcf

Browse files
authored
feat(lambda-rs): Implement a SoundBuffer with support for decoding wav and ogg files
2 parents 57d1fec + 74ec0a7 commit 9031bcf

36 files changed

+3765
-97
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
*.png filter=lfs diff=lfs merge=lfs -text
2+
*.wav filter=lfs diff=lfs merge=lfs -text
3+
*.ogg filter=lfs diff=lfs merge=lfs -text
4+
*.oga filter=lfs diff=lfs merge=lfs -text

.github/workflows/compile_lambda_rs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
steps:
4343
- name: Checkout Repository
4444
uses: actions/checkout@v4
45+
with:
46+
lfs: true
4547

4648
- name: Cache cargo builds
4749
uses: Swatinem/rust-cache@v2
@@ -87,14 +89,30 @@ jobs:
8789
cargo +nightly-2025-09-26 fmt --all --check
8890
8991
- name: Build workspace
92+
if: ${{ contains(matrix.features, 'lambda-rs/audio-output-device') }}
9093
run: cargo build --workspace --features ${{ matrix.features }}
9194

95+
- name: Build workspace (exclude audio tools)
96+
if: ${{ !contains(matrix.features, 'lambda-rs/audio-output-device') }}
97+
run: |
98+
cargo build --workspace \
99+
--exclude lambda-audio-tool \
100+
--features ${{ matrix.features }}
101+
92102
- name: Build examples (lambda-rs)
93103
run: cargo build -p lambda-rs --examples --features ${{ matrix.features }}
94104

95105
- name: Test workspace
106+
if: ${{ contains(matrix.features, 'lambda-rs/audio-output-device') }}
96107
run: cargo test --workspace --features ${{ matrix.features }}
97108

109+
- name: Test workspace (exclude audio tools)
110+
if: ${{ !contains(matrix.features, 'lambda-rs/audio-output-device') }}
111+
run: |
112+
cargo test --workspace \
113+
--exclude lambda-audio-tool \
114+
--features ${{ matrix.features }}
115+
98116
- uses: actions/setup-ruby@v1
99117
- name: Send Webhook Notification for build status.
100118
if: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
with:
3131
# Fetch enough history for diff against base branch
3232
fetch-depth: 0
33+
lfs: true
3334

3435
- name: Cache cargo builds
3536
uses: Swatinem/rust-cache@v2

.github/workflows/lambda-repo-security.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ jobs:
4141
- name: Install dependencies for converting clippy output to SARIF
4242
run: cargo install clippy-sarif sarif-fmt
4343

44+
- name: Install Linux deps for audio
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install -y libasound2-dev
48+
4449
- name: Check formatting
4550
run: |
4651
rustup component add rustfmt --toolchain nightly-2025-09-26

.github/workflows/release.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,22 @@ jobs:
6060
run: cargo fmt --all -- --check
6161

6262
- name: Clippy
63-
run: cargo clippy --workspace --all-targets -- -D warnings
63+
run: |
64+
cargo clippy --workspace \
65+
# Excluded in the release workflow to avoid pulling in Linux ALSA
66+
# build dependencies (`alsa-sys`) that are unnecessary for release
67+
# binaries. Audio/tool validation runs in the CI build matrix when
68+
# audio features are enabled.
69+
--exclude lambda-audio-tool \
70+
--all-targets \
71+
-- -D warnings
6472
6573
- name: Tests
66-
run: cargo test --workspace -- --nocapture
74+
run: |
75+
cargo test --workspace \
76+
# See note above in the Clippy step.
77+
--exclude lambda-audio-tool \
78+
-- --nocapture
6779
6880
prepare_version:
6981
name: Prepare version, tag, push
@@ -221,7 +233,10 @@ jobs:
221233
shell: bash
222234
run: |
223235
set -euo pipefail
224-
cargo build --workspace --release --bins
236+
# See note in the validate job: `lambda-audio-tool` is excluded here
237+
# to avoid Linux ALSA build dependencies that are unnecessary for
238+
# release artifacts.
239+
cargo build --workspace --exclude lambda-audio-tool --release --bins
225240
226241
- name: Stage files
227242
id: stage

Cargo.lock

Lines changed: 118 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ members = [
88
"crates/lambda-rs-logging",
99
"crates/lambda-rs-platform",
1010
"tools/obj_loader",
11+
"tools/lambda_audio",
1112
]
1213

1314
default-members = [

crates/lambda-rs-platform/Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ wgpu = { version = "=28.0.0", optional = true, features = ["wgsl", "spirv"] }
2323
pollster = { version = "=0.4.0", optional = true }
2424
lambda-rs-logging = { path = "../lambda-rs-logging", version = "2023.1.30" }
2525
cpal = { version = "=0.17.1", optional = true }
26+
symphonia = { version = "=0.5.5", optional = true, default-features = false, features = [
27+
"ogg",
28+
"vorbis",
29+
"wav",
30+
"pcm",
31+
] }
2632

2733
# Force windows crate to 0.62 to unify wgpu-hal and gpu-allocator dependencies.
2834
# Both crates support this version range, but Cargo may resolve to different
@@ -53,7 +59,9 @@ wgpu-with-gl = ["wgpu", "wgpu/webgl"]
5359
# ---------------------------------- AUDIO ------------------------------------
5460

5561
# Umbrella features (disabled by default)
56-
audio = ["audio-device"]
62+
audio = ["audio-device", "audio-decode-wav", "audio-decode-vorbis"]
5763

5864
# Granular feature flags (disabled by default)
5965
audio-device = ["dep:cpal"]
66+
audio-decode-wav = ["dep:symphonia"]
67+
audio-decode-vorbis = ["dep:symphonia"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:fb635f26da26ae2dadd8560ed3e0451381b90e7b5abfbe3303ec33f27f340e43
3+
size 14370
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7241cee48cae37e67abcac3aa06fbf1c478828c896fc92d594605d9e44721476
3+
size 35336

0 commit comments

Comments
 (0)