audio: add InStream and more functiosn coverage to soundio binding
This commit is contained in:
parent
751cceb94a
commit
f1845c0f41
4 changed files with 97 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
const c = @import("c.zig");
|
||||
const intToError = @import("error.zig").intToError;
|
||||
const Error = @import("error.zig").Error;
|
||||
const Aim = @import("enums.zig").Aim;
|
||||
const Backend = @import("enums.zig").Backend;
|
||||
const Device = @import("Device.zig");
|
||||
|
||||
|
|
@ -36,6 +37,10 @@ pub fn waitEvents(self: SoundIo) void {
|
|||
c.soundio_wait_events(self.handle);
|
||||
}
|
||||
|
||||
pub fn wakeup(self: SoundIo) void {
|
||||
c.soundio_wakeup(self.handle);
|
||||
}
|
||||
|
||||
pub fn defaultInputDeviceIndex(self: SoundIo) ?u16 {
|
||||
const index = c.soundio_default_input_device_index(self.handle);
|
||||
return if (index < 0) null else @intCast(u16, index);
|
||||
|
|
@ -46,6 +51,16 @@ pub fn defaultOutputDeviceIndex(self: SoundIo) ?u16 {
|
|||
return if (index < 0) null else @intCast(u16, index);
|
||||
}
|
||||
|
||||
pub fn inputDeviceCount(self: SoundIo) ?u16 {
|
||||
const count = c.soundio_input_device_count(self.handle);
|
||||
return if (count < 0) null else @intCast(u16, count);
|
||||
}
|
||||
|
||||
pub fn outputDeviceCount(self: SoundIo) ?u16 {
|
||||
const count = c.soundio_output_device_count(self.handle);
|
||||
return if (count < 0) null else @intCast(u16, count);
|
||||
}
|
||||
|
||||
pub fn getInputDevice(self: SoundIo, index: u16) ?Device {
|
||||
return Device{
|
||||
.handle = c.soundio_get_input_device(self.handle, index) orelse return null,
|
||||
|
|
@ -57,3 +72,15 @@ pub fn getOutputDevice(self: SoundIo, index: u16) ?Device {
|
|||
.handle = c.soundio_get_output_device(self.handle, index) orelse return null,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn getInputDeviceFromID(self: SoundIo, id: [:0]const u8, is_raw: bool) ?Device {
|
||||
return Device{
|
||||
.handle = c.soundio_get_input_device_from_id(self.handle, id.ptr, is_raw) orelse return null,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn getOutputDeviceFromID(self: SoundIo, id: [:0]const u8, is_raw: bool) ?Device {
|
||||
return Device{
|
||||
.handle = c.soundio_get_output_device_from_id(self.handle, id.ptr, is_raw) orelse return null,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue