Repository navigation
0.27.0
Pre-releaseMigration guide (0.26.0 → 0.27.0)
This release has two breaking changes. As with every 0.x release, it is a pre-release.
1. Minimum Zig version is now 0.17.1
minimum_zig_version is 0.17.1, and lightmix now depends on zigggwavvv 3.0.0. Zig 0.16.x can no longer build lightmix.
After updating your toolchain, update the dependency:
zig fetch --save https://github.com/haruki7049/lightmix/archive/refs/tags/0.27.0.tar.gzoptimize option of addWave / addPlay
The type of optimize changed from std.builtin.OptimizeMode to std.lang.Optimize, and the tag names changed with it:
| 0.26.0 | 0.27.0 |
|---|---|
.Debug |
.debug |
.ReleaseSafe |
.safe |
.ReleaseFast |
.fast |
.ReleaseSmall |
.small |
The defaults are unchanged in meaning (CreateWaveOptions.optimize = .fast, PlayOptions.optimize = .debug). If you pass the result of b.standardOptimizeOption(.{}), no change is needed. Only a literal tag in your build.zig must be renamed.
2. Composer(T) is removed
lightmix.Composer, including Composer(T).finalize and Composer(T).render_stream, is removed without a deprecation period. Wave(T) is unchanged.
You have two options:
- Stay on 0.26.0 if you still need
Composer. - Arrange the waves yourself.
Composer.finalizeallocated a zero-filled buffer that ends where the latest wave ends, then mixed each wave in at itsstart_point. The same can be done with the public API ofWave(T):
const std = @import("std");
const lightmix = @import("lightmix");
const Wave = lightmix.Wave;
const Placed = struct { wave: Wave(f64), start_point: usize };
/// Caller owns the returned wave and must call `deinit()` on it.
/// `placed` must not be empty, and every wave must share the same sample rate and channel count.
fn arrange(allocator: std.mem.Allocator, placed: []const Placed) !Wave(f64) {
var end: usize = 0;
for (placed) |p| end = @max(end, p.start_point + p.wave.samples.len);
const samples = try allocator.alloc(f64, end);
errdefer allocator.free(samples);
@memset(samples, 0.0);
for (placed) |p| {
for (p.wave.samples, 0..) |s, i| {
samples[p.start_point + i] = Wave(f64).default_mixing_expression(samples[p.start_point + i], s);
}
}
return .{
.samples = samples,
.allocator = allocator,
.sample_rate = placed[0].wave.sample_rate,
.channels = placed[0].wave.channels,
};
}start_pointcounts interleaved samples, not frames. For a multi-channel wave it must be a multiple of the channel count (for stereo, framenisstart_point = 2 * n).- Use
Wave(f64).saturating_mixing_expressioninstead ofdefault_mixing_expressionto clamp the result to[-1.0, 1.0]. - Replace
f64with the sample type you use. - For two waves with identical length, sample rate and channel count,
Wave(T).mixis still available.
The examples/ directories were renumbered: 04-composer was removed, 05-practical-examples became 04-practical-examples, and 06-advanced became 05-advanced. Update any links to these paths.
What's Changed
- docs: fix the findings of a fresh-eyes documentation audit by @haruki7049 in #401
- docs: fix inaccurate error docs and add dependency setup to the README by @haruki7049 in #404
- docs: describe the public API in the module docs by @haruki7049 in #405
- test(play): run playback tests on CI with virtual audio devices by @haruki7049 in #407
- docs: add push, issue-number and session-link rules for agents by @haruki7049 in #409
- ci(dependabot): Create .github/dependabot.yml by @haruki7049 in #414
- ci(dependabot): Create dependabot-auto-merge.yml workflow by @haruki7049 in #423
- chore: bump actions/stale from 9.0.0 to 11.0.0 by @dependabot[bot] in #418
- chore: bump ytanikin/pr-conventional-commits from 1.4.0 to 1.5.2 by @dependabot[bot] in #415
- chore: bump actions/configure-pages from 5.0.0 to 6.0.0 by @dependabot[bot] in #416
- chore: bump cachix/install-nix-action from 31.6.0 to 31.11.3 by @dependabot[bot] in #417
- chore: bump actions/deploy-pages from 4.0.5 to 5.0.1 by @dependabot[bot] in #419
- chore: bump flake-parts from
31729catoea2630bby @dependabot[bot] in #422 - chore: bump treefmt-nix from
27b3b12to0d6d739by @dependabot[bot] in #421 - chore: bump nixpkgs from
c7def04to6dadaf4by @dependabot[bot] in #420 - ci(GitHub Actions): Create actions.lock via
gh actions-lockby @haruki7049 in #424 - refactor(build.zig): narrow return error sets of addWave and addPlay by @haruki7049 in #425
- chore: bump nixpkgs from
6dadaf4to2074cc6by @dependabot[bot] in #428 - chore: bump actions/upload-pages-artifact from 4.0.0 to 5.0.0 by @dependabot[bot] in #427
- chore: bump cachix/install-nix-action from 31.11.3 to 31.11.5 by @dependabot[bot] in #426
- feat!: migrate to Zig 0.17.1 and zigggwavvv 3.0.0 by @haruki7049 in #429
- refactor(composer)!: remove Composer by @haruki7049 in #431
- docs: register only issues to the GitHub Project by @haruki7049 in #433
- build(nix): pin ZLS to 0.17 and share the Zig package with treefmt by @haruki7049 in #435
- feat(lightmix version): Bump up to 0.27.0 by @haruki7049 in #434
New Contributors
- @dependabot[bot] made their first contribution in #418
Full Changelog: 0.26.0...0.27.0