skyfloogle / red-viper

A Virtual Boy emulator for the 3DS
764 stars 17 forks source link

Suggestion: Have a volume slider #33

Closed randomname42 closed 3 months ago

randomname42 commented 4 months ago

I can usually just leave the volume slider at the same level for everything on the 3DS. But for some reason Red Viper is louder than other things I use on the 3DS. I have to move the 3DS's volume slider down every time I use Red Viper, and move it back up when using anything else.

It might be a minor inconvenience overall, but it would be appreciated if there was a way to change volume level in Red Viper itself. I have had sliders stop working correctly on other devices from frequent adjustment so I would prefer not to be having to adjust the physical slider on the 3DS especially for that reason.

vaguerant commented 4 months ago

This seemed relatively simple to implement so I gave it a shot here:

red-viper_volume-toggle.zip

This turns the existing On/Off Sound toggle in the Options into a 4-way toggle with volume settings for > (33%), >> (67%), >>> (100%) and Off. In theory there's no reason for it to be limited to four settings, that's just what I had set up ready to go from another thing.

Besides the GUI changes, all I'm doing is this:

@@ -956,7 +969,7 @@ void openMenu() {
     C3D_AlphaBlend(GPU_BLEND_ADD, GPU_BLEND_ADD, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);
     main_menu();
     if (game_running && tVBOpt.SOUND)
-        ndspSetMasterVol(1.0);
+        ndspSetMasterVol(tVBOpt.SOUND == 1 ? 0.33 : tVBOpt.SOUND == 2 ? 0.67 : 1.0);
 }

 void showSoundError() {

I can PR if this is desirable, but it's so simple I'd hesitate to waste floogle's time with it.

@skyfloogle That said, messing with this did expose a bug, which is that toggling Sound Off then back On causes sound to stop working until the game next plays some "new" audio. e.g. If you toggle Sound Off then On the Jack Bros. title screen, the background music and SFX stop playing until you press Start to begin the game. This bug wasn't introduced by my changes, it also happens in clean builds.

skyfloogle commented 4 months ago

Thanks for being proactive with this stuff @vaguerant, I'll look at your other PR tomorrow. I think that for this, it may make some sense to just lower the default volume level to match what's standard for other 3DS games. PCM sample support requires a decent re-evaluation of the audio engine, and the other bug @vaguerant mentioned will probably get fixed in the process.

cheatfreak47 commented 3 months ago

I think having multiple volume levels is better, the current actions build seems quite quiet compared to the release build

skyfloogle commented 3 months ago

I think having multiple volume levels is better, the current actions build seems quite quiet compared to the release build

It is, yeah. I've been redoing the audio emulation from scratch, which means the volume level ended up differently from where it was before, and I haven't done any volume balancing yet. I'll do that before I put out a proper update.

skyfloogle commented 3 months ago

Just pushed a change that makes the audio as loud as it theoretically can be without clipping. Jack Bros feels like it fits in pretty well when I go back to the home menu, but it is one of the louder games.

cheatfreak47 commented 3 months ago

Playing VB Wario Land with the current actions build and it's better than before, but it seems a tad quiet compared to the pre-sound rewrite. It's not nearly as much of a problem with headphones, but the tiny 3DS speakers seemed to be a bit louder before the rewrite, and I don't remember much clipping happening before.

Since games have variable volumes, maybe it might not be a bad idea to have a volume boost option still in the settings that disregards potential for clipping and just boosts your existing volume normal to a max of ~150% of the current volume, with the button just adding 5% increments?

randomname42 commented 3 months ago

Because of different games having different volumes maybe it would be ideal to to be able to set volume per game and have that remembered. It would be more complicated to setup but each game could be set once and not have to be adjusted again.

skyfloogle commented 3 months ago

Just implemented a DC bias type thing to further increase volume. I think I'm happy with this now.

riggles1 commented 3 months ago

Just a heads-up, not sure what caused it but for example the main lead melody of Mario Clash for example has a very tinny crackly sound to it as of the 50Hz build (loving the 50Hz). I previously was on the last officially uploaded build prior to this and it was sounding nice and clean, less tinny, more body. At any volume.

Not sure how to describe it, but maybe it's down to mixing not being nailed down.

skyfloogle commented 3 months ago

I can't tell the difference between 0.9.2.1 and yesterday's master, but I did find that changing the interpolation makes it sound a bit cleaner. How's this?

riggles1 commented 3 months ago

Ey, that's a lot better! Thanks! In particular, the stage music in Mario Clash is good for testing audio as it has a single high pitched kinda lead to it. This sounds nice now.

skyfloogle commented 3 months ago

Now that I've done some proper volume balancing and fixed this additional sound issue, I think I can close this issue. Feel free to let me know if I'm wrong :)