Commit graph

140 commits

Author SHA1 Message Date
tildearrow
34b06855cd update Dear ImGui to 1.92.5 - READ
there are some text changes which may break text undo/redo.
testing needed.
2025-12-26 18:12:14 -05:00
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
0d396d4416 fix sample list right click, again
pls dont crash...
2025-11-19 17:07:22 +04:00
tildearrow
2f25acd017 move asset dir functions to another file
and get them out of the engine
2025-11-11 18:33:23 -05:00
tildearrow
5b145b7121 multiple instrument playback, part 1
not implemented for MIDI yet
2025-10-31 19:36:13 -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
7b5167880f Revert "fix sample list right-click only working on name"
This reverts commit 43b369495b.
2025-08-16 16:35:39 -05:00
Eknous-P
43b369495b fix sample list right-click only working on name
by moving the context item code to the selectable
2025-08-14 05:25:28 -05:00
tildearrow
0d154b1445 GUI: fix wave >=1000 index cut off in wave list 2025-07-31 18:48:45 -05:00
tildearrow
b5cb1d626c GUI: dynamic wave list buttons 2025-07-31 18:38:17 -05:00
tildearrow
cf4a2fa902 GUI: fix new folder in sample list not working 2025-07-30 05:29:49 -05:00
tildearrow
8a7295fd86 GUI: create folder in dynamic buttons 2025-07-29 20:15:46 -05:00
tildearrow
4bd72574cf GUI: dynamic sample list buttons
only show those which fit
2025-07-29 20:11:25 -05:00
tildearrow
fc95d73e1d GUI: remove the edit button 2025-07-29 02:32:01 -05:00
tildearrow
70413291de GUI: move the edit button in asset list
it messes with muscle memory
2025-07-27 20:21:38 -05:00
Eknous-P
0a1f111e0c remove redundant *EditOpen=true;s 2025-07-25 15:01:41 -05:00
Eknous-P
8872808989 context menu items and buttons to open asset editors 2025-07-25 15:01:41 -05:00
tildearrow
67a176aa9a GUI: fix FM preview not updating on ins select
if draggable asset view is on
issue #2506
2025-06-18 03:46:27 -05:00
tildearrow
72a2fa1b2e GUI: fix instrument drag
issue #2386
2025-03-10 04:16:38 -05:00
tildearrow
b64a92668a GUI: fix drag-and-drop crash
this time for real!
issue #2327
2025-03-10 04:14:01 -05:00
tildearrow
00ad4e4a46 update copyright year 2025-01-28 18:49:19 -05:00
tildearrow
304a8b8722 GUI: short circuit evaluation paranoia
issue #2327
2025-01-17 03:01:30 -05:00
yohannd1
1b3a3c457d instrument drag&drop: fix marking as modified 2024-12-25 17:35:09 -05:00
yohannd1
0b4cf34e4d instrument drag&drop: adding option to disable 2024-12-20 21:36:04 -03:00
yohannd1
2382c19583 ctrl drag&drop fix (use IsKeyDown instead of IsKeyPressed) 2024-12-19 16:23:11 -03:00
yohannd1
32ea140a61 wave+sample drag&drop, and supporting swap via ctrl-drag 2024-12-19 15:51:21 -03:00
yohannd1
6ffc495c81 instrument swap implemented (thanks to @Eknous-P) 2024-12-19 15:04:10 -03:00
yohannd1
806e56a3b2 instrument drag and drop: most of the code
Missing the code that actually swaps the instruments :)
2024-12-19 12:00:24 -03:00
tildearrow
f7a861a01d Merge remote-tracking branch 'alederer/wave-list-horizontal' 2024-09-29 18:26:57 -05:00
Adam Lederer
6c6ea2d54b keep template<> on same line 2024-09-12 13:33:18 -07:00
Adam Lederer
3f6200aa9a support horizontal mode in wavetable list 2024-09-12 01:04:56 -07:00
tildearrow
9d77522efb GUI: prepare to add "save all assets" options 2024-07-27 04:35:21 -05:00
tildearrow
871c260bc1 GUI: fix text hiding after hash in ins/sample list 2024-07-14 02:27:35 -05:00
tildearrow
3197e73b2c localize window names 2024-05-27 17:53:46 -05:00
tildearrow
00e0679442 the massive preparations - GUI 2024-05-26 19:31:17 -05:00
tildearrow
603249573a GUI: separate wantScrollList
issue #1894
2024-05-21 17:26:04 -05:00
tildearrow
66bacef681 GUI: implement "make me a drum kit" option 2024-01-30 02:14:14 -05:00
tildearrow
88b42ddd58 update copyright year 2024-01-16 21:26:57 -05:00
tildearrow
8ded0eb673 GUI: possibly fix crash when loading ESFM ins 2023-12-18 10:32:44 -05:00
tildearrow
fbbe0bdf63 GUI: fix sample list right click bug 2023-11-01 00:16:35 -05:00
tildearrow
497c32b05b GUI: add right click in sample list 2023-10-28 19:43:26 -05:00
Electric Keet
4450ebb7aa Add "duplicate" to inst. list context menu.
It's right at the top of the menu, purely because that's the order the buttons are in.
2023-10-09 18:54:14 -05:00
tildearrow
c356b03b67 GUI: don't use ArrowButton 2023-09-09 15:24:13 -05:00
tildearrow
86ffd40dd4 GUI: fix wave list selectable size 2023-09-09 14:58:03 -05:00
tildearrow
684633aa1e GUI: preview sample button in unified assets
issue #1430
2023-08-28 06:37:13 -05:00
Eknous
06f2595861
formatting 2023-08-28 10:00:32 +04:00
Eknous-P
65fbdba831 wavetable list selectable sizing fix 2023-08-27 12:49:53 +04:00
Eknous-P
4eda4aeb39 revert icon changes 2023-08-27 10:18:39 +04:00
Eknous-P
fdd9b598a7 revert additive hint 2023-08-27 10:15:28 +04:00
Eknous-P
a7eb62a5d6 add sample add add color 2023-08-26 16:15:40 +04:00