Audio: make deinit explicit
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
4a000c7995
commit
3504dfcab6
2 changed files with 7 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ pub const Mod = mach.Mod(@This());
|
||||||
|
|
||||||
pub const global_events = .{
|
pub const global_events = .{
|
||||||
.init = .{ .handler = init },
|
.init = .{ .handler = init },
|
||||||
|
.deinit = .{ .handler = deinit },
|
||||||
.tick = .{ .handler = tick },
|
.tick = .{ .handler = tick },
|
||||||
.audio_state_change = .{ .handler = audioStateChange },
|
.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", .{});
|
std.debug.print("[arrow down] decrease volume 10%\n", .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn deinit(audio: *mach.Audio.Mod) void {
|
||||||
|
// Initialize audio module
|
||||||
|
audio.send(.deinit, .{});
|
||||||
|
}
|
||||||
|
|
||||||
fn audioStateChange(
|
fn audioStateChange(
|
||||||
audio: *mach.Audio.Mod,
|
audio: *mach.Audio.Mod,
|
||||||
which: mach.EntityID,
|
which: mach.EntityID,
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@ pub const components = .{
|
||||||
|
|
||||||
pub const local_events = .{
|
pub const local_events = .{
|
||||||
.init = .{ .handler = init },
|
.init = .{ .handler = init },
|
||||||
|
.deinit = .{ .handler = deinit },
|
||||||
.audio_tick = .{ .handler = audioTick },
|
.audio_tick = .{ .handler = audioTick },
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const global_events = .{
|
pub const global_events = .{
|
||||||
.deinit = .{ .handler = deinit },
|
|
||||||
.audio_state_change = .{ .handler = fn (mach.EntityID) void },
|
.audio_state_change = .{ .handler = fn (mach.EntityID) void },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue