libretroadmin cf6080af28 sound: per-channel expansion-audio volume controls (#512)
Adds six new core options for individually scaling the output of each
emulated Famicom expansion-audio chip:

  - fceumm_apu_fds   - Famicom Disk System 2C33 wavetable
  - fceumm_apu_s5b   - Sunsoft 5B (YM2149F clone)
  - fceumm_apu_n163  - Namco 163
  - fceumm_apu_vrc6  - Konami VRC6
  - fceumm_apu_vrc7  - Konami VRC7 (YM2413-clone)
  - fceumm_apu_mmc5  - Nintendo MMC5 PCM + square

Each is a 0..100 range in steps of 5: 100 (default) is the unscaled
output and is bit-identical to pre-patch builds; 0 silences the chip;
intermediate values do (sample * vol) / 256 with vol in the internal
0..256 range used by the existing per-NES-APU-channel TriangleVolume /
SquareVolume / NoiseVolume / PCMVolume fields.

The original report (#512) asked for on/off toggles; the followup
asked for volume.  This implements volume - on/off falls out as the
endpoints (0/100) of the same control, matching what fceumm_next
exposes.  The three rare PCM/speech chips mentioned in the original
report (NEC uPD7755C/56C Jaleco, Mitsubishi M50805 Bandai) are not
included; they're outside fceumm_next's scope as well and not all of
those chip emulations have a clean output stage to wrap.

Implementation:

 - One new int[6] in FSettings (fceu.h) and an init loop in fceu.c
   that sets all six slots to 256 on startup.  Matches the existing
   per-NES-APU per-channel volume convention so the default mixing
   path stays unchanged.
 - One enum (SND_FDS..SND_MMC5, sound.h) and one helper, GetExpOutput
   (sound.c), that wraps the per-channel scale.  Fast path on the
   default value 256 returns the input unchanged with no multiply, so
   the hot mixing loops keep the same instruction sequence as before.
 - Each of the six chip's audio module wraps its output amplitude
   through GetExpOutput(SND_XXX, amp) at the point where the
   computed sample is written into Wave[] / WaveHi[].  For VRC7 the
   wrap is a small dispatch helper (VRC7Mix) that defers to plain
   OPLL_fillbuf at vol=256 and falls back to a local mix loop
   calling OPLL_calc when scaling is needed - this keeps the
   default path identical to before the patch.  For the FDS module
   the wrap is at the cached sample-out point, reusing the same
   site (and reinstating the GetOutput-style scaling that the
   recent MDFN backport had to drop for lack of the API).
 - libretro.c's check_variables polls the six new options at the
   same point it polls the existing fceumm_apu_1..5 bitmask, via
   a small {SND_XXX, "fceumm_apu_xxx"} table.

Validation on Vs. Excitebike (Japan) FDS, 9000-frame headless capture:

  - default (no opts set):                 md5 9c62be1651...
  - --opt fceumm_apu_fds=100:              md5 9c62be1651... (bit-identical)
  - --opt fceumm_apu_s5b=0 ... mmc5=0:     md5 9c62be1651... (no-op on FDS-only game)
  - --opt fceumm_apu_fds=50:               race-window amplitude std 7662 -> 5623,
                                            FDS contribution scales linearly within
                                            integer rounding (RMS error 30 of 5547)
  - --opt fceumm_apu_fds=0:                race-window std 7662 -> 4457, FDS muted

A non-FDS test ROM (mapper 64, Skull & Crossbones) runs cleanly with
arbitrary expansion-chip options set - those values are no-op for the
chip the game doesn't use.

Performance: GetExpOutput is one bounds check, one array load, one
compare, and on the default value an immediate return.  The mixing
loops compile to the same hot path as before for default settings.
Non-default values add one multiply + one shift per sample, which is
the same cost the per-NES-APU per-channel scaling already pays.
2026-06-14 21:03:03 +02:00
2024-09-23 05:55:21 -07:00
2023-01-02 19:47:36 +01:00
2026-04-02 10:14:04 +01:00
Fix
2017-12-21 20:40:28 +09:00
2014-12-23 09:50:29 +01:00
2015-08-06 13:28:43 +02:00
2025-09-03 16:20:50 +02:00
2019-06-28 23:44:06 +02:00

Build Status Build status

FCE Ultra mappers modified

FCEU "mappers modified" is an unofficial build of FCEU Ultra by CaH4e3, which supports a lot of new mappers including some obscure mappers such as one for unlicensed NES ROM's.

Sequential targets Light Guns support added

Support for Sequential targets Light Guns has been added. "Gun Aux A" serves as light sensor logic input.

Description
Pinned internal source mirror of libretro/libretro-fceumm for Supergame releases
Readme 4.3 MiB
Languages
C 97.7%
Python 2%
C++ 0.2%