libretro / beetle-pce-fast-libretro

Standalone fork of Mednafen PCE Fast to libretro
GNU General Public License v2.0
29 stars 52 forks source link

audio channels mute/balance core option #160

Closed eadmaster closed 3 years ago

eadmaster commented 3 years ago

some shmup games like "Side Arms - Hyper Dyne" have an unbalanced audio channels making the BGM hard to listen while shooting.

I'd like to suggest adding some core options to mute/reduce the volume of individual audio channels like Nestopia and the FCEUmm core has.

negativeExponent commented 3 years ago

i was under the impression you wanted volume adjustments rather than just not rendering specific channels at all. there is no such thing as a "bgm" channels as each channel represents a certain instrument or wave type (but im sure you know this). Even the shooting sfx are divided into few channels.

inactive123 commented 3 years ago

@negativeExponent If you want me to revert the PR because something was not yet considered, then let me know.

Can you and @eadmaster come to some kind of consensus as to what should be implemented?

eadmaster commented 3 years ago

Having individual channel volume adjustments would be nice, btw i've tested this with a few affected games, and it actually helps mitigating the issue (disable the SFXs while leaving the BGM untouched):

I've also checked it does not break savestates, which is important for me.

I suggest to leave this issue opened as we investigate how to do individual channel volume adjustments, which may replace the "Disable Sound Channel X" core options once implemented.

ghost commented 3 years ago

I've done something like this for a few private builds (Mesen, Handy, NGP), although Mesen already had support for this. https://github.com/SourMesen/Mesen/pull/868/files

For others, I looked for the blip_synth_offset locations and volume adjusted from the libretro settings. But since we have 6 channels, you may have to add an id tag to the struct to make things simpler. Because I didn't want the volume adjustment to get saved in the state, I did it during calling.

Blip_Synth_offset(&Synth, timestamp, (samp[0] - ch->blip_prev_samp[0]) * vol_level / 100, sbuf[0]); in 5 gain steps because I couldn't think of a better way yet.

https://github.com/libretro/beetle-pce-fast-libretro/blob/master/mednafen/pce_fast/psg.cpp https://github.com/libretro/beetle-pce-fast-libretro/blob/master/mednafen/pce_fast/psg.h

eadmaster commented 3 years ago

For others, I looked for the blip_synth_offset locations and volume adjusted from the libretro settings. But since we have 6 channels, you may have to add an id tag to the struct to make things simpler. Because I didn't want the volume adjustment to get saved in the state, I did it during calling.

Blip_Synth_offset(&Synth, timestamp, (samp[0] - ch->blip_prev_samp[0]) * vol_level / 100, sbuf[0]); in 5 gain steps because I couldn't think of a better way yet.

This has to de done for every call of Blip_Synth_offset(), right? (in UpdateOutput_Norm(), UpdateOutput_Noise(), UpdateOutput_Off(), etc.)

eadmaster commented 3 years ago

UPDATE: just tried it, and it seems to work fine!

@trioan: please confirm it is correct so i submit another PR.

ghost commented 3 years ago

I want to say yes! because I think it looks great (and I like how you handled it). But I defer to @negativeExponent to be safe.

Edit: @eadmaster I say push the PR. negativeExponent can clean it up later if desired.

eadmaster commented 3 years ago

new PR: https://github.com/libretro/beetle-pce-fast-libretro/pull/165

eadmaster commented 3 years ago

if interested also check the pending PRs i've submitted recently to have similar options in Nestopia and a fix for Snes9x: