all: fix issue with glfw vulkan createWindowSurface; update to new for loop syntax (#713)
This commit is contained in:
parent
5aecbb0ee6
commit
2b6f3fb1d9
14 changed files with 28 additions and 27 deletions
|
|
@ -201,7 +201,7 @@ pub const Context = struct {
|
|||
var ports = try self.allocator.alloc(*c.jack_port_t, device.channels.len);
|
||||
var dest_ports = try self.allocator.alloc([:0]const u8, ports.len);
|
||||
var buf: [64]u8 = undefined;
|
||||
for (device.channels) |_, i| {
|
||||
for (device.channels, 0..) |_, i| {
|
||||
const port_name = std.fmt.bufPrintZ(&buf, "playback_{d}", .{i + 1}) catch unreachable;
|
||||
const dest_name = try std.fmt.allocPrintZ(self.allocator, "{s}:{s}", .{ device.id, port_name });
|
||||
ports[i] = lib.jack_port_register(self.client, port_name.ptr, c.JACK_DEFAULT_AUDIO_TYPE, c.JackPortIsOutput, 0) orelse
|
||||
|
|
@ -259,7 +259,7 @@ pub const Player = struct {
|
|||
if (lib.jack_activate(self.client) != 0)
|
||||
return error.CannotPlay;
|
||||
|
||||
for (self.ports) |port, i| {
|
||||
for (self.ports, 0..) |port, i| {
|
||||
if (lib.jack_connect(self.client, lib.jack_port_name(port), self.dest_ports[i].ptr) != 0)
|
||||
return error.CannotPlay;
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ pub const Player = struct {
|
|||
fn processCallback(n_frames: c.jack_nframes_t, self_opaque: ?*anyopaque) callconv(.C) c_int {
|
||||
const self = @ptrCast(*Player, @alignCast(@alignOf(*Player), self_opaque.?));
|
||||
|
||||
for (self.channels) |*ch, i| {
|
||||
for (self.channels, 0..) |*ch, i| {
|
||||
ch.*.ptr = @ptrCast([*]u8, lib.jack_port_get_buffer(self.ports[i], n_frames));
|
||||
}
|
||||
self.writeFn(self.user_data, n_frames);
|
||||
|
|
@ -279,7 +279,7 @@ pub const Player = struct {
|
|||
pub fn play(self: *Player) !void {
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
for (self.ports) |port, i| {
|
||||
for (self.ports, 0..) |port, i| {
|
||||
if (lib.jack_connect(self.client, lib.jack_port_name(port), self.dest_ports[i].ptr) != 0)
|
||||
return error.CannotPlay;
|
||||
}
|
||||
|
|
@ -288,7 +288,7 @@ pub const Player = struct {
|
|||
pub fn pause(self: *Player) !void {
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
for (self.ports) |port, i| {
|
||||
for (self.ports, 0..) |port, i| {
|
||||
if (lib.jack_disconnect(self.client, lib.jack_port_name(port), self.dest_ports[i].ptr) != 0)
|
||||
return error.CannotPause;
|
||||
}
|
||||
|
|
@ -297,7 +297,7 @@ pub const Player = struct {
|
|||
pub fn paused(self: *Player) bool {
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
for (self.ports) |port, i| {
|
||||
for (self.ports, 0..) |port, i| {
|
||||
if (lib.jack_port_connected_to(port, self.dest_ports[i].ptr) == 1)
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue