diff --git a/apu/bapu/dsp/SPC_DSP.cpp b/apu/bapu/dsp/SPC_DSP.cpp index 6213b08b7..66b764958 100644 --- a/apu/bapu/dsp/SPC_DSP.cpp +++ b/apu/bapu/dsp/SPC_DSP.cpp @@ -860,7 +860,15 @@ inline void SPC_DSP::voice_output( voice_t const* v, int ch ) // Apply left/right volume int amp = (m.t_output * (int8_t) VREG(v->regs,voll + ch)) >> 7; amp *= ((stereo_switch & (1 << (v->voice_number + ch * voice_count))) ? 1 : 0); - + + #ifdef __LIBRETRO__ + // Apply user-set volume (if set) + if (Settings.ChannelsVolumePercent[v->voice_number] < 100) + { + amp = amp * Settings.ChannelsVolumePercent[v->voice_number] / 100; + } + #endif + // Add to output total m.t_main_out [ch] += amp; CLAMP16( m.t_main_out [ch] ); diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 0136b601b..3a62f27bc 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -371,19 +371,19 @@ static void update_variables(void) } else Settings.UpAndDown = false; - - strcpy(key, "snes9x_sndchan_x"); + + strcpy(key, "snes9x_sndchan_volume_x"); var.key=key; for (int i=0;i<8;i++) { - key[strlen("snes9x_sndchan_")]='1'+i; + key[strlen("snes9x_sndchan_volume_")]='1'+i; var.value=NULL; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)) - disabled_channels|=1<