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

@ -422,11 +422,11 @@ pub const Context = struct {
.mixer = mixer.?,
.selem = selem.?,
.mixer_elm = mixer_elm.?,
.sample_rate = sample_rate,
.writeFn = writeFn,
.user_data = options.user_data,
.channels = device.channels,
.format = format,
.sample_rate = sample_rate,
.write_step = format.frameSize(device.channels.len),
};
return .{ .alsa = player };
@ -446,10 +446,10 @@ pub const Player = struct {
mixer_elm: *c.snd_mixer_elem_t,
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 {
@ -557,10 +557,6 @@ pub const Player = struct {
return @intToFloat(f32, vol) / @intToFloat(f32, max_vol - min_vol);
}
pub fn sampleRate(self: Player) u24 {
return self.sample_rate;
}
};
fn freeDevice(allocator: std.mem.Allocator, device: main.Device) void {