Skip to content

Add YM2414 (OPZ) support via ymfm#145

Merged
ValleyBell merged 3 commits intoValleyBell:masterfrom
vampirefrog:add-ymfm-opz-support
Feb 15, 2026
Merged

Add YM2414 (OPZ) support via ymfm#145
ValleyBell merged 3 commits intoValleyBell:masterfrom
vampirefrog:add-ymfm-opz-support

Conversation

@vampirefrog
Copy link
Contributor

Adds YM2414 (OPZ) emulation support using the ymfm library from https://github.com/aaronsgiles/ymfm.

Changes

  • New Device: Added DEVID_YM2414 (0x30) for YM2414 (OPZ) chip
  • Vendored ymfm: Included ymfm source files (commit 17decfa) in emu/cores/ymfm/
    • ymfm.h - Core infrastructure
    • ymfm_opz.h - YM2414 implementation
    • ymfm_fm.h/ipp - FM engine base
  • C++ Wrapper: Created ymfmintf.cpp/h with C interface following libvgm patterns
  • Build Integration: Updated CMakeLists.txt and Makefile
  • Device Registration: Registered in SoundEmu.c

YM2414 (OPZ) Specifications

  • Channels: 8 FM channels
  • Operators: 4 operators per channel (32 total)
  • Usage: Yamaha TX81Z, DX11, YS200 synthesizers
  • Emulation Core: ymfm (BSD-3-Clause licensed)

Design

The implementation follows existing libvgm patterns (similar to ICS2115 integration) and is designed to support future ymfm chip additions (YM2612/OPN2, YM2151/OPM, OPLL, etc.) with shared infrastructure.

Building

Enable YM2414 support:

cmake -DSNDEMU_YM2414_YMFM=ON
# or
cmake -DSNDEMU__ALL=ON

vampirefrog and others added 2 commits December 31, 2025 01:16
- Add DEVID_YM2414 (0x30) device ID
- Vendor ymfm source files (commit 17decfa) in emu/cores/ymfm/
  - ymfm.h - Core infrastructure
  - ymfm_opz.h - YM2414 (OPZ) implementation
  - ymfm_fm.h/ipp - FM engine
- Create C++ wrapper (ymfmintf.cpp/h) with extern C interface
- Integrate into build system (CMakeLists.txt, Makefile)
- Register device in SoundEmu.c
- YM2414 specs: 8 FM channels, 4 operators per channel
- Used in Yamaha TX81Z, DX11, YS200 synthesizers

The implementation follows existing patterns (similar to ICS2115) and is
designed to support future ymfm chip additions (OPN, OPM, OPLL, etc.).
- Add ymfm_opz.cpp to build (vendored from ymfm library)
- Include ymfm_fm.h and ymfm_fm.ipp for template instantiation
- Add opz_test.cpp to generate test WAV file with FM synthesis
- Fix key on/off control (bit 6 of register 0x20)
- Adjust audio output scaling for proper volume

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ValleyBell
Copy link
Owner

Seems to look fine so far. I may merge it later. (not right now, as I have a few things that I want to do a few other things before adding new chips)

Also, can you please remove the opz_test.cpp file from the PR?

@vampirefrog
Copy link
Contributor Author

Thanks. I just needed OPZ to be available in the emu lib so I can use it with fmtoy. Let me know if you want me to add te other ymfm cores to the existing chips (as alternate cores), in a separate PR.

@ValleyBell ValleyBell merged commit 6a5daaf into ValleyBell:master Feb 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants