1
0
Fork 0

Add Nuked OPL3 emulator v1.8

Set oplemu to nuked in config file. Also set oplrate and mixer rate
to 49716 for best sound quality.

Changelog for v1.8:

- New envelope generator.
- Rhythm mode emulation is 100% correct now.

Vogons thread: https://www.vogons.org/viewtopic.php?f=9&t=37782

Imported-from: https://www.vogons.org/viewtopic.php?p=661417#p661417
This commit is contained in:
Alexey Khokholov 2018-03-30 11:41:00 +02:00 committed by Patryk Obara
parent eaf6970dbd
commit 64b90ab930
5 changed files with 1558 additions and 5 deletions

View file

@ -27,6 +27,7 @@
#include "mapper.h"
#include "mem.h"
#include "dbopl.h"
#include "nukedopl.h"
#include "mame/emu.h"
#include "mame/fmopl.h"
@ -164,6 +165,42 @@ struct Handler : public Adlib::Handler {
}
namespace NukedOPL {
struct Handler : public Adlib::Handler {
opl3_chip chip;
Bit8u newm;
virtual void WriteReg( Bit32u reg, Bit8u val ) {
OPL3_WriteRegBuffered(&chip, (Bit16u)reg, val);
if (reg == 0x105)
newm = reg & 0x01;
}
virtual Bit32u WriteAddr( Bit32u port, Bit8u val ) {
Bit16u addr;
addr = val;
if ((port & 2) && (addr == 0x05 || newm)) {
addr |= 0x100;
}
return addr;
}
virtual void Generate( MixerChannel* chan, Bitu samples ) {
Bit16s buf[1024*2];
while( samples > 0 ) {
Bitu todo = samples > 1024 ? 1024 : samples;
samples -= todo;
OPL3_GenerateStream(&chip, buf, todo);
chan->AddSamples_s16( todo, buf );
}
}
virtual void Init( Bitu rate ) {
newm = 0;
OPL3_Reset(&chip, rate);
}
~Handler() {
}
};
}
#define RAW_SIZE 1024
@ -806,6 +843,9 @@ Module::Module(Section *configuration)
else {
handler = new MAMEOPL3::Handler();
}
}
else if (oplemu == "nuked") {
handler = new NukedOPL::Handler();
} else {
handler = new DBOPL::Handler();
}