mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
32x, improve pwm volume accuracy
This commit is contained in:
parent
7263343dc7
commit
adffea8dae
1 changed files with 2 additions and 4 deletions
|
@ -34,7 +34,7 @@ void p32x_pwm_ctl_changed(void)
|
|||
// but mars test disagrees
|
||||
pwm.mult = 0;
|
||||
if ((control & 0x0f) != 0)
|
||||
pwm.mult = 0x10000 / cycles;
|
||||
pwm.mult = (0x10000<<8) / (cycles+1);
|
||||
|
||||
pwm.irq_timer = (control & 0x0f00) >> 8;
|
||||
pwm.irq_timer = ((pwm.irq_timer - 1) & 0x0f) + 1;
|
||||
|
@ -60,9 +60,7 @@ static int convert_sample(unsigned int v)
|
|||
{
|
||||
if (v > pwm.cycles)
|
||||
v = pwm.cycles;
|
||||
if (v == 0)
|
||||
return 0;
|
||||
return v * pwm.mult - 0x10000/2;
|
||||
return (v * pwm.mult >> 8) - 0x10000/2;
|
||||
}
|
||||
|
||||
#define consume_fifo(sh2, m68k_cycles) { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue