sysaudio: rename dummy to default in webaudio
This commit is contained in:
parent
3947e51025
commit
82a853045f
2 changed files with 13 additions and 13 deletions
|
|
@ -303,25 +303,25 @@ pub const Player = struct {
|
|||
if (buf.*.buffer.*.datas[0].data == null) return;
|
||||
defer _ = lib.pw_stream_queue_buffer(self.stream, buf);
|
||||
|
||||
buf.*.buffer.*.datas[0].chunk.*.offset = 0;
|
||||
if (self.is_paused.load(.Unordered)) {
|
||||
buf.*.buffer.*.datas[0].chunk.*.stride = 0;
|
||||
buf.*.buffer.*.datas[0].chunk.*.size = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const stride = self.format.frameSize(self.channels.len);
|
||||
const n_frames = std.math.min(
|
||||
buf.*.requested,
|
||||
buf.*.buffer.*.datas[0].maxsize / stride,
|
||||
);
|
||||
buf.*.buffer.*.datas[0].chunk.*.stride = stride;
|
||||
buf.*.buffer.*.datas[0].chunk.*.size = n_frames * stride;
|
||||
|
||||
for (self.channels) |*ch, i| {
|
||||
ch.*.ptr = @ptrCast([*]u8, buf.*.buffer.*.datas[0].data.?) + self.format.frameSize(i);
|
||||
}
|
||||
|
||||
buf.*.buffer.*.datas[0].chunk.*.offset = 0;
|
||||
if (!self.is_paused.load(.Unordered)) {
|
||||
buf.*.buffer.*.datas[0].chunk.*.stride = stride;
|
||||
buf.*.buffer.*.datas[0].chunk.*.size = n_frames * stride;
|
||||
self.writeFn(self.user_data, n_frames);
|
||||
} else {
|
||||
buf.*.buffer.*.datas[0].chunk.*.stride = 0;
|
||||
buf.*.buffer.*.datas[0].chunk.*.size = 0;
|
||||
ch.ptr = @ptrCast([*]u8, buf.*.buffer.*.datas[0].data.?) + self.format.frameSize(i);
|
||||
}
|
||||
self.writeFn(self.user_data, n_frames);
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Player) void {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const util = @import("util.zig");
|
|||
const channel_size = 1024;
|
||||
const channel_size_bytes = channel_size * @sizeOf(f32);
|
||||
|
||||
const dummy_playback = main.Device{
|
||||
const default_playback = main.Device{
|
||||
.id = "default-playback",
|
||||
.name = "Default Device",
|
||||
.mode = .playback,
|
||||
|
|
@ -52,7 +52,7 @@ pub const Context = struct {
|
|||
freeDevice(self.allocator, d);
|
||||
self.devices_info.clear(self.allocator);
|
||||
|
||||
try self.devices_info.list.append(self.allocator, dummy_playback);
|
||||
try self.devices_info.list.append(self.allocator, default_playback);
|
||||
self.devices_info.list.items[0].channels = try self.allocator.alloc(main.Channel, 2);
|
||||
self.devices_info.list.items[0].channels[0] = .{ .id = .front_left };
|
||||
self.devices_info.list.items[0].channels[1] = .{ .id = .front_right };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue