sysaudio: access sample rate from field (except for jack) and add media role option

This commit is contained in:
Ali Chraghi 2023-01-19 17:34:21 +03:30 committed by Stephen Gutekanst
parent bb6a654c90
commit 7315d1ab62
6 changed files with 41 additions and 44 deletions

View file

@ -112,9 +112,9 @@ pub const Context = struct {
.is_paused = false,
.writeFn = writeFn,
.user_data = options.user_data,
.sample_rate = options.sample_rate,
.channels = device.channels,
.format = .f32,
.sample_rate = options.sample_rate,
.write_step = @sizeOf(f32),
};
@ -138,10 +138,10 @@ pub const Player = struct {
is_paused: bool,
writeFn: main.WriteFn,
user_data: ?*anyopaque,
sample_rate: u24,
channels: []main.Channel,
format: main.Format,
sample_rate: u24,
write_step: u8,
pub fn deinit(self: *Player) void {
@ -221,10 +221,6 @@ pub const Player = struct {
defer gain.deinit();
return @floatCast(f32, gain.get("value").view(.num));
}
pub fn sampleRate(self: Player) u24 {
return self.sample_rate;
}
};
fn freeDevice(allocator: std.mem.Allocator, device: main.Device) void {