Audio: make deinit explicit

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-28 10:34:20 -07:00 committed by Stephen Gutekanst
parent 4a000c7995
commit 3504dfcab6
2 changed files with 7 additions and 1 deletions

View file

@ -25,6 +25,7 @@ pub const Mod = mach.Mod(@This());
pub const global_events = .{
.init = .{ .handler = init },
.deinit = .{ .handler = deinit },
.tick = .{ .handler = tick },
.audio_state_change = .{ .handler = audioStateChange },
};
@ -54,6 +55,11 @@ fn init(audio: *mach.Audio.Mod, piano: *Mod) void {
std.debug.print("[arrow down] decrease volume 10%\n", .{});
}
fn deinit(audio: *mach.Audio.Mod) void {
// Initialize audio module
audio.send(.deinit, .{});
}
fn audioStateChange(
audio: *mach.Audio.Mod,
which: mach.EntityID,