Commit graph

2813 commits

Author SHA1 Message Date
tildearrow
6ad8a0893b dev240 - Merge branch 'inf2' - READ
this introduces several major changes to Furnace. I hope this message explains everything.

**File Format Changes**

a new song info header (`INF2`) has been introduced, which:
- cleans up the mess I made when adding sub-songs to Furnace
- allows better forward compatibility and extensibility
- uses 16-bit chip IDs
- moves compatibility flags to another block and is stored as a DivConfig
- stores channel count in the file, allowing chips with dynamic channel count (e.g. Namco 163)

a new sub-song data block has been introduced as well.

check out papers/format.md for information.

**Furnace Changes**

TimeBase ("Divider" in the UI) has been REMOVED. it was a DefleMask leftover.
to compensate, the speeds are now 16-bit. older songs will have their speeds converted, but this may fail if you use grooves or change speed mid-song.

dynamic channel count support has been added. the following chips are currently supported:
- Namco 163 (1-8 channels)
- ES5506 (5-32 channels)
- Generic PCM DAC (1-128 channels, with software mixing!)

channel colors have been added (thanks Eknous!).

SegaPCM (compatible 5-channel mode) and Neo Geo CD have been REMOVED. when loading previous files, including .dmf ones, these will have compatible SegaPCM and Neo Geo CD chips converted to normal SegaPCM and YM2610 respectively.
their channel count remains unaltered though. you can fix this by going into the chip manager and clicking the button next to "irregular channel count" in each chip config section.

**Code Changes**

a couple refactors have been made for the sake of code cleanliness and depending less on DivEngine...

=> Chip Channel Count

two new values, adjacent to the channel count, have been added to DivSysDef.
these specify the minimum and maximum channel count for a chip.

if your chip doesn't require dynamic channels, feel free to set these to the channel count.

for example, here's an old definition:

```
sysDefs[DIV_SYSTEM_NES]=new DivSysDef(
  _("NES (Ricoh 2A03)"), NULL, 0x06, 0x06, 5 /* channel count*/, false, true, 0x161, false, (1U<<DIV_SAMPLE_DEPTH_1BIT_DPCM)|(1U<<DIV_SAMPLE_DEPTH_8BIT), 0, 0,
  ...
```

and here's how it looks now:

```
sysDefs[DIV_SYSTEM_NES]=new DivSysDef(
  _("NES (Ricoh 2A03)"), NULL, 0x06, 0x06, 5 /* nominal channel count*/, 5 /* min channels */, 5 /* max channels */,
  false, true, 0x161, false, (1U<<DIV_SAMPLE_DEPTH_1BIT_DPCM)|(1U<<DIV_SAMPLE_DEPTH_8BIT), 0, 0,
  ...
```

=> New Channel Definition

a new way to define chip channels has been introduced, replacing the old one.
it looks cleaner and is more flexible (even supporting dynamic channel count).

it works by defining a function in the chip definition, which returns a DivChanDef with channel information (name, short name, type and instrument type(s)).
alternatively, a list can be provided in the DivChanDefFunc() constructor, in the event channels differ greatly and/or the number of channels is small.
for example, if your chip's channel definition code looked like this:

```
{_("Pulse 1"), _("Pulse 2"), _("Triangle"), _("Noise"), _("DPCM")}, // names
{"S1", "S2", "TR", "NO", "DMC"}, // short names
{DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_WAVE, DIV_CH_NOISE, DIV_CH_PCM}, // types
{DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES}, // ins types
{DIV_INS_NULL, DIV_INS_NULL, DIV_INS_NULL, DIV_INS_NULL, DIV_INS_AMIGA}, // secondary ins types
```

now they look like this:

```
DivChanDefFunc({
  DivChanDef(_("Pulse 1") , "S1" , DIV_CH_PULSE, DIV_INS_NES),
  DivChanDef(_("Pulse 2") , "S2" , DIV_CH_PULSE, DIV_INS_NES),
  DivChanDef(_("Triangle"), "TR" , DIV_CH_WAVE , DIV_INS_NES),
  DivChanDef(_("Noise")   , "NO" , DIV_CH_NOISE, DIV_INS_NES),
  DivChanDef(_("DPCM")    , "DMC", DIV_CH_PCM  , DIV_INS_NES, DIV_INS_AMIGA)
}),
```

some helper templates, such as stockChanDef and simpleChanDef also exist, which automatically map channel names and types regardless of count.
this is useful if all your channels happen to be named "Channel 1", "Channel 2" and so on, while sharing the same type and instrument type (this is the case for many sampler chips).

if you've been working on a custom chip, make sure to adapt your chip definitions.

=> More Chip Definition Changes

the DivSystem enum is now in src/engine/sysDef.h

channel definitions are cached in the DivSong.

=> Reducing Dependency on DivEngine

many functions have been moved away from DivEngine where possible. these include:

- recalcChans() (now on DivSong)
  - chans, sysOfChan, dispatchOfChan, dispatchChanOfChan and dispatchFirstChan have been moved to DivSong as well.
- asset dir storage/modification/check finctions (now on src/engine/assetDir.cpp)
- DivEngine::getSystemDef() is now a static function, so it can be called without a DivEngine (engine still has to initialize systems first!)

IMPORTANT: hasLoadedSomething is no longer set in recalcChans() because it is part of DivEngine. if you have import code, MAKE SURE TO SET hasLoadedSomething TO true AFTER SWITCHING THE SONG (song=ds).

=> Dynamic Channel Count

a new array called systemChans[] has been added to DivSong, allowing you to define the number of channels for each chip.
if you change this, make sure to call recalcChans() afterwards.

if you use dispatchChanOfChan[], treat `-1` as "no channel". this is set when the channel count is higher than the chip's maximum.

if you're working on import code, and are certain you won't use dynamic channel count, call DivSong::initDefaultSystemChans() before recalcChans(). this will set up default channel counts for you.
otherwise, set systemChans[] appropriately.
2025-11-21 11:26:27 -05:00
Eknous-P
62afabbc0b GBA DMA: initalize wtMem to 0 on reset 2025-11-21 13:09:38 +04:00
tildearrow
26993d2b40 giga-refactor, part 19
fix Namco 163 stuff
2025-11-19 19:35:18 -05:00
tildearrow
bdd916a4c7 PCM DAC: fix mixing 2025-11-18 15:40:53 -05:00
tildearrow
1a113a4d52 giga-refactor, part 15
dynamic PCM DAC
2025-11-17 21:09:43 -05:00
tildearrow
90a9a86e09 giga-refactor, part 9
new format saving
compatibility flags now part of own struct
2025-11-16 01:41:17 -05:00
tildearrow
7f9baedc89 YM2612: fix inVol taking effect unnecessarily
thanks Slightly Large NC!
2025-11-11 03:47:34 -05:00
tildearrow
55c3966eda total extinction of legacy sample mode, part 10
it's ready! you must merge, now!
2025-11-10 04:43:45 -05:00
tildearrow
0f5455831a total extinction of legacy sample mode, part 5
partially working converter
2025-11-09 05:23:32 -05:00
tildearrow
183526cdbd total extinction of legacy sample mode, part 3
remove all the code which handles legacy sample mode
next up is a conversion strategy
2025-11-08 20:05:52 -05:00
tildearrow
aa8054754c Merge branch 'master' into noLegacySample 2025-11-08 18:53:42 -05:00
tildearrow
684d041dbb SN: mega-optimization 2025-11-08 18:30:48 -05:00
tildearrow
4b1605f2c2 horrible build failure 2025-11-08 16:11:03 -05:00
tildearrow
0602a2f811 total extinction of legacy sample mode, part 2
remove legacy sample bank completely
2025-11-08 15:17:56 -05:00
tildearrow
416148bd62 total extinction of legacy sample mode, part 1 2025-11-08 14:37:51 -05:00
tildearrow
8791ab0f65 Virtual Boy: fix last_output not being reset 2025-11-06 03:39:08 -05:00
tildearrow
27a1869775 PCE: fix blip_prev_samp not resetting 2025-11-06 03:34:43 -05:00
tildearrow
872eeff9f1 OPL: fix some OPL3 chan osc bugs
- 4-op muting being broken
- output channel inconsistencies between Nuked-OPL3 and ymfm

thanks Forte!
2025-11-03 03:30:23 -05:00
tildearrow
29929beeac remove partial pitch linearity
the hacky mode is no more
2025-10-22 14:00:52 -05:00
tildearrow
dc87bc489f AY/YM Timer FX bug fixes and improvements
pull request #2547
manual merge due to modification of unrelated files according to GitHub's
files view

Co-authored-by: host12prog <hungnguyen.481335@gmail.com>
2025-10-04 18:39:07 -05:00
cam900
5aa9019ec2 Reduce logging in MSM6258 rate changes 2025-10-04 16:49:51 -05:00
tildearrow
f9372ec53f Merge remote-tracking branch 'origin/master' into newFilePicker 2025-10-04 04:05:25 -05:00
tildearrow
908052d728 SAA1099: limit core quality
to overcome oscBuf limitations
issue #2648
2025-10-03 17:57:36 -05:00
cam900
1b712e03ee Add notifySampleChanged in dispatch and engine:
This method/variables are for notify sample is changed/altered/added/removed.  can be called together with updateSampleTex for sample update.

multipcm: Fix possible desync with instrument and sample parameter

opl4: Split sample table render and sample data render, Add notifySampleChange for refresh sample parameters
2025-10-01 12:31:39 +02:00
tildearrow
70f512003e OPN: fix wrong getGain in ExtCh 2025-09-16 03:05:27 -05:00
tildearrow
3a06e7b963 remove hasSampleInsHeader()
- it is only used by MultiPCM
- an alternative approach is in place
2025-09-14 14:21:31 -05:00
tildearrow
c1b7a06a37 MultiPCM: add renderInstruments()
call it on instrument addition/removal/modification,
reset and/or renderSamples
2025-09-14 05:25:44 -05:00
tildearrow
684bebf202 MultiPCM: fix muting on reset 2025-09-13 14:14:11 -05:00
tildearrow
de1ab67d4a Merge branch 'master' into hasSampleHeader 2025-09-13 04:23:19 -05:00
tildearrow
551da762ee Merge branch 'master' into getSampleMemOffset 2025-09-13 04:13:27 -05:00
tildearrow
d16bad802d NDS: fix volume
it was twice as loud and global volume would clip
2025-09-12 05:10:17 -05:00
tildearrow
825039ec5a Lynx: write duty on forceIns()
issue #2674
2025-09-10 23:51:08 -05:00
tildearrow
17420d5d23 QSound: fix loop end being used as sample end
even if loop is disabled
2025-09-08 02:32:24 -05:00
tildearrow
3a66e0ceee T6W28: actually fix the phase reset issue
issue #2665
2025-09-07 04:34:59 -05:00
tildearrow
0da42f18a6 T6W28: fix noise reset on all duty macro steps
issue #2665
2025-09-05 13:26:52 -05:00
tildearrow
aa67f78d36 MMC5: fix typo in comment 2025-09-05 02:10:58 -05:00
tildearrow
67c7afd4cd MMC5: fix env mode not set after reset/forceIns
issue #2675
2025-09-05 01:01:27 -05:00
cam900
d558798bbc Fix MultiPCM dummy instrument 2025-08-30 08:18:07 +09:00
cam900
ffc681b8fa Fix MultiPCM sample OOB issue 2025-08-30 08:15:13 +09:00
cam900
957b57f3d9 Add primary MultiPCM support
Partially revert previous commit
Add notifyInsAddition in dispatch for instrument addition
Refresh sample memory when instrument type changed
Fix naming for consistency
Also, this commit fixes a some possible issue in MultiPCM on openMSX core.
Chip ID: Already determined
2025-08-29 16:24:32 +09:00
cam900
bd8d9a56a0 Prepare to add hasSamplePtrHeader and hasSampleInstHeader in dispatch (WIP)
for refresh sample memory when loop/end pointer and instrument parameter changed. Also, this PR has minor code style fixes and add warning in MultiPCM sample map usage.
2025-08-27 22:52:19 +09:00
cam900
e9b6b441e3 Merge branch 'master' of https://github.com/tildearrow/furnace into getSampleMemOffset 2025-08-27 21:18:29 +09:00
cam900
4ed40d37d6 Add sample limit in OPL4 PCM, Reduce duplicate
it has 512 (if header at 0x000000) or 128 (otherwise; first 384 sample is from bottommost area (ex: YRW801 ROM) in this case) sample limits
2025-08-27 21:02:51 +09:00
cam900
44b2d3d037 QSound: Fix ADPCM Address and code style,
Add QSound ADPCM sample warning:
Because QSound ADPCM has twice long max sample length but start/end addresses are byte aligned, doesn't have loop and pitch (fixed to output rate / 3).
2025-08-20 17:57:40 -05:00
tildearrow
ee64dd6a16 T6W28: fix noise emulation
thanks to Burnt Fishy and The Beesh-Spweesh! for information
2025-08-19 20:58:08 -05:00
tildearrow
3b37a5334a OPNA/B: fix SSG DAC/TFX not working with LLE core 2025-08-19 04:23:58 -05:00
Electric Keet
bf348efe24 VERA version number fix. 2025-08-11 05:05:25 -05:00
cam900
915805862f
msm6295.cpp: Add sample count limit when NMK112 banked
In this case, sample limit is expanded to 8192. (32 samples per bank * 256 banks)
2025-08-01 19:35:40 +09:00
tildearrow
1b40577585 MSM6295: mark samples after 126 as unloaded 2025-07-29 05:20:32 -05:00
tildearrow
c8d323d708 Supervision: fix crash 2025-07-28 05:25:17 -05:00