fix: remove DC offset from audio output
This commit is contained in:
@@ -200,7 +200,10 @@ pub const Apu = struct {
|
||||
self.stream = SDL.SDL_NewAudioStream(SDL.AUDIO_U16, 2, @intCast(c_int, self.sampleRate()), SDL.AUDIO_U16, 2, host_sample_rate) orelse unreachable;
|
||||
}
|
||||
|
||||
_ = SDL.SDL_AudioStreamPut(self.stream, &[2]u16{ final_left, final_right }, 2 * @sizeOf(u16));
|
||||
// If we add 0x4040 to each sample the DC Offset is removed
|
||||
// note: found this through guess and check
|
||||
// FIXME: Pretty sure this is a dirty hack and should be fixed
|
||||
_ = SDL.SDL_AudioStreamPut(self.stream, &[2]u16{ final_left + 0x4040, final_right + 0x4040 }, 2 * @sizeOf(u16));
|
||||
self.sched.push(.SampleAudio, self.sampleTicks() -| late);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user