Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESFM system #1559

Merged
merged 41 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
779afcb
WIP: adding ESFM (ESS ES1488/ESS ES1868 etc.) system
Kagamiin Oct 14, 2023
696433c
Fix operator order in GUI for ESFM
Kagamiin Oct 14, 2023
6733f4d
Adding alternate layout for ESFM
Kagamiin Oct 14, 2023
cfa0628
Removing unused code
Kagamiin Oct 14, 2023
484b6f4
Adding classic layout; fixing operator swapping and KSL bit order
Kagamiin Oct 14, 2023
84e0ec9
bump ct range to 24; fix bug in modern layout for OPL and ESFM
Kagamiin Oct 15, 2023
4a0295f
WIP: adding fixed pitch mode; fix UB in ESFM driver
Kagamiin Oct 15, 2023
39001dc
Adding operator routing visualization
Kagamiin Oct 16, 2023
aee939b
Implement fixed frequency mode for modern and classic layouts
Kagamiin Oct 17, 2023
8ae86f7
Merge branch 'master' into feature/esfm
Kagamiin Oct 17, 2023
a01ddd3
Implement ESFM macros
Kagamiin Oct 17, 2023
6ce2fd0
Adding ESFM letter-style instrument icon
Kagamiin Oct 17, 2023
821b567
Updating ESFMu with envelope delay fix; fixing macro op ordering
Kagamiin Oct 18, 2023
a1b7e52
Implementing pattern effects, detune on FM preview, default instrument
Kagamiin Oct 21, 2023
dde56c0
Merge branch 'master' into feature/esfm
Kagamiin Oct 21, 2023
64baa7c
Some refactoring
Kagamiin Oct 22, 2023
96fbd15
Updating ESFMu - accuracy improvements for noise mode
Kagamiin Oct 22, 2023
39f29f4
Small fix for potential undefined behavior in ESFM emulator
Kagamiin Oct 22, 2023
23b1c41
Fix hard reset handling; add detune effect; change some labels
Kagamiin Oct 24, 2023
b799383
Changing detune effect description for consistency
Kagamiin Oct 24, 2023
7d0eee7
Removing dash from system name
Kagamiin Oct 24, 2023
928ff5c
Removing placeholder
Kagamiin Oct 24, 2023
f25d254
Adding system presets for ESFM
Kagamiin Oct 25, 2023
6ae49e4
Rectifying ESFM preset name
Kagamiin Oct 25, 2023
91e6d84
Changing ESFM chip ID (0xd0 is taken)
Kagamiin Oct 25, 2023
d47fcd9
Adding placeholder for Namco C352
Kagamiin Oct 25, 2023
85db9ca
Merge branch 'master' into feature/esfm
Kagamiin Oct 25, 2023
59d56b1
Removing stray space
Kagamiin Oct 25, 2023
170248e
Code review suggestions
Kagamiin Oct 26, 2023
47c4273
Code review suggestions 2
Kagamiin Oct 26, 2023
4602427
Removing channel deactivaton upon note off
Kagamiin Oct 27, 2023
56d774b
Merge branch 'master' into feature/esfm
Kagamiin Nov 18, 2023
f42332f
Merge branch 'master' into feature/esfm
Kagamiin Dec 15, 2023
403799d
Updating sysDef; implementing mapVelocity
Kagamiin Dec 15, 2023
e32b45a
Changing mapVelocity to linear mapping
Kagamiin Dec 15, 2023
13e45cf
Merge branch 'master' into feature/esfm
Kagamiin Dec 17, 2023
71841aa
Updated mapVelocity; also changed back to MIDI standard
Kagamiin Dec 17, 2023
b6d632b
Adding text export fixtures for ESFM instruments
Kagamiin Dec 17, 2023
a25bc61
Reverting back to linear
Kagamiin Dec 17, 2023
215c8c3
Merge branch 'master' into feature/esfm
Kagamiin Jan 1, 2024
4459a7d
Implementing per-op arpeggio/pitch macro
Kagamiin Jan 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ res/docpdf/manual.pdf
res/docpdf/.venv
res/docpdf/htmldoc/
res/furnace.appdata.xml
compile_commands.json
tildearrow marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ extern/Nuked-PSG/ympsg.c
extern/opm/opm.c
extern/Nuked-OPLL/opll.c
extern/opl/opl3.c
extern/ESFMu/esfm.c
extern/ESFMu/esfm_registers.c

src/pch.cpp

Expand Down Expand Up @@ -695,6 +697,7 @@ src/engine/platform/pv1000.cpp
src/engine/platform/k053260.cpp
src/engine/platform/ted.cpp
src/engine/platform/c140.cpp
src/engine/platform/esfm.cpp
src/engine/platform/pcmdac.cpp
src/engine/platform/dummy.cpp

Expand Down
2 changes: 2 additions & 0 deletions extern/ESFMu/.clangd
tildearrow marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CompileFlags:
Add: ["-xc", "-Wall", "-Wextra"]
1 change: 1 addition & 0 deletions extern/ESFMu/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test_scripts/*
504 changes: 504 additions & 0 deletions extern/ESFMu/LICENSE

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions extern/ESFMu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# ESFMu

An emulator for the ESS "ESFM" enhanced OPL3 clone, based on Nuke.YKT's **Nuked OPL3** and reverse-engineering efforts from the community.

## Acknowledgements

I'd like to thank:

- **Nuke.YKT**
- Developer of **Nuked OPL3**, which was the basis for **ESFMu**'s code and also a great learning resource on Yamaha FM synthesis for myself.
- Nuke.YKT also gives shoutouts on behalf of **Nuked OPL3** to:
>- MAME Development Team(Jarek Burczynski, Tatsuyuki Satoh):
> - Feedback and Rhythm part calculation information.
>- forums.submarine.org.uk(carbon14, opl3):
> - Tremolo and phase generator calculation information.
>- OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
> - OPL2 ROMs.
>- siliconpr0n.org(John McMaster, digshadow):
> - YMF262 and VRC VII decaps and die shots.
- **rainwarrior**
- For performing the initial research on ESFM drivers and documenting ESS's patent on native mode operator organization.
- **jwt27**
- For kickstarting the ESFM research project and compiling rainwarrior's findings and more in an accessible document ("ESFM Demystified").
- **pachuco/CatButts**
- For documenting ESS's patent on ESFM's feedback implementation, which was vital in getting **ESFMu**'s sound output to be accurate.
- And everybody who helped out with real hardware testing

## Usage

To use **ESFMu**:

- include the **esfm.h** header file into your source code
- include the **esfm.c** and **esfm_registers.c** files into your build and link process
- declare or allocate a variable of type `esfm_chip` somewhere in your code - this will hold the chip's state
- use the function interface defined in **esfm.h** to interact with the `esfm_chip` structure

## Function interface

If you're familiar with **Nuked OPL3**, you'll find many similarities in the function interface provided by **ESFMu**. There are a few things to point out, however:

### Buffered writes

Just like **Nuked OPL3**, **ESFMu** offers buffered register writes. However, it offers them in two flavors: "legacy" and fast.

The fast buffered register writes (`ESFM_write_reg_buffered_fast`) are recommended, since they offer minimal latency which is close to the behavior you'd get with the actual ESS drivers on Windows.

The "legacy" buffered register writes are only recommended for specific cases, such as programs seeking for a shortcut to emulate the write delays from some sound drivers.

### Port-level access

Unlike **Nuked OPL3**, **ESFMu** actually allows port-level access to the ESFM interface. This is relevant because the ESFM port interface is actually modal, meaning that its behavior changes depending on whether the chip is set to emulation (OPL3 compatibility) mode or native (ESFM) mode.

Using port-level access allows for applications to not need to keep track of whether the chip is in native mode or not, nor to perform the port handling logic on their side.

Applications that use the register-level access, on the other hand, need to take care to either stick to only one of the operating modes (either native or emulation), or handle the port mapping logic on their own side.

### Register readback

ESFM allows for register contents to be read back through its ports, and **ESFMu** implements this functionality, both via dedicated register read functions and via the port read interface.

Note that in ESFM, register contents can only be read back when the chip is set to native (ESFM) mode, not when the chip is in emulation mode (i.e. OPL3 compatibility mode).

## Licensing

**ESFMu** is highly based on **Nuked OPL3**, which is licensed under the GNU Lesser General Public License version 2.1 or later. Therefore, **ESFMu** is licensed under the same license.

If you'd like to obtain a grant to use **ESFMu** under different terms, you should get in contact with [Nuke.YKT](https://github.com/nukeykt) (author of **Nuked OPL3**) as well as with [Kagamiin~](https://github.com/Kagamiin) (yours truly).
Loading