Skip to content

Commit

Permalink
added preproc tests for libretro (libretro#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
eadmaster authored and eadmaster committed Dec 3, 2020
1 parent 7748e65 commit 1d3dee2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
11 changes: 5 additions & 6 deletions core/sound/psg.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,14 @@ void psg_config(unsigned int clocks, unsigned int preamp, unsigned int panning)
int volume = psg.regs[i*2+1];

/* update channel stereo amplification */
if (config.psg_ch_volumes[i] == 100)
{
psg.chanAmp[i][0] = preamp * ((panning >> (i + 4)) & 1);
psg.chanAmp[i][1] = preamp * ((panning >> (i + 0)) & 1);
} else {
#ifdef __LIBRETRO__
/* also apply user-set volume scaling */
psg.chanAmp[i][0] = ((preamp * config.psg_ch_volumes[i]) / 100) * ((panning >> (i + 4)) & 1);
psg.chanAmp[i][1] = ((preamp * config.psg_ch_volumes[i]) / 100) * ((panning >> (i + 0)) & 1);
}
#else
psg.chanAmp[i][0] = preamp * ((panning >> (i + 4)) & 1);
psg.chanAmp[i][1] = preamp * ((panning >> (i + 0)) & 1);
#endif

/* tone channels */
if (i < 3)
Expand Down
16 changes: 9 additions & 7 deletions core/sound/ym2612.c
Original file line number Diff line number Diff line change
Expand Up @@ -2090,13 +2090,15 @@ void YM2612Update(int *buffer, int length)
if (out_fm[5] > 8191) out_fm[5] = 8191;
else if (out_fm[5] < -8192) out_fm[5] = -8192;

/* user volume scaling */
if (config.md_ch_volumes[0] != 100) out_fm[0] = (out_fm[0] * config.md_ch_volumes[0]) / 100;
if (config.md_ch_volumes[1] != 100) out_fm[1] = (out_fm[1] * config.md_ch_volumes[1]) / 100;
if (config.md_ch_volumes[2] != 100) out_fm[2] = (out_fm[2] * config.md_ch_volumes[2]) / 100;
if (config.md_ch_volumes[3] != 100) out_fm[3] = (out_fm[3] * config.md_ch_volumes[3]) / 100;
if (config.md_ch_volumes[4] != 100) out_fm[4] = (out_fm[4] * config.md_ch_volumes[4]) / 100;
if (config.md_ch_volumes[5] != 100) out_fm[5] = (out_fm[5] * config.md_ch_volumes[5]) / 100;
#ifdef __LIBRETRO__
/* apply user volume scaling */
if (config.md_ch_volumes[0] != 100) out_fm[0] = (out_fm[0] * config.md_ch_volumes[0]) / 100;
if (config.md_ch_volumes[1] != 100) out_fm[1] = (out_fm[1] * config.md_ch_volumes[1]) / 100;
if (config.md_ch_volumes[2] != 100) out_fm[2] = (out_fm[2] * config.md_ch_volumes[2]) / 100;
if (config.md_ch_volumes[3] != 100) out_fm[3] = (out_fm[3] * config.md_ch_volumes[3]) / 100;
if (config.md_ch_volumes[4] != 100) out_fm[4] = (out_fm[4] * config.md_ch_volumes[4]) / 100;
if (config.md_ch_volumes[5] != 100) out_fm[5] = (out_fm[5] * config.md_ch_volumes[5]) / 100;
#endif

/* stereo DAC output panning & mixing */
lt = ((out_fm[0]) & ym2612.OPN.pan[0]);
Expand Down

0 comments on commit 1d3dee2

Please sign in to comment.