audio: increase soundio binding coverage for running sine-wine example

This commit is contained in:
alichraghi 2022-06-30 20:30:50 +04:30 committed by Stephen Gutekanst
parent d3b7df882e
commit 0e3461e25f
6 changed files with 114 additions and 6 deletions

View file

@ -1,5 +1,19 @@
const std = @import("std");
const c = @import("c.zig");
const OutStream = @import("OutStream.zig");
const SoundIoDevice = @This();
const Device = @This();
handle: *c.SoundIoDevice,
pub fn unref(self: Device) void {
c.soundio_device_unref(self.handle);
}
pub fn name(self: Device) [:0]const u8 {
return std.mem.span(self.handle.*.name);
}
pub fn createOutStream(self: Device) error{OutOfMemory}!OutStream {
return OutStream{ .handle = c.soundio_outstream_create(self.handle) orelse return error.OutOfMemory };
}