This project is a Windows DLL wrapper around NukeyKT's cycle‑accurate OPL3 (YMF262) emulator.
The goal of this fork is to provide a simple and stable C API for applications that need real‑time OPL2/OPL3 FM synthesis, register‑level access, or audio sample generation.
The emulator core is kept mostly unmodified from the original Nuked‑OPL3 project.
Only "fake" timer emulation (for detection) and a lightweight DLL interface and supporting glue code have been added.
Emulators supporting the DLL:
- YAPE - a Commodore 264 family emulator for Windows (http://yape.homeserver.hu/)
- WinTVC - a Videoton TV Computer emulator for Windows (http://gaia.atilia.eu/downloads.html)
- Cycle‑accurate Yamaha YMF262 (OPL3) emulation
- Supports both OPL2 and OPL3 modes
- Real‑time PCM audio generation
- Register‑accurate read/write interface
- Adjustable sample rate and amplitude
- Simple C API suitable for any language that can load a DLL
- Single‑instance design for easy integration
void DLL_EXPORT oplCreate(unsigned int model, unsigned int replayFreq);
void DLL_EXPORT oplDestroy();
void DLL_EXPORT oplSetSampleRate(unsigned int sampleRate_);
void DLL_EXPORT oplSetModel(unsigned int model);
void DLL_EXPORT oplReset();
void DLL_EXPORT oplPause();
void DLL_EXPORT oplWriteReg(unsigned int reg, unsigned char value);
unsigned char DLL_EXPORT oplReadReg(unsigned int reg);
void DLL_EXPORT oplCalcSamples(short* buf, long count);
short DLL_EXPORT oplCalcSample();
void DLL_EXPORT oplSetAmp(unsigned int amp);
const DLL_EXPORT char* oplGetLibVersion();Creates and initializes the OPL emulator instance.
model = 0→ OPL2 modemodel = 1→ OPL3 modereplayFreq= internal update frequency (typically 49716 Hz)
Destroys the emulator instance and frees resources.
Sets the output PCM sample rate.
Switches between OPL2 and OPL3 modes.
Sets output amplitude scaling.
Resets the chip to its power‑on state.
Pauses audio generation without destroying state.
Writes a value to an OPL register.
Reads back the last written value of an OPL register.
Generates count samples of 16‑bit signed PCM audio into buf.
Generates and returns a single PCM sample.
Returns a static version string for the DLL.
The DLL can be built using:
- Microsoft Visual Studio
- MinGW‑w64
- Clang‑CL
No external dependencies are required.
This fork follows the original Nuked‑OPL3 license (LGPL). Please refer to the upstream project for licensing details.
Nuked‑OPL3 by NukeyKT
https://github.com/nukeykt/Nuked-OPL3