examples: improve play-opus code quality a bit
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
6e4105d8e2
commit
3c778816d9
1 changed files with 5 additions and 6 deletions
|
|
@ -41,13 +41,12 @@ fn init(
|
||||||
app.schedule(.after_init);
|
app.schedule(.after_init);
|
||||||
|
|
||||||
const bgm_fbs = std.io.fixedBufferStream(assets.bgm.bit_bit_loop);
|
const bgm_fbs = std.io.fixedBufferStream(assets.bgm.bit_bit_loop);
|
||||||
|
const bgm_sound_stream = std.io.StreamSource{ .const_buffer = bgm_fbs };
|
||||||
|
const bgm = try mach.Audio.Opus.decodeStream(gpa.allocator(), bgm_sound_stream);
|
||||||
|
|
||||||
const sfx_fbs = std.io.fixedBufferStream(assets.sfx.sword1);
|
const sfx_fbs = std.io.fixedBufferStream(assets.sfx.sword1);
|
||||||
|
const sfx_sound_stream = std.io.StreamSource{ .const_buffer = sfx_fbs };
|
||||||
var sound_stream = std.io.StreamSource{ .const_buffer = bgm_fbs };
|
const sfx = try mach.Audio.Opus.decodeStream(gpa.allocator(), sfx_sound_stream);
|
||||||
const bgm = try mach.Audio.Opus.decodeStream(gpa.allocator(), sound_stream);
|
|
||||||
|
|
||||||
sound_stream = std.io.StreamSource{ .const_buffer = sfx_fbs };
|
|
||||||
const sfx = try mach.Audio.Opus.decodeStream(gpa.allocator(), sound_stream);
|
|
||||||
|
|
||||||
// Initialize module state
|
// Initialize module state
|
||||||
app.init(.{ .sfx = sfx });
|
app.init(.{ .sfx = sfx });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue