From c3f6700f383bd1248626071e450eb6a6da08b8d4 Mon Sep 17 00:00:00 2001 From: makefunstuff Date: Thu, 4 Jul 2024 10:29:15 +0300 Subject: extending struct --- src/brr.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/brr.zig b/src/brr.zig index 75dc59d..cfd6f1f 100644 --- a/src/brr.zig +++ b/src/brr.zig @@ -5,6 +5,9 @@ const c = @cImport({ }); pub const snd_pcm_info_t = extern struct {}; +pub extern fn snd_pcm_info_malloc(pcm_info: *snd_pcm_info_t) void; +pub extern fn snd_pcm_info(pcm: *c.snd_pcm_t, pcm_info: *snd_pcm_info_t) c_int; +pub extern fn snd_pcm_info_free(pcm_info: *snd_pcm_info_t) void; pub fn brr(file: []const u8) !void { _ = c.mpg123_init(); @@ -71,10 +74,10 @@ pub fn brr(file: []const u8) !void { std.log.err("Failed to write to ALSA device", .{}); // TODO: figure out how to deal with opaque status var pcm_info: snd_pcm_info_t = snd_pcm_info_t{}; - _ = c.snd_pcm_info_malloc(&pcm_info); - // _ = c.snd_pcm_info(pcm, &pcm_info); + snd_pcm_info_malloc(&pcm_info); + _ = snd_pcm_info(pcm, &pcm_info); - defer c.snd_pcm_info_free(&pcm_info); + defer snd_pcm_info_free(&pcm_info); std.log.debug("pcm status is {any}", .{pcm_info}); return; } else { -- cgit 1.4.1-2-gfad0