feat(config): add config option to mute ZBA
This commit is contained in:
parent
30c5fafec1
commit
011f105bee
|
@ -4,6 +4,8 @@
|
||||||
win_scale = 4
|
win_scale = 4
|
||||||
# Enable VSYNC on the UI thread
|
# Enable VSYNC on the UI thread
|
||||||
vsync = true
|
vsync = true
|
||||||
|
# Mute ZBA
|
||||||
|
mute = false
|
||||||
|
|
||||||
[Guest]
|
[Guest]
|
||||||
# Sync Emulation to Audio
|
# Sync Emulation to Audio
|
||||||
|
|
|
@ -18,6 +18,8 @@ const Config = struct {
|
||||||
///
|
///
|
||||||
/// Note: This does not affect whether Emulation is synced to 59Hz
|
/// Note: This does not affect whether Emulation is synced to 59Hz
|
||||||
vsync: bool = true,
|
vsync: bool = true,
|
||||||
|
/// Mute ZBA
|
||||||
|
mute: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Settings realted to the emulation itself
|
// Settings realted to the emulation itself
|
||||||
|
@ -59,6 +61,7 @@ pub fn load(allocator: Allocator, config_path: []const u8) !void {
|
||||||
if (table.keys.get("Host")) |host| {
|
if (table.keys.get("Host")) |host| {
|
||||||
if (host.Table.keys.get("win_scale")) |scale| state.host.win_scale = scale.Integer;
|
if (host.Table.keys.get("win_scale")) |scale| state.host.win_scale = scale.Integer;
|
||||||
if (host.Table.keys.get("vsync")) |vsync| state.host.vsync = vsync.Boolean;
|
if (host.Table.keys.get("vsync")) |vsync| state.host.vsync = vsync.Boolean;
|
||||||
|
if (host.Table.keys.get("mute")) |mute| state.host.mute = mute.Boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table.keys.get("Guest")) |guest| {
|
if (table.keys.get("Guest")) |guest| {
|
||||||
|
|
|
@ -178,10 +178,16 @@ const Audio = struct {
|
||||||
|
|
||||||
export fn callback(userdata: ?*anyopaque, stream: [*c]u8, len: c_int) void {
|
export fn callback(userdata: ?*anyopaque, stream: [*c]u8, len: c_int) void {
|
||||||
const apu = @ptrCast(*Apu, @alignCast(@alignOf(*Apu), userdata));
|
const apu = @ptrCast(*Apu, @alignCast(@alignOf(*Apu), userdata));
|
||||||
|
|
||||||
|
// TODO: Find a better way to mute this
|
||||||
|
if (!config.config().host.mute) {
|
||||||
_ = SDL.SDL_AudioStreamGet(apu.stream, stream, len);
|
_ = SDL.SDL_AudioStreamGet(apu.stream, stream, len);
|
||||||
|
} else {
|
||||||
|
// FIXME: I don't think this hack to remove DC Offset is acceptable :thinking:
|
||||||
|
std.mem.set(u8, stream[0..@intCast(usize, len)], 0x40);
|
||||||
|
}
|
||||||
|
|
||||||
// If we don't write anything, play silence otherwise garbage will be played
|
// If we don't write anything, play silence otherwise garbage will be played
|
||||||
// FIXME: I don't think this hack to remove DC Offset is acceptable :thinking:
|
|
||||||
// if (written == 0) std.mem.set(u8, stream[0..@intCast(usize, len)], 0x40);
|
// if (written == 0) std.mem.set(u8, stream[0..@intCast(usize, len)], 0x40);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue