Hi, I am trying to learn about gameboy emulation and stumbled on your emulator which has been very insightful.
I am a bit stumbled by the logic around how sound volume is being calculated and would love to better understand the math behind it.
let left_vol = (self.volume_left as f32 / 7.0) * (1.0 / 15.0) * 0.25;
let right_vol = (self.volume_right as f32 / 7.0) * (1.0 / 15.0) * 0.25;
I understand (self.volume_left as f32 / 7.0) as 7 is the maximum volume of the gameboy registers so it is calculating the "max" volume.
But I am not sure what is the purpose of (1.0 / 15.0) neither of * 0.25;.
I you could help me understand this logic I would greatly appreciate it.
Hi, I am trying to learn about gameboy emulation and stumbled on your emulator which has been very insightful. I am a bit stumbled by the logic around how sound volume is being calculated and would love to better understand the math behind it.
I am referring specifically to the following lines: https://github.com/mvdnes/rboy/blob/main/src/sound.rs#L891
I understand
(self.volume_left as f32 / 7.0)
as 7 is the maximum volume of the gameboy registers so it is calculating the "max" volume. But I am not sure what is the purpose of(1.0 / 15.0)
neither of* 0.25;
.I you could help me understand this logic I would greatly appreciate it.