mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-22 04:25:11 +00:00
Merge pull request #2017 from tildearrow/ymf278b
Prepare to OPL4 support
This commit is contained in:
commit
e16bd903ef
32 changed files with 3110 additions and 279 deletions
|
@ -552,6 +552,7 @@ src/engine/platform/sound/nes/fds.c
|
|||
src/engine/platform/sound/nes/mmc5.c
|
||||
src/engine/platform/sound/vera_psg.c
|
||||
src/engine/platform/sound/vera_pcm.c
|
||||
src/engine/platform/sound/ymf278b/ymf278.cpp
|
||||
|
||||
src/engine/platform/sound/atomicssg/ssg.c
|
||||
|
||||
|
|
|
@ -590,6 +590,7 @@ size | description
|
|||
| - 11: 8-bit μ-law PCM
|
||||
| - 12: C219 PCM
|
||||
| - 13: IMA ADPCM
|
||||
| - 14: 12-bit PCM (MultiPCM)
|
||||
| - 16: 16-bit PCM
|
||||
1 | loop direction (>=123) or reserved
|
||||
| - 0: forward
|
||||
|
|
|
@ -582,6 +582,11 @@ size | description
|
|||
1 | LFO rate
|
||||
1 | vibrato depth
|
||||
1 | AM depth
|
||||
1 | flags (>=221)
|
||||
| - bit 0: damp
|
||||
| - bit 1: pseudo-reverb
|
||||
| - bit 2: LFO reset
|
||||
| - bit 3: level direct
|
||||
```
|
||||
|
||||
# Sound Unit data (SU)
|
||||
|
|
|
@ -268,6 +268,22 @@ enum DivDispatchCmds {
|
|||
|
||||
DIV_CMD_FM_OPMASK, // (mask)
|
||||
|
||||
DIV_CMD_MULTIPCM_MIX_FM, // (value)
|
||||
DIV_CMD_MULTIPCM_MIX_PCM, // (value)
|
||||
DIV_CMD_MULTIPCM_LFO, // (value)
|
||||
DIV_CMD_MULTIPCM_VIB, // (value)
|
||||
DIV_CMD_MULTIPCM_AM, // (value)
|
||||
DIV_CMD_MULTIPCM_AR, // (value)
|
||||
DIV_CMD_MULTIPCM_D1R, // (value)
|
||||
DIV_CMD_MULTIPCM_DL, // (value)
|
||||
DIV_CMD_MULTIPCM_D2R, // (value)
|
||||
DIV_CMD_MULTIPCM_RC, // (value)
|
||||
DIV_CMD_MULTIPCM_RR, // (value)
|
||||
DIV_CMD_MULTIPCM_DAMP, // (value)
|
||||
DIV_CMD_MULTIPCM_PSEUDO_REVERB, // (value)
|
||||
DIV_CMD_MULTIPCM_LFO_RESET, // (value)
|
||||
DIV_CMD_MULTIPCM_LEVEL_DIRECT, // (value)
|
||||
|
||||
DIV_CMD_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -768,6 +768,24 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
|
|||
case DIV_SYSTEM_SID2:
|
||||
dispatch=new DivPlatformSID2;
|
||||
break;
|
||||
case DIV_SYSTEM_OPL4:
|
||||
dispatch=new DivPlatformOPL;
|
||||
((DivPlatformOPL*)dispatch)->setOPLType(4,false);
|
||||
if (isRender) {
|
||||
((DivPlatformOPL*)dispatch)->setCore(eng->getConfInt("opl4CoreRender",0));
|
||||
} else {
|
||||
((DivPlatformOPL*)dispatch)->setCore(eng->getConfInt("opl4Core",0));
|
||||
}
|
||||
break;
|
||||
case DIV_SYSTEM_OPL4_DRUMS:
|
||||
dispatch=new DivPlatformOPL;
|
||||
((DivPlatformOPL*)dispatch)->setOPLType(4,true);
|
||||
if (isRender) {
|
||||
((DivPlatformOPL*)dispatch)->setCore(eng->getConfInt("opl4CoreRender",0));
|
||||
} else {
|
||||
((DivPlatformOPL*)dispatch)->setCore(eng->getConfInt("opl4Core",0));
|
||||
}
|
||||
break;
|
||||
case DIV_SYSTEM_DUMMY:
|
||||
dispatch=new DivPlatformDummy;
|
||||
break;
|
||||
|
|
|
@ -54,8 +54,8 @@ class DivWorkPool;
|
|||
|
||||
#define DIV_UNSTABLE
|
||||
|
||||
#define DIV_VERSION "dev220"
|
||||
#define DIV_ENGINE_VERSION 220
|
||||
#define DIV_VERSION "dev221"
|
||||
#define DIV_ENGINE_VERSION 221
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
|
@ -174,7 +174,11 @@ bool DivInstrumentMultiPCM::operator==(const DivInstrumentMultiPCM& other) {
|
|||
_C(rc) &&
|
||||
_C(lfo) &&
|
||||
_C(vib) &&
|
||||
_C(am)
|
||||
_C(am) &&
|
||||
_C(damp) &&
|
||||
_C(pseudoReverb) &&
|
||||
_C(lfoReset) &&
|
||||
_C(levelDirect)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -892,6 +896,14 @@ void DivInstrument::writeFeatureMP(SafeWriter* w) {
|
|||
w->writeC(multipcm.vib);
|
||||
w->writeC(multipcm.am);
|
||||
|
||||
unsigned char next=(
|
||||
(multipcm.damp?1:0)&
|
||||
(multipcm.pseudoReverb?2:0)&
|
||||
(multipcm.lfoReset?4:0)&
|
||||
(multipcm.levelDirect?8:0)
|
||||
);
|
||||
w->writeC(next);
|
||||
|
||||
FEATURE_END;
|
||||
}
|
||||
|
||||
|
@ -2218,6 +2230,14 @@ void DivInstrument::readFeatureMP(SafeReader& reader, short version) {
|
|||
multipcm.vib=reader.readC();
|
||||
multipcm.am=reader.readC();
|
||||
|
||||
if (version>=221) {
|
||||
unsigned char next=reader.readC();
|
||||
multipcm.damp=next&1;
|
||||
multipcm.pseudoReverb=next&2;
|
||||
multipcm.lfoReset=next&4;
|
||||
multipcm.levelDirect=next&8;
|
||||
}
|
||||
|
||||
READ_FEAT_END;
|
||||
}
|
||||
|
||||
|
@ -3492,4 +3512,4 @@ DivInstrument& DivInstrument::operator=( const DivInstrument& ins ) {
|
|||
*(DivInstrumentPOD*)this=ins;
|
||||
name=ins.name;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -612,6 +612,7 @@ struct DivInstrumentFDS {
|
|||
struct DivInstrumentMultiPCM {
|
||||
unsigned char ar, d1r, dl, d2r, rr, rc;
|
||||
unsigned char lfo, vib, am;
|
||||
bool damp, pseudoReverb, lfoReset, levelDirect;
|
||||
|
||||
bool operator==(const DivInstrumentMultiPCM& other);
|
||||
bool operator!=(const DivInstrumentMultiPCM& other) {
|
||||
|
@ -620,7 +621,11 @@ struct DivInstrumentMultiPCM {
|
|||
|
||||
DivInstrumentMultiPCM():
|
||||
ar(15), d1r(15), dl(0), d2r(0), rr(15), rc(15),
|
||||
lfo(0), vib(0), am(0) {
|
||||
lfo(0), vib(0), am(0),
|
||||
damp(false),
|
||||
pseudoReverb(false),
|
||||
lfoReset(false),
|
||||
levelDirect(true) {
|
||||
}
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,24 +29,41 @@ extern "C" {
|
|||
}
|
||||
#include "sound/ymfm/ymfm_adpcm.h"
|
||||
#include "sound/ymfm/ymfm_opl.h"
|
||||
#include "sound/ymfm/ymfm_pcm.h"
|
||||
#include "sound/ymf278b/ymf278.h"
|
||||
|
||||
class DivOPLAInterface: public ymfm::ymfm_interface {
|
||||
public:
|
||||
unsigned char* adpcmBMem;
|
||||
unsigned char* pcmMem;
|
||||
int sampleBank;
|
||||
uint8_t ymfm_external_read(ymfm::access_class type, uint32_t address);
|
||||
void ymfm_external_write(ymfm::access_class type, uint32_t address, uint8_t data);
|
||||
DivOPLAInterface(): adpcmBMem(NULL), sampleBank(0) {}
|
||||
DivOPLAInterface(): adpcmBMem(NULL), pcmMem(NULL), sampleBank(0) {}
|
||||
};
|
||||
|
||||
class DivYMF278MemoryInterface: public MemoryInterface {
|
||||
public:
|
||||
unsigned char* memory;
|
||||
DivYMF278MemoryInterface(unsigned size_) : memory(NULL), size(size_) {};
|
||||
byte operator[](unsigned address) const override;
|
||||
unsigned getSize() const override { return size; };
|
||||
void write(unsigned address, byte value) override {};
|
||||
void clear(byte value) override {};
|
||||
private:
|
||||
unsigned size;
|
||||
};
|
||||
|
||||
class DivPlatformOPL: public DivDispatch {
|
||||
protected:
|
||||
struct Channel: public SharedChannel<int> {
|
||||
DivInstrumentFM state;
|
||||
unsigned char freqH, freqL;
|
||||
unsigned int freqH, freqL;
|
||||
int sample, fixedFreq;
|
||||
bool furnacePCM, fourOp, hardReset;
|
||||
unsigned char pan;
|
||||
bool furnacePCM, fourOp, hardReset, writeCtrl;
|
||||
bool levelDirect, damp, pseudoReverb, lfoReset, ch;
|
||||
int lfo, vib, am, ar, d1r, d2r, dl, rc, rr;
|
||||
int pan;
|
||||
int macroVolMul;
|
||||
Channel():
|
||||
SharedChannel<int>(0),
|
||||
|
@ -57,14 +74,29 @@ class DivPlatformOPL: public DivDispatch {
|
|||
furnacePCM(false),
|
||||
fourOp(false),
|
||||
hardReset(false),
|
||||
writeCtrl(false),
|
||||
levelDirect(true),
|
||||
damp(false),
|
||||
pseudoReverb(false),
|
||||
lfoReset(false),
|
||||
ch(false),
|
||||
lfo(0),
|
||||
vib(0),
|
||||
am(0),
|
||||
ar(15),
|
||||
d1r(15),
|
||||
d2r(0),
|
||||
dl(0),
|
||||
rc(15),
|
||||
rr(15),
|
||||
pan(3),
|
||||
macroVolMul(64) {
|
||||
state.ops=2;
|
||||
}
|
||||
};
|
||||
Channel chan[20];
|
||||
DivDispatchOscBuffer* oscBuf[20];
|
||||
bool isMuted[20];
|
||||
Channel chan[44];
|
||||
DivDispatchOscBuffer* oscBuf[44];
|
||||
bool isMuted[44];
|
||||
struct QueuedWrite {
|
||||
unsigned short addr;
|
||||
unsigned char val;
|
||||
|
@ -72,7 +104,7 @@ class DivPlatformOPL: public DivDispatch {
|
|||
QueuedWrite(): addr(0), val(0), addrOrVal(false) {}
|
||||
QueuedWrite(unsigned short a, unsigned char v): addr(a), val(v), addrOrVal(false) {}
|
||||
};
|
||||
FixedQueue<QueuedWrite,2048> writes;
|
||||
FixedQueue<QueuedWrite,4096> writes;
|
||||
|
||||
unsigned int dacVal;
|
||||
unsigned int dacVal2;
|
||||
|
@ -86,8 +118,12 @@ class DivPlatformOPL: public DivDispatch {
|
|||
|
||||
unsigned char* adpcmBMem;
|
||||
size_t adpcmBMemLen;
|
||||
unsigned char* pcmMem;
|
||||
size_t pcmMemLen;
|
||||
DivOPLAInterface iface;
|
||||
DivYMF278MemoryInterface pcmMemory;
|
||||
unsigned int sampleOffB[256];
|
||||
unsigned int sampleOffPCM[256];
|
||||
bool sampleLoaded[256];
|
||||
|
||||
ymfm::adpcm_b_engine* adpcmB;
|
||||
|
@ -97,12 +133,13 @@ class DivPlatformOPL: public DivDispatch {
|
|||
const unsigned short* chanMap;
|
||||
const unsigned char* outChanMap;
|
||||
int chipFreqBase, chipRateBase;
|
||||
int delay, chipType, oplType, chans, melodicChans, totalChans, adpcmChan, sampleBank, totalOutputs;
|
||||
int delay, chipType, oplType, chans, melodicChans, totalChans, adpcmChan=-1, pcmChanOffs=-1, sampleBank, totalOutputs, ramSize;
|
||||
int fmMixL=7, fmMixR=7, pcmMixL=7, pcmMixR=7;
|
||||
unsigned char lastBusy;
|
||||
unsigned char drumState;
|
||||
unsigned char drumVol[5];
|
||||
|
||||
unsigned char regPool[512];
|
||||
unsigned char regPool[768];
|
||||
|
||||
bool properDrums, properDrumsSys, dam, dvb;
|
||||
|
||||
|
@ -115,15 +152,17 @@ class DivPlatformOPL: public DivDispatch {
|
|||
|
||||
bool update4OpMask, pretendYMU, downsample, compatPan;
|
||||
|
||||
short oldWrites[512];
|
||||
short pendingWrites[512];
|
||||
short oldWrites[768];
|
||||
short pendingWrites[768];
|
||||
|
||||
// chips
|
||||
opl3_chip fm;
|
||||
YMF278 pcm;
|
||||
ymfm::ym3526* fm_ymfm1;
|
||||
ymfm::ym3812* fm_ymfm2;
|
||||
ymfm::y8950* fm_ymfm8950;
|
||||
ymfm::ymf262* fm_ymfm3;
|
||||
ymfm::ymf278b* fm_ymfm4;
|
||||
fmopl2_t fm_lle2;
|
||||
fmopl3_t fm_lle3;
|
||||
|
||||
|
@ -141,6 +180,7 @@ class DivPlatformOPL: public DivDispatch {
|
|||
void acquire_nukedLLE3(short** buf, size_t len);
|
||||
void acquire_nuked(short** buf, size_t len);
|
||||
void acquire_ymfm3(short** buf, size_t len);
|
||||
void acquire_ymfm4(short** buf, size_t len);
|
||||
void acquire_ymfm8950(short** buf, size_t len);
|
||||
void acquire_ymfm2(short** buf, size_t len);
|
||||
void acquire_ymfm1(short** buf, size_t len);
|
||||
|
@ -182,6 +222,9 @@ class DivPlatformOPL: public DivDispatch {
|
|||
void renderSamples(int chipID);
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
void quit();
|
||||
DivPlatformOPL():
|
||||
pcmMemory(0x400000),
|
||||
pcm(pcmMemory) {}
|
||||
~DivPlatformOPL();
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,11 @@ uint8_t DivOPLAInterface::ymfm_external_read(ymfm::access_class type, uint32_t a
|
|||
return 0;
|
||||
}
|
||||
return adpcmBMem[address&0x3ffff];
|
||||
case ymfm::ACCESS_PCM:
|
||||
if (pcmMem==NULL) {
|
||||
return 0;
|
||||
}
|
||||
return pcmMem[address&0x3fffff];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -36,3 +41,10 @@ uint8_t DivOPLAInterface::ymfm_external_read(ymfm::access_class type, uint32_t a
|
|||
|
||||
void DivOPLAInterface::ymfm_external_write(ymfm::access_class type, uint32_t address, uint8_t data) {
|
||||
}
|
||||
|
||||
byte DivYMF278MemoryInterface::operator[](unsigned address) const {
|
||||
if (memory && address<size) {
|
||||
return memory[address];
|
||||
}
|
||||
return 0;
|
||||
}
|
339
src/engine/platform/sound/ymf278b/License.txt
Normal file
339
src/engine/platform/sound/ymf278b/License.txt
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
1094
src/engine/platform/sound/ymf278b/ymf278.cpp
Normal file
1094
src/engine/platform/sound/ymf278b/ymf278.cpp
Normal file
File diff suppressed because it is too large
Load diff
155
src/engine/platform/sound/ymf278b/ymf278.h
Normal file
155
src/engine/platform/sound/ymf278b/ymf278.h
Normal file
|
@ -0,0 +1,155 @@
|
|||
#ifndef YMF278_HH
|
||||
#define YMF278_HH
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#define UNREACHABLE while (1) assert(false)
|
||||
|
||||
using byte = uint8_t;
|
||||
|
||||
template<typename T>
|
||||
const T& YMF_clamp(const T& value, const T& min, const T& max) {
|
||||
return std::min(std::max(value, min), max);
|
||||
}
|
||||
|
||||
class MemoryInterface {
|
||||
public:
|
||||
virtual byte operator[](unsigned address) const = 0;
|
||||
virtual unsigned getSize() const = 0;
|
||||
virtual void write(unsigned address, byte value) = 0;
|
||||
virtual void clear(byte value) = 0;
|
||||
virtual void setMemoryType(bool memoryType) {};
|
||||
};
|
||||
|
||||
class YMF278Base
|
||||
{
|
||||
public:
|
||||
YMF278Base(MemoryInterface& memory, int channelCount, int clockDivider, double clockFrequency);
|
||||
~YMF278Base();
|
||||
int getChannelCount();
|
||||
int getClockDivider();
|
||||
double getClockFrequency();
|
||||
void setClockFrequency(double clockFrequency);
|
||||
double getSampleRate();
|
||||
virtual void reset();
|
||||
|
||||
void generate(short& fleft, short& fright, short& rleft, short& rright, short* channelBufs = nullptr);
|
||||
|
||||
class Slot final {
|
||||
public:
|
||||
Slot();
|
||||
void reset();
|
||||
int compute_rate(int val) const;
|
||||
int compute_decay_rate(int val) const;
|
||||
unsigned decay_rate(int num, int sample_rate);
|
||||
void envelope_next(int sample_rate);
|
||||
int16_t compute_vib() const;
|
||||
uint16_t compute_am() const;
|
||||
|
||||
template<typename Archive>
|
||||
void serialize(Archive& ar, unsigned version);
|
||||
|
||||
uint32_t startaddr;
|
||||
uint16_t loopaddr;
|
||||
uint16_t endaddr; // Note: stored in 2s complement (0x0000 = 0, 0x0001 = -65536, 0xffff = -1)
|
||||
uint32_t step; // fixed-point frequency step
|
||||
// invariant: step == calcStep(OCT, FN)
|
||||
uint32_t stepptr; // fixed-point pointer into the sample
|
||||
uint16_t pos;
|
||||
|
||||
int16_t env_vol;
|
||||
|
||||
uint32_t lfo_cnt;
|
||||
|
||||
int16_t DL;
|
||||
uint16_t wave; // wavetable number
|
||||
uint16_t FN; // f-number TODO store 'FN | 1024'?
|
||||
int8_t OCT; // octave [-8..+7]
|
||||
bool PRVB; // pseudo-reverb
|
||||
uint8_t TLdest; // destination total level
|
||||
uint8_t TL; // total level (goes towards TLdest)
|
||||
uint8_t pan; // panpot 0..15
|
||||
bool ch; // channel select
|
||||
bool keyon; // slot keyed on
|
||||
bool DAMP;
|
||||
uint8_t lfo; // LFO speed 0..7
|
||||
uint8_t vib; // vibrato 0..7
|
||||
uint8_t AM; // AM level 0..7
|
||||
uint8_t AR; // 0..15
|
||||
uint8_t D1R; // 0..15
|
||||
uint8_t D2R; // 0..15
|
||||
uint8_t RC; // rate correction 0..15
|
||||
uint8_t RR; // 0..15
|
||||
|
||||
uint8_t bits; // width of the samples
|
||||
|
||||
uint8_t state; // envelope generator state
|
||||
bool lfo_active;
|
||||
};
|
||||
|
||||
protected:
|
||||
void keyOnHelper(Slot& slot);
|
||||
|
||||
MemoryInterface& memory;
|
||||
std::vector<Slot> slots;
|
||||
|
||||
private:
|
||||
int16_t getSample(Slot& slot, uint16_t pos) const;
|
||||
static uint16_t nextPos(Slot& slot, uint16_t pos, uint16_t increment);
|
||||
void advance();
|
||||
bool anyActive();
|
||||
|
||||
/** Global envelope generator counter. */
|
||||
unsigned eg_cnt;
|
||||
|
||||
unsigned channelCount, clockDivider;
|
||||
double clockFrequency;
|
||||
};
|
||||
|
||||
class YMF278 final : public YMF278Base {
|
||||
public:
|
||||
YMF278(MemoryInterface& memory);
|
||||
void reset() override;
|
||||
void writeReg(byte reg, byte data);
|
||||
byte readReg(byte reg);
|
||||
byte peekReg(byte reg) const;
|
||||
|
||||
void generateMix(short fmL, short fmR, short& bufFL, short& bufFR, short& bufRL, short& bufRR, short* channelBufs = nullptr) {
|
||||
generate(bufFL, bufFR, bufRL, bufRR, channelBufs);
|
||||
bufFL = std::min(std::max((pcmMixL * bufFL + fmMixL * fmL) >> 4, -0x8000), 0x7fff);
|
||||
bufFR = std::min(std::max((pcmMixR * bufFR + fmMixR * fmR) >> 4, -0x8000), 0x7fff);;
|
||||
}
|
||||
|
||||
private:
|
||||
int fmMixL, fmMixR, pcmMixL, pcmMixR;
|
||||
int memAdr;
|
||||
byte regs[256];
|
||||
};
|
||||
|
||||
class YMW258 final : public YMF278Base {
|
||||
public:
|
||||
YMW258(MemoryInterface& memory);
|
||||
void writeReg(byte channel, byte reg, byte data);
|
||||
};
|
||||
|
||||
class MemoryMoonSound : MemoryInterface {
|
||||
public:
|
||||
MemoryMoonSound(MemoryInterface& rom, MemoryInterface& ram);
|
||||
byte operator[](unsigned address) const override;
|
||||
unsigned getSize() const override;
|
||||
void write(unsigned address, byte value) override;
|
||||
void clear(byte value) override;
|
||||
void setMemoryType(bool memoryType) override;
|
||||
|
||||
private:
|
||||
unsigned getRamAddress(unsigned addr) const;
|
||||
|
||||
MemoryInterface& rom;
|
||||
MemoryInterface& ram;
|
||||
|
||||
bool memoryType;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -304,9 +304,9 @@ public:
|
|||
|
||||
// simple getters for debugging
|
||||
fm_operator<RegisterType> *debug_operator(uint32_t index) const { return m_op[index]; }
|
||||
int32_t debug_output(uint32_t index) const { return m_output[index]; }
|
||||
int32_t debug_special1() const { return m_special1; }
|
||||
int32_t debug_special2() const { return m_special2; }
|
||||
int32_t debug_output(uint32_t index) const { return m_output[index]; }
|
||||
int32_t debug_special1() const { return m_special1; }
|
||||
int32_t debug_special2() const { return m_special2; }
|
||||
|
||||
private:
|
||||
// helper to add values to the outputs based on channel enables
|
||||
|
@ -320,21 +320,21 @@ private:
|
|||
constexpr int out3_index = 3 % RegisterType::OUTPUTS;
|
||||
|
||||
if (RegisterType::OUTPUTS == 1 || m_regs.ch_output_0(choffs)) {
|
||||
m_output[out0_index]=value;
|
||||
m_output[out0_index]=value;
|
||||
output.data[out0_index] += value;
|
||||
}
|
||||
}
|
||||
if (RegisterType::OUTPUTS >= 2 && m_regs.ch_output_1(choffs)) {
|
||||
m_output[out1_index]=value;
|
||||
m_output[out1_index]=value;
|
||||
output.data[out1_index] += value;
|
||||
}
|
||||
}
|
||||
if (RegisterType::OUTPUTS >= 3 && m_regs.ch_output_2(choffs)) {
|
||||
m_output[out2_index]=value;
|
||||
m_output[out2_index]=value;
|
||||
output.data[out2_index] += value;
|
||||
}
|
||||
}
|
||||
if (RegisterType::OUTPUTS >= 4 && m_regs.ch_output_3(choffs)) {
|
||||
m_output[out3_index]=value;
|
||||
m_output[out3_index]=value;
|
||||
output.data[out3_index] += value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// internal state
|
||||
|
@ -344,9 +344,9 @@ private:
|
|||
fm_operator<RegisterType> *m_op[4]; // up to 4 operators
|
||||
RegisterType &m_regs; // direct reference to registers
|
||||
fm_engine_base<RegisterType> &m_owner; // reference to the owning engine
|
||||
mutable int32_t m_output[4];
|
||||
mutable int32_t m_special1;
|
||||
mutable int32_t m_special2;
|
||||
mutable int32_t m_output[4];
|
||||
mutable int32_t m_special1;
|
||||
mutable int32_t m_special2;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ public:
|
|||
// generate samples of sound
|
||||
void generate(output_data *output, uint32_t numsamples = 1);
|
||||
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
protected:
|
||||
// internal state
|
||||
uint8_t m_address; // address register
|
||||
|
@ -577,8 +577,8 @@ public:
|
|||
// generate samples of sound
|
||||
void generate(output_data *output, uint32_t numsamples = 1);
|
||||
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
adpcm_b_engine* debug_adpcm_b_engine() { return &m_adpcm_b; }
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
adpcm_b_engine* debug_adpcm_b_engine() { return &m_adpcm_b; }
|
||||
|
||||
protected:
|
||||
// internal state
|
||||
|
@ -628,7 +628,7 @@ public:
|
|||
// generate samples of sound
|
||||
void generate(output_data *output, uint32_t numsamples = 1);
|
||||
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
|
||||
protected:
|
||||
// internal state
|
||||
|
@ -677,7 +677,7 @@ public:
|
|||
// generate samples of sound
|
||||
void generate(output_data *output, uint32_t numsamples = 1);
|
||||
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
|
||||
protected:
|
||||
// internal state
|
||||
|
@ -791,6 +791,8 @@ public:
|
|||
// generate samples of sound
|
||||
void generate(output_data *output, uint32_t numsamples = 1);
|
||||
|
||||
fm_engine* debug_fm_engine() { return &m_fm; }
|
||||
pcm_engine* debug_pcm_engine() { return &m_pcm; }
|
||||
protected:
|
||||
// internal state
|
||||
uint16_t m_address; // address register
|
||||
|
|
|
@ -309,6 +309,7 @@ void pcm_channel::clock(uint32_t env_counter)
|
|||
|
||||
void pcm_channel::output(output_data &output) const
|
||||
{
|
||||
m_output[0] = m_output[1] = m_output[2] = m_output[3] = 0;
|
||||
// early out if the envelope is effectively off
|
||||
uint32_t envelope = m_env_attenuation;
|
||||
if (envelope > EG_QUIET)
|
||||
|
@ -340,6 +341,8 @@ void pcm_channel::output(output_data &output) const
|
|||
uint32_t outnum = m_regs.ch_output_channel(m_choffs) * 2;
|
||||
output.data[outnum + 0] += (lvol * sample) >> 15;
|
||||
output.data[outnum + 1] += (rvol * sample) >> 15;
|
||||
m_output[outnum + 0] = output.data[outnum + 0];
|
||||
m_output[outnum + 1] = output.data[outnum + 1];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -267,6 +267,8 @@ public:
|
|||
// load a new wavetable entry
|
||||
void load_wavetable();
|
||||
|
||||
int32_t debug_output(uint32_t index) const { return m_output[index]; }
|
||||
|
||||
private:
|
||||
// internal helpers
|
||||
void start_attack();
|
||||
|
@ -291,6 +293,7 @@ private:
|
|||
pcm_cache m_cache; // cached data
|
||||
pcm_registers &m_regs; // reference to registers
|
||||
pcm_engine &m_owner; // reference to our owner
|
||||
mutable int32_t m_output[4];
|
||||
};
|
||||
|
||||
|
||||
|
@ -331,6 +334,8 @@ public:
|
|||
// return a reference to our registers
|
||||
pcm_registers ®s() { return m_regs; }
|
||||
|
||||
// simple getters for debugging
|
||||
pcm_channel *debug_channel(uint32_t index) const { return m_channel[index].get(); }
|
||||
private:
|
||||
// internal state
|
||||
ymfm_interface &m_intf; // reference to the interface
|
||||
|
|
|
@ -266,7 +266,23 @@ const char* cmdName[]={
|
|||
|
||||
"FDS_MOD_AUTO",
|
||||
|
||||
"FM_OPMASK"
|
||||
"FM_OPMASK",
|
||||
|
||||
"MULTIPCM_MIX_FM",
|
||||
"MULTIPCM_MIX_PCM",
|
||||
"MULTIPCM_LFO",
|
||||
"MULTIPCM_VIB",
|
||||
"MULTIPCM_AM",
|
||||
"MULTIPCM_AR",
|
||||
"MULTIPCM_D1R",
|
||||
"MULTIPCM_DL",
|
||||
"MULTIPCM_D2R",
|
||||
"MULTIPCM_RR",
|
||||
"MULTIPCM_RC",
|
||||
"MULTIPCM_DAMP",
|
||||
"MULTIPCM_PSEUDO_REVERB",
|
||||
"MULTIPCM_LFO_RESET",
|
||||
"MULTIPCM_LEVEL_DIRECT"
|
||||
};
|
||||
|
||||
static_assert((sizeof(cmdName)/sizeof(void*))==DIV_CMD_MAX,"update cmdName!");
|
||||
|
|
|
@ -285,6 +285,9 @@ int DivSample::getSampleOffset(int offset, int length, DivSampleDepth depth) {
|
|||
case DIV_SAMPLE_DEPTH_IMA_ADPCM:
|
||||
off=(offset+1)/2;
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_12BIT:
|
||||
off=((offset*3)+1)/2;
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_16BIT:
|
||||
off=offset*2;
|
||||
break;
|
||||
|
@ -348,6 +351,10 @@ int DivSample::getSampleOffset(int offset, int length, DivSampleDepth depth) {
|
|||
off=(offset+1)/2;
|
||||
len=(length+1)/2;
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_12BIT:
|
||||
off=((offset*3)+1)/2;
|
||||
len=((length*3)+1)/2;
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_16BIT:
|
||||
off=offset*2;
|
||||
len=length*2;
|
||||
|
@ -409,6 +416,9 @@ int DivSample::getEndPosition(DivSampleDepth depth) {
|
|||
case DIV_SAMPLE_DEPTH_IMA_ADPCM:
|
||||
off=lengthIMA;
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_12BIT:
|
||||
off=length12;
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_16BIT:
|
||||
off=length16;
|
||||
break;
|
||||
|
@ -606,6 +616,12 @@ bool DivSample::initInternal(DivSampleDepth d, int count) {
|
|||
dataIMA=new unsigned char[lengthIMA];
|
||||
memset(dataIMA,0,lengthIMA);
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_12BIT: // 12-bit PCM (MultiPCM)
|
||||
if (data12!=NULL) delete[] data12;
|
||||
length12=((count*3)+1)/2;
|
||||
data12=new unsigned char[length12];
|
||||
memset(data12,0,length12);
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_16BIT: // 16-bit
|
||||
if (data16!=NULL) delete[] data16;
|
||||
length16=count*2;
|
||||
|
@ -1293,6 +1309,14 @@ void DivSample::render(unsigned int formatMask) {
|
|||
case DIV_SAMPLE_DEPTH_IMA_ADPCM: // IMA ADPCM
|
||||
if (adpcm_decode_block(data16,dataIMA,lengthIMA,samples)==0) logE("oh crap!");
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_12BIT: // 12-bit PCM (MultiPCM)
|
||||
for (unsigned int i=0,j=0; i<samples; i+=2,j+=3) {
|
||||
data16[i+0]=(data12[j+0]<<8)|(data12[j+1]&0xf0);
|
||||
if (i+1<samples) {
|
||||
data16[i+1]=(data12[j+2]<<8)|((data12[j+1]<<4)&0xf0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -1482,6 +1506,15 @@ void DivSample::render(unsigned int formatMask) {
|
|||
adpcm_free_context(codec);
|
||||
}
|
||||
}
|
||||
if (NOT_IN_FORMAT(DIV_SAMPLE_DEPTH_12BIT)) { // 12-bit PCM (MultiPCM)
|
||||
if (!initInternal(DIV_SAMPLE_DEPTH_12BIT,samples)) return;
|
||||
for (unsigned int i=0,j=0; i<samples; i+=2,j+=3) {
|
||||
data12[j+0]=data16[i+0]>>8;
|
||||
data12[j+1]=((data16[i+0]>>4)&0xf)|(i+1<samples?(data16[i+1]>>4)&0xf:0);
|
||||
if (i+1<samples)
|
||||
data12[j+2]=data16[i+1]>>8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void* DivSample::getCurBuf() {
|
||||
|
@ -1512,6 +1545,8 @@ void* DivSample::getCurBuf() {
|
|||
return dataC219;
|
||||
case DIV_SAMPLE_DEPTH_IMA_ADPCM:
|
||||
return dataIMA;
|
||||
case DIV_SAMPLE_DEPTH_12BIT:
|
||||
return data12;
|
||||
case DIV_SAMPLE_DEPTH_16BIT:
|
||||
return data16;
|
||||
default:
|
||||
|
@ -1548,6 +1583,8 @@ unsigned int DivSample::getCurBufLen() {
|
|||
return lengthC219;
|
||||
case DIV_SAMPLE_DEPTH_IMA_ADPCM:
|
||||
return lengthIMA;
|
||||
case DIV_SAMPLE_DEPTH_12BIT:
|
||||
return length12;
|
||||
case DIV_SAMPLE_DEPTH_16BIT:
|
||||
return length16;
|
||||
default:
|
||||
|
@ -1662,4 +1699,5 @@ DivSample::~DivSample() {
|
|||
if (dataMuLaw) delete[] dataMuLaw;
|
||||
if (dataC219) delete[] dataC219;
|
||||
if (dataIMA) delete[] dataIMA;
|
||||
if (data12) delete[] data12;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ enum DivSampleDepth: unsigned char {
|
|||
DIV_SAMPLE_DEPTH_MULAW=11,
|
||||
DIV_SAMPLE_DEPTH_C219=12,
|
||||
DIV_SAMPLE_DEPTH_IMA_ADPCM=13,
|
||||
DIV_SAMPLE_DEPTH_12BIT=14,
|
||||
DIV_SAMPLE_DEPTH_16BIT=16,
|
||||
DIV_SAMPLE_DEPTH_MAX // boundary for sample depth
|
||||
};
|
||||
|
@ -118,6 +119,7 @@ struct DivSample {
|
|||
// - 11: 8-bit µ-law PCM
|
||||
// - 12: C219 "µ-law" PCM
|
||||
// - 13: IMA ADPCM
|
||||
// - 14: 12-bit PCM (MultiPCM)
|
||||
// - 16: 16-bit PCM
|
||||
DivSampleDepth depth;
|
||||
bool loop, brrEmphasis, brrNoFilter, dither;
|
||||
|
@ -144,8 +146,9 @@ struct DivSample {
|
|||
unsigned char* dataMuLaw; // 11
|
||||
unsigned char* dataC219; // 12
|
||||
unsigned char* dataIMA; // 13
|
||||
unsigned char* data12; // 14
|
||||
|
||||
unsigned int length8, length16, length1, lengthDPCM, lengthZ, lengthQSoundA, lengthA, lengthB, lengthK, lengthBRR, lengthVOX, lengthMuLaw, lengthC219, lengthIMA;
|
||||
unsigned int length8, length16, length1, lengthDPCM, lengthZ, lengthQSoundA, lengthA, lengthB, lengthK, lengthBRR, lengthVOX, lengthMuLaw, lengthC219, lengthIMA, length12;
|
||||
|
||||
unsigned int samples;
|
||||
|
||||
|
@ -356,6 +359,7 @@ struct DivSample {
|
|||
dataMuLaw(NULL),
|
||||
dataC219(NULL),
|
||||
dataIMA(NULL),
|
||||
data12(NULL),
|
||||
length8(0),
|
||||
length16(0),
|
||||
length1(0),
|
||||
|
@ -370,6 +374,7 @@ struct DivSample {
|
|||
lengthMuLaw(0),
|
||||
lengthC219(0),
|
||||
lengthIMA(0),
|
||||
length12(0),
|
||||
samples(0) {
|
||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||
for (int j=0; j<DIV_MAX_SAMPLE_TYPE; j++) {
|
||||
|
|
|
@ -602,6 +602,25 @@ void DivEngine::registerSystems() {
|
|||
{0x5b, {DIV_CMD_FM_KSR, _("5Bxy: Set whether key will scale envelope (x: operator from 1 to 4 (0 for all ops); y: enabled)"), effectOpVal<4>, effectValAnd<1>}},
|
||||
};
|
||||
|
||||
EffectHandlerMap fmOPL4PostEffectHandlerMap(fmOPLPostEffectHandlerMap);
|
||||
fmOPL4PostEffectHandlerMap.insert({
|
||||
{0x1e, {DIV_CMD_MULTIPCM_MIX_FM, _("1Exy: FM global level (x: left, y: right; 0 to 7)"), effectVal}},
|
||||
{0x1f, {DIV_CMD_MULTIPCM_MIX_PCM, _("1Fxy: PCM global level (x: left, y: right; 0 to 7)"), effectVal}},
|
||||
{0x20, {DIV_CMD_MULTIPCM_LFO, _("20xx: PCM LFO Rate (0 to 7)"), effectValAnd<7>}},
|
||||
{0x21, {DIV_CMD_MULTIPCM_VIB, _("21xx: PCM LFO PM Depth (0 to 7)"), effectValAnd<7>}},
|
||||
{0x22, {DIV_CMD_MULTIPCM_AM, _("22xx: PCM LFO AM Depth (0 to 7)"), effectValAnd<7>}},
|
||||
{0x23, {DIV_CMD_MULTIPCM_AR, _("23xx: PCM Attack Rate (0 to 15)"), effectValAnd<15>}},
|
||||
{0x24, {DIV_CMD_MULTIPCM_D1R, _("24xx: PCM Decay 1 Rate (0 to 15)"), effectValAnd<15>}},
|
||||
{0x25, {DIV_CMD_MULTIPCM_DL, _("25xx: PCM Decay Level (0 to 15)"), effectValAnd<15>}},
|
||||
{0x26, {DIV_CMD_MULTIPCM_D2R, _("26xx: PCM Decay 2 Rate (0 to 15)"), effectValAnd<15>}},
|
||||
{0x27, {DIV_CMD_MULTIPCM_RR, _("27xx: PCM Release Rate (0 to 15)"), effectValAnd<15>}},
|
||||
{0x28, {DIV_CMD_MULTIPCM_RC, _("28xx: PCM Rate Correction (0 to 15)"), effectValAnd<15>}},
|
||||
{0x2c, {DIV_CMD_MULTIPCM_DAMP, _("2Cxx: PCM Damp"), effectValAnd<1>}},
|
||||
{0x2d, {DIV_CMD_MULTIPCM_PSEUDO_REVERB, _("2Dxx: PCM Pseudo Reverb"), effectValAnd<1>}},
|
||||
{0x2e, {DIV_CMD_MULTIPCM_LFO_RESET, _("2Exx: PCM LFO Reset"), effectValAnd<1>}},
|
||||
{0x2f, {DIV_CMD_MULTIPCM_LEVEL_DIRECT, _("2Fxx: PCM Level Direct"), effectValAnd<1>}},
|
||||
});
|
||||
|
||||
EffectHandlerMap c64PostEffectHandlerMap={
|
||||
{0x10, {DIV_CMD_WAVE, _("10xx: Set waveform (bit 0: triangle; bit 1: saw; bit 2: pulse; bit 3: noise)")}},
|
||||
{0x11, {DIV_CMD_C64_CUTOFF, _("11xx: Set coarse cutoff (not recommended; use 4xxx instead)")}},
|
||||
|
@ -1618,24 +1637,28 @@ void DivEngine::registerSystems() {
|
|||
);
|
||||
|
||||
// to Grauw: feel free to change this to 24 during development of OPL4's PCM part.
|
||||
// TODO: add 12-bit and 16-bit big-endian sample formats
|
||||
sysDefs[DIV_SYSTEM_OPL4]=new DivSysDef(
|
||||
_("Yamaha YMF278B (OPL4)"), NULL, 0xae, 0, 42, true, true, 0, false, (1U<<DIV_SAMPLE_DEPTH_8BIT)|(1U<<DIV_SAMPLE_DEPTH_16BIT), 0, 0,
|
||||
_("Yamaha YMF278B (OPL4)"), NULL, 0xae, 0, 42, true, true, 0x151, false, (1U<<DIV_SAMPLE_DEPTH_8BIT)|(1U<<DIV_SAMPLE_DEPTH_12BIT)|(1U<<DIV_SAMPLE_DEPTH_16BIT), 0, 0,
|
||||
_("like OPL3, but this time it also has a 24-channel version of MultiPCM."),
|
||||
{_("4OP 1"), _("FM 2"), _("4OP 3"), _("FM 4"), _("4OP 5"), _("FM 6"), _("4OP 7"), _("FM 8"), _("4OP 9"), _("FM 10"), _("4OP 11"), _("FM 12"), _("FM 13"), _("FM 14"), _("FM 15"), _("FM 16"), _("FM 17"), _("FM 18"), _("PCM 1"), _("PCM 2"), _("PCM 3"), _("PCM 4"), _("PCM 5"), _("PCM 6"), _("PCM 7"), _("PCM 8"), _("PCM 9"), _("PCM 10"), _("PCM 11"), _("PCM 12"), _("PCM 13"), _("PCM 14"), _("PCM 15"), _("PCM 16"), _("PCM 17"), _("PCM 18"), _("PCM 19"), _("PCM 20"), _("PCM 21"), _("PCM 22"), _("PCM 23"), _("PCM 24")},
|
||||
{"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P8", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P20", "P21", "P22", "P23", "P24"},
|
||||
{"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P20", "P21", "P22", "P23", "P24"},
|
||||
{DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_FM, DIV_CH_FM, DIV_CH_FM, DIV_CH_FM, DIV_CH_FM, DIV_CH_FM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM},
|
||||
{DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM}
|
||||
{DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM},
|
||||
{DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA},
|
||||
fmEffectHandlerMap,
|
||||
fmOPL4PostEffectHandlerMap
|
||||
);
|
||||
|
||||
// TODO: same here
|
||||
sysDefs[DIV_SYSTEM_OPL4_DRUMS]=new DivSysDef(
|
||||
_("Yamaha YMF278B (OPL4) with drums"), NULL, 0xaf, 0, 44, true, true, 0, false, (1U<<DIV_SAMPLE_DEPTH_8BIT)|(1U<<DIV_SAMPLE_DEPTH_16BIT), 0, 0,
|
||||
_("Yamaha YMF278B (OPL4) with drums"), NULL, 0xaf, 0, 44, true, true, 0x151, false, (1U<<DIV_SAMPLE_DEPTH_8BIT)|(1U<<DIV_SAMPLE_DEPTH_12BIT)|(1U<<DIV_SAMPLE_DEPTH_16BIT), 0, 0,
|
||||
_("the OPL4 but with drums mode turned on."),
|
||||
{_("4OP 1"), _("FM 2"), _("4OP 3"), _("FM 4"), _("4OP 5"), _("FM 6"), _("4OP 7"), _("FM 8"), _("4OP 9"), _("FM 10"), _("4OP 11"), _("FM 12"), _("FM 13"), _("FM 14"), _("FM 15"), _("Kick/FM 16"), _("Snare"), _("Tom"), _("Top"), _("HiHat"), _("PCM 1"), _("PCM 2"), _("PCM 3"), _("PCM 4"), _("PCM 5"), _("PCM 6"), _("PCM 7"), _("PCM 8"), _("PCM 9"), _("PCM 10"), _("PCM 11"), _("PCM 12"), _("PCM 13"), _("PCM 14"), _("PCM 15"), _("PCM 16"), _("PCM 17"), _("PCM 18"), _("PCM 19"), _("PCM 20"), _("PCM 21"), _("PCM 22"), _("PCM 23"), _("PCM 24")},
|
||||
{"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "BD", "SD", "TM", "TP", "HH", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P8", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P20", "P21", "P22", "P23", "P24"},
|
||||
{"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "BD", "SD", "TM", "TP", "HH", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P20", "P21", "P22", "P23", "P24"},
|
||||
{DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_OP, DIV_CH_FM, DIV_CH_FM, DIV_CH_FM, DIV_CH_FM, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM},
|
||||
{DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM}
|
||||
{DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM, DIV_INS_MULTIPCM},
|
||||
{DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_OPL, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA},
|
||||
fmOPLDrumsEffectHandlerMap,
|
||||
fmOPL4PostEffectHandlerMap
|
||||
);
|
||||
|
||||
EffectHandlerMap es5506PreEffectHandlerMap={
|
||||
|
|
|
@ -617,6 +617,96 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
|
|||
w->writeC(0);
|
||||
}
|
||||
break;
|
||||
case DIV_SYSTEM_OPL4:
|
||||
case DIV_SYSTEM_OPL4_DRUMS:
|
||||
// disable envelope
|
||||
for (int i=0; i<6; i++) {
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x00|baseAddr2);
|
||||
w->writeC(0x80+i);
|
||||
w->writeC(0x0f);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x00|baseAddr2);
|
||||
w->writeC(0x88+i);
|
||||
w->writeC(0x0f);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x00|baseAddr2);
|
||||
w->writeC(0x90+i);
|
||||
w->writeC(0x0f);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x01|baseAddr2);
|
||||
w->writeC(0x80+i);
|
||||
w->writeC(0x0f);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x01|baseAddr2);
|
||||
w->writeC(0x88+i);
|
||||
w->writeC(0x0f);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x01|baseAddr2);
|
||||
w->writeC(0x90+i);
|
||||
w->writeC(0x0f);
|
||||
}
|
||||
for (int i=0; i<24; i++) {
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0x80+i);
|
||||
w->writeC(0x00);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0x98+i);
|
||||
w->writeC(0x00);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0xb0+i);
|
||||
w->writeC(0x00);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0xc8+i);
|
||||
w->writeC(0x00);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0xe0+i);
|
||||
w->writeC(0x00);
|
||||
}
|
||||
// key off + freq reset
|
||||
for (int i=0; i<9; i++) {
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x00|baseAddr2);
|
||||
w->writeC(0xa0+i);
|
||||
w->writeC(0);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x00|baseAddr2);
|
||||
w->writeC(0xb0+i);
|
||||
w->writeC(0);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x01|baseAddr2);
|
||||
w->writeC(0xa0+i);
|
||||
w->writeC(0);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x01|baseAddr2);
|
||||
w->writeC(0xb0+i);
|
||||
w->writeC(0);
|
||||
}
|
||||
for (int i=0; i<24; i++) {
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0x20+i);
|
||||
w->writeC(0);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0x38+i);
|
||||
w->writeC(0);
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x02|baseAddr2);
|
||||
w->writeC(0x68+i);
|
||||
w->writeC(8);
|
||||
}
|
||||
// reset 4-op
|
||||
w->writeC(0xd0);
|
||||
w->writeC(0x01|baseAddr2);
|
||||
w->writeC(0x04);
|
||||
w->writeC(0x00);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1096,6 +1186,13 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
|
|||
w->writeS_BE(baseAddr2S|(write.addr&0x1ff));
|
||||
w->writeC(write.val&0xff);
|
||||
break;
|
||||
case DIV_SYSTEM_OPL4:
|
||||
case DIV_SYSTEM_OPL4_DRUMS:
|
||||
w->writeC(0xd0);
|
||||
w->writeC(((write.addr>>8)&0x7f)|baseAddr2);
|
||||
w->writeC(write.addr&0xff);
|
||||
w->writeC(write.val);
|
||||
break;
|
||||
default:
|
||||
logW("write not handled!");
|
||||
break;
|
||||
|
@ -1276,6 +1373,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
|
|||
DivDispatch* writeC140[2]={NULL,NULL};
|
||||
DivDispatch* writeC219[2]={NULL,NULL};
|
||||
DivDispatch* writeNES[2]={NULL,NULL};
|
||||
DivDispatch* writePCM_OPL4[2]={NULL,NULL};
|
||||
|
||||
int writeNESIndex[2]={0,0};
|
||||
|
||||
|
@ -1874,6 +1972,22 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
|
|||
howManyChips++;
|
||||
}
|
||||
break;
|
||||
case DIV_SYSTEM_OPL4:
|
||||
case DIV_SYSTEM_OPL4_DRUMS:
|
||||
if (!hasOPL4) {
|
||||
hasOPL4=disCont[i].dispatch->chipClock;
|
||||
CHIP_VOL(13,1.0);
|
||||
willExport[i]=true;
|
||||
writePCM_OPL4[0]=disCont[i].dispatch;
|
||||
} else if (!(hasOPL4&0x40000000)) {
|
||||
isSecond[i]=true;
|
||||
CHIP_VOL_SECOND(13,1.0);
|
||||
willExport[i]=true;
|
||||
writePCM_OPL4[1]=disCont[i].dispatch;
|
||||
hasOPL4|=0x40000000;
|
||||
howManyChips++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2209,6 +2323,16 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
|
|||
w->write(sampleMem,sampleMemLen);
|
||||
delete[] sampleMem;
|
||||
}
|
||||
// PCM (OPL4)
|
||||
if (writePCM_OPL4[i]!=NULL && writePCM_OPL4[i]->getSampleMemUsage(0)>0) {
|
||||
w->writeC(0x67);
|
||||
w->writeC(0x66);
|
||||
w->writeC(0x84);
|
||||
w->writeI((writePCM_OPL4[i]->getSampleMemUsage(0)+8)|(i*0x80000000));
|
||||
w->writeI(writePCM_OPL4[i]->getSampleMemCapacity(0));
|
||||
w->writeI(0);
|
||||
w->write(writePCM_OPL4[i]->getSampleMem(0),writePCM_OPL4[i]->getSampleMemUsage(0));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
|
|
|
@ -300,6 +300,7 @@ const char* aboutLine[]={
|
|||
_N("PowerNoise emulator by scratchminer"),
|
||||
_N("ep128emu by Istvan Varga"),
|
||||
_N("NDS sound emulator by cam900"),
|
||||
_N("openMSX YMF278 emulator (modified version) by the openMSX developers"),
|
||||
"",
|
||||
_N("greetings to:"),
|
||||
"floxy!",
|
||||
|
|
|
@ -1772,6 +1772,7 @@ class FurnaceGUI {
|
|||
int opnbCore;
|
||||
int opl2Core;
|
||||
int opl3Core;
|
||||
int opl4Core;
|
||||
int esfmCore;
|
||||
int opllCore;
|
||||
int ayCore;
|
||||
|
@ -1798,6 +1799,7 @@ class FurnaceGUI {
|
|||
int opnbCoreRender;
|
||||
int opl2CoreRender;
|
||||
int opl3CoreRender;
|
||||
int opl4CoreRender;
|
||||
int esfmCoreRender;
|
||||
int opllCoreRender;
|
||||
int ayCoreRender;
|
||||
|
@ -2032,6 +2034,7 @@ class FurnaceGUI {
|
|||
opnbCore(1),
|
||||
opl2Core(0),
|
||||
opl3Core(0),
|
||||
opl4Core(0),
|
||||
esfmCore(0),
|
||||
opllCore(0),
|
||||
ayCore(0),
|
||||
|
@ -2058,6 +2061,7 @@ class FurnaceGUI {
|
|||
opnbCoreRender(1),
|
||||
opl2CoreRender(0),
|
||||
opl3CoreRender(0),
|
||||
opl4CoreRender(0),
|
||||
esfmCoreRender(0),
|
||||
opllCoreRender(0),
|
||||
ayCoreRender(0),
|
||||
|
|
|
@ -210,7 +210,7 @@ const char* sampleDepths[DIV_SAMPLE_DEPTH_MAX]={
|
|||
"8-bit µ-law PCM",
|
||||
"C219 PCM",
|
||||
"IMA ADPCM",
|
||||
NULL,
|
||||
"12-bit PCM",
|
||||
NULL,
|
||||
"16-bit PCM"
|
||||
};
|
||||
|
@ -1270,6 +1270,8 @@ const int availableSystems[]={
|
|||
DIV_SYSTEM_5E01,
|
||||
DIV_SYSTEM_BIFURCATOR,
|
||||
DIV_SYSTEM_SID2,
|
||||
DIV_SYSTEM_OPL4,
|
||||
DIV_SYSTEM_OPL4_DRUMS,
|
||||
DIV_SYSTEM_SUPERVISION,
|
||||
DIV_SYSTEM_UPD1771C,
|
||||
0 // don't remove this last one!
|
||||
|
@ -1307,6 +1309,8 @@ const int chipsFM[]={
|
|||
DIV_SYSTEM_OPL3_DRUMS,
|
||||
DIV_SYSTEM_OPZ,
|
||||
DIV_SYSTEM_ESFM,
|
||||
DIV_SYSTEM_OPL4,
|
||||
DIV_SYSTEM_OPL4_DRUMS,
|
||||
0 // don't remove this last one!
|
||||
};
|
||||
|
||||
|
@ -1394,6 +1398,8 @@ const int chipsSample[]={
|
|||
DIV_SYSTEM_NDS,
|
||||
DIV_SYSTEM_GBA_DMA,
|
||||
DIV_SYSTEM_GBA_MINMOD,
|
||||
DIV_SYSTEM_OPL4,
|
||||
DIV_SYSTEM_OPL4_DRUMS,
|
||||
0 // don't remove this last one!
|
||||
};
|
||||
|
||||
|
|
|
@ -6569,6 +6569,19 @@ void FurnaceGUI::drawInsEdit() {
|
|||
P(CWSliderScalar(_("AM Depth"),ImGuiDataType_U8,&ins->multipcm.am,&_ZERO,&_SEVEN)); rightClickable
|
||||
ImGui::EndTable();
|
||||
}
|
||||
P(ImGui::Checkbox(_("Damp"),&ins->multipcm.damp));
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(_("Only for OPL4 PCM."));
|
||||
}
|
||||
P(ImGui::Checkbox(_("Pseudo Reverb"),&ins->multipcm.pseudoReverb));
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(_("Only for OPL4 PCM."));
|
||||
}
|
||||
P(ImGui::Checkbox(_("LFO Reset"),&ins->multipcm.lfoReset));
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(_("Only for OPL4 PCM."));
|
||||
}
|
||||
P(ImGui::Checkbox(_("Level Direct"),&ins->multipcm.levelDirect));
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
@ -7262,6 +7275,9 @@ void FurnaceGUI::drawInsEdit() {
|
|||
macroList.push_back(FurnaceGUIMacroDesc(_("Panning"),&ins->std.panLMacro,-7,7,45,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("Pitch"),&ins->std.pitchMacro,-2048,2047,160,uiColors[GUI_COLOR_MACRO_PITCH],true,macroRelativeMode));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("Phase Reset"),&ins->std.phaseResetMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("LFO Speed"),&ins->std.ex1Macro,0,7,160,uiColors[GUI_COLOR_MACRO_OTHER]));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("LFO Vib Depth"),&ins->std.fmsMacro,0,7,160,uiColors[GUI_COLOR_MACRO_PITCH]));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("LFO AM Depth"),&ins->std.amsMacro,0,7,160,uiColors[GUI_COLOR_MACRO_VOLUME]));
|
||||
break;
|
||||
case DIV_INS_SNES:
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("Volume"),&ins->std.volMacro,0,127,160,uiColors[GUI_COLOR_MACRO_VOLUME]));
|
||||
|
|
|
@ -524,6 +524,18 @@ void FurnaceGUI::initSystemPresets() {
|
|||
) // variable rate, Mono DAC
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"MSX + MoonSound", {
|
||||
CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"),
|
||||
CH(DIV_SYSTEM_OPL4, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"MSX + MoonSound (drums mode)", {
|
||||
CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"),
|
||||
CH(DIV_SYSTEM_OPL4_DRUMS, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"NEC PC-6001", {
|
||||
CH(DIV_SYSTEM_AY8910, 1.0f, 0, "customClock=3993600")
|
||||
|
@ -1905,6 +1917,30 @@ void FurnaceGUI::initSystemPresets() {
|
|||
}
|
||||
);
|
||||
|
||||
ENTRY(
|
||||
"Psikyo", {}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Psikyo 68EC020 hardware with OPL4", {
|
||||
CH(DIV_SYSTEM_OPL4, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Psikyo 68EC020 hardware with OPL4 (drums mode)", {
|
||||
CH(DIV_SYSTEM_OPL4_DRUMS, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Psikyo SH-2 hardware", {
|
||||
CH(DIV_SYSTEM_OPL4, 1.0f, 0, "clockSel=1")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Psikyo SH-2 hardware (drums mode)", {
|
||||
CH(DIV_SYSTEM_OPL4_DRUMS, 1.0f, 0, "clockSel=1")
|
||||
}
|
||||
);
|
||||
|
||||
ENTRY(
|
||||
"Sega", {}
|
||||
);
|
||||
|
@ -2729,6 +2765,16 @@ void FurnaceGUI::initSystemPresets() {
|
|||
CH(DIV_SYSTEM_ESFM, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Yamaha YMF278B (OPL4)", {
|
||||
CH(DIV_SYSTEM_OPL4, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Yamaha YMF278B (drums mode)", {
|
||||
CH(DIV_SYSTEM_OPL4_DRUMS, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
if (settings.hiddenSystems) {
|
||||
ENTRY(
|
||||
"Yamaha YMU759 (MA-2)", {
|
||||
|
@ -2940,6 +2986,16 @@ void FurnaceGUI::initSystemPresets() {
|
|||
CH(DIV_SYSTEM_NDS, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Yamaha YMF278B (OPL4)", {
|
||||
CH(DIV_SYSTEM_OPL4, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
SUB_ENTRY(
|
||||
"Yamaha YMF278B (drums mode)", {
|
||||
CH(DIV_SYSTEM_OPL4_DRUMS, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
CATEGORY_END;
|
||||
|
||||
CATEGORY_BEGIN("Wavetable","chips which use user-specified waveforms to generate sound.");
|
||||
|
|
|
@ -413,6 +413,12 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
SAMPLE_WARN(warnLength,_("GBA DMA: sample length will be padded to multiple of 16"));
|
||||
}
|
||||
break;
|
||||
case DIV_SYSTEM_OPL4:
|
||||
case DIV_SYSTEM_OPL4_DRUMS:
|
||||
if (sample->samples>65535) {
|
||||
SAMPLE_WARN(warnLength,_("OPL4: maximum sample length is 65535"));
|
||||
}
|
||||
break;
|
||||
case DIV_SYSTEM_SUPERVISION:
|
||||
if (sample->loop) {
|
||||
if (sample->loopStart!=0 || sample->loopEnd!=(int)(sample->samples)) {
|
||||
|
|
|
@ -189,6 +189,11 @@ const char* opl3Cores[]={
|
|||
"YMF262-LLE"
|
||||
};
|
||||
|
||||
const char* opl4Cores[]={
|
||||
"Nuked-OPL3 (FM) + openMSX (PCM)",
|
||||
"ymfm"
|
||||
};
|
||||
|
||||
const char* esfmCores[]={
|
||||
"ESFMu",
|
||||
_N("ESFMu (fast)")
|
||||
|
@ -2058,6 +2063,17 @@ void FurnaceGUI::drawSettings() {
|
|||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
if (ImGui::Combo("##OPL3CoreRender",&settings.opl3CoreRender,opl3Cores,3)) settingsChanged=true;
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("OPL4");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
if (ImGui::Combo("##OPL4Core",&settings.opl4Core,opl4Cores,2)) settingsChanged=true;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
if (ImGui::Combo("##OPL4CoreRender",&settings.opl4CoreRender,opl4Cores,2)) settingsChanged=true;
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
|
@ -5002,6 +5018,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
settings.opnbCore=conf.getInt("opnbCore",1);
|
||||
settings.opl2Core=conf.getInt("opl2Core",0);
|
||||
settings.opl3Core=conf.getInt("opl3Core",0);
|
||||
settings.opl4Core=conf.getInt("opl4Core",0);
|
||||
settings.esfmCore=conf.getInt("esfmCore",0);
|
||||
settings.opllCore=conf.getInt("opllCore",0);
|
||||
settings.ayCore=conf.getInt("ayCore",0);
|
||||
|
@ -5030,6 +5047,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
settings.opnbCoreRender=conf.getInt("opnbCoreRender",1);
|
||||
settings.opl2CoreRender=conf.getInt("opl2CoreRender",0);
|
||||
settings.opl3CoreRender=conf.getInt("opl3CoreRender",0);
|
||||
settings.opl4CoreRender=conf.getInt("opl4CoreRender",0);
|
||||
settings.esfmCoreRender=conf.getInt("esfmCoreRender",0);
|
||||
settings.opllCoreRender=conf.getInt("opllCoreRender",0);
|
||||
settings.ayCoreRender=conf.getInt("ayCoreRender",0);
|
||||
|
@ -5075,6 +5093,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
clampSetting(settings.opnbCore,0,2);
|
||||
clampSetting(settings.opl2Core,0,2);
|
||||
clampSetting(settings.opl3Core,0,2);
|
||||
clampSetting(settings.opl4Core,0,1);
|
||||
clampSetting(settings.esfmCore,0,1);
|
||||
clampSetting(settings.opllCore,0,1);
|
||||
clampSetting(settings.ayCore,0,1);
|
||||
|
@ -5101,6 +5120,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
clampSetting(settings.opnbCoreRender,0,2);
|
||||
clampSetting(settings.opl2CoreRender,0,2);
|
||||
clampSetting(settings.opl3CoreRender,0,2);
|
||||
clampSetting(settings.opl4CoreRender,0,1);
|
||||
clampSetting(settings.esfmCoreRender,0,1);
|
||||
clampSetting(settings.opllCoreRender,0,1);
|
||||
clampSetting(settings.ayCoreRender,0,1);
|
||||
|
@ -5591,6 +5611,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
conf.set("opnbCore",settings.opnbCore);
|
||||
conf.set("opl2Core",settings.opl2Core);
|
||||
conf.set("opl3Core",settings.opl3Core);
|
||||
conf.set("opl4Core",settings.opl4Core);
|
||||
conf.set("esfmCore",settings.esfmCore);
|
||||
conf.set("opllCore",settings.opllCore);
|
||||
conf.set("ayCore",settings.ayCore);
|
||||
|
@ -5619,6 +5640,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
conf.set("opnbCoreRender",settings.opnbCoreRender);
|
||||
conf.set("opl2CoreRender",settings.opl2CoreRender);
|
||||
conf.set("opl3CoreRender",settings.opl3CoreRender);
|
||||
conf.set("opl4CoreRender",settings.opl4CoreRender);
|
||||
conf.set("esfmCoreRender",settings.esfmCoreRender);
|
||||
conf.set("opllCoreRender",settings.opllCoreRender);
|
||||
conf.set("ayCoreRender",settings.ayCoreRender);
|
||||
|
@ -5682,6 +5704,7 @@ void FurnaceGUI::commitSettings() {
|
|||
settings.opnbCore!=e->getConfInt("opnbCore",1) ||
|
||||
settings.opl2Core!=e->getConfInt("opl2Core",0) ||
|
||||
settings.opl3Core!=e->getConfInt("opl3Core",0) ||
|
||||
settings.opl4Core!=e->getConfInt("opl4Core",0) ||
|
||||
settings.esfmCore!=e->getConfInt("esfmCore",0) ||
|
||||
settings.opllCore!=e->getConfInt("opllCore",0) ||
|
||||
settings.ayCore!=e->getConfInt("ayCore",0) ||
|
||||
|
|
|
@ -2543,6 +2543,67 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_OPL4:
|
||||
case DIV_SYSTEM_OPL4_DRUMS: {
|
||||
int clockSel=flags.getInt("clockSel",0);
|
||||
int ramSize=flags.getInt("ramSize",0);
|
||||
|
||||
ImGui::Text(_("Clock rate:"));
|
||||
ImGui::Indent();
|
||||
if (ImGui::RadioButton(_("33.8688MHz"),clockSel==0)) {
|
||||
clockSel=0;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("28.64MHz (NTSC)"),clockSel==1)) {
|
||||
clockSel=1;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("28.38MHz (PAL)"),clockSel==2)) {
|
||||
clockSel=2;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::Text(_("RAM size:"));
|
||||
ImGui::Indent();
|
||||
if (ImGui::RadioButton(_("4MB"),ramSize==0)) {
|
||||
ramSize=0;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("2MB"),ramSize==1)) {
|
||||
ramSize=1;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("1MB"),ramSize==2)) {
|
||||
ramSize=2;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("640KB"),ramSize==3)) {
|
||||
ramSize=3;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("512KB"),ramSize==4)) {
|
||||
ramSize=4;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("256KB"),ramSize==5)) {
|
||||
ramSize=5;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("128KB"),ramSize==6)) {
|
||||
ramSize=6;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
flags.set("clockSel",clockSel);
|
||||
flags.set("ramSize",ramSize);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_SWAN:
|
||||
case DIV_SYSTEM_BUBSYS_WSG:
|
||||
case DIV_SYSTEM_PET:
|
||||
|
|
|
@ -339,6 +339,7 @@ TAParamResult pVersion(String) {
|
|||
printf("- PowerNoise emulator by scratchminer (MIT)\n");
|
||||
printf("- ep128emu by Istvan Varga (GPLv2)\n");
|
||||
printf("- NDS sound emulator by cam900 (zlib license)\n");
|
||||
printf("- openMSX YMF278 emulator (modified version) by the openMSX developers (GPLv2)\n");
|
||||
return TA_PARAM_QUIT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue