Merge branch 'master' of https://github.com/tildearrow/furnace into ym2610b

# Conflicts:
#	src/engine/engine.cpp
#	src/engine/platform/ym2610Interface.cpp
This commit is contained in:
cam900 2022-02-25 12:20:00 +09:00
commit d831a522a4
15 changed files with 163 additions and 96 deletions

View file

@ -30,6 +30,7 @@
#define WRITE_CONTROL(ch,v) rWrite(0x25+(ch<<3),(v))
#define WRITE_OTHER(ch,v) rWrite(0x27+(ch<<3),(v))
#define WRITE_ATTEN(ch,v) rWrite((0x40+ch),(v))
#define WRITE_STEREO(v) rWrite(0x50,(v))
#define CHIP_DIVIDER 64
@ -88,9 +89,9 @@ const char* regCheatSheetLynx[]={
const char** DivPlatformLynx::getRegisterSheet() {
return regCheatSheetLynx;
}
const char* DivPlatformLynx::getEffectName(unsigned char effect) {
}
const char* DivPlatformLynx::getEffectName(unsigned char effect) {
switch (effect)
{
case 0x30: case 0x31: case 0x32: case 0x33:
@ -197,7 +198,8 @@ int DivPlatformLynx::dispatch(DivCommand c) {
}
break;
case DIV_CMD_PANNING:
WRITE_ATTEN(c.chan, c.value);
chan[c.chan].pan=((c.value&0x0f)<<4)|((c.value&0xf0)>>4);
WRITE_ATTEN(c.chan,chan[c.chan].pan);
break;
case DIV_CMD_GET_VOLUME:
if (chan[c.chan].std.hasVol) {
@ -261,6 +263,10 @@ void DivPlatformLynx::muteChannel(int ch, bool mute) {
if (chan[ch].active) WRITE_VOLUME(ch,(isMuted[ch]?0:(chan[ch].outVol&127)));
}
bool DivPlatformLynx::isStereo() {
return true;
}
void DivPlatformLynx::forceIns() {
for (int i=0; i<4; i++) {
if (chan[i].active) {
@ -272,16 +278,16 @@ void DivPlatformLynx::forceIns() {
void* DivPlatformLynx::getChanState(int ch) {
return &chan[ch];
}
unsigned char* DivPlatformLynx::getRegisterPool()
{
return const_cast<unsigned char*>( mikey->getRegisterPool() );
}
int DivPlatformLynx::getRegisterPoolSize()
{
return 4*8+4;
}
unsigned char* DivPlatformLynx::getRegisterPool()
{
return const_cast<unsigned char*>( mikey->getRegisterPool() );
}
int DivPlatformLynx::getRegisterPoolSize()
{
return 4*8+4;
}
void DivPlatformLynx::reset() {
@ -294,6 +300,7 @@ void DivPlatformLynx::reset() {
if (dumpWrites) {
addWrite(0xffffffff,0);
}
WRITE_STEREO(0);
}
bool DivPlatformLynx::keyOffAffectsArp(int ch) {

View file

@ -45,7 +45,7 @@ class DivPlatformLynx: public DivDispatch {
MikeyFreqDiv fd;
MikeyDuty duty;
int baseFreq, pitch, note, actualNote, lfsr;
unsigned char ins;
unsigned char ins, pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta;
signed char vol, outVol;
Channel():
@ -58,6 +58,7 @@ class DivPlatformLynx: public DivDispatch {
actualNote(0),
lfsr(-1),
ins(-1),
pan(0xff),
active(false),
insChanged(true),
freqChanged(false),
@ -81,6 +82,7 @@ class DivPlatformLynx: public DivDispatch {
void forceIns();
void tick();
void muteChannel(int ch, bool mute);
bool isStereo();
bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch);
//int getPortaFloor(int ch);

View file

@ -99,7 +99,10 @@ void DivPlatformNES::acquire(short* bufL, short* bufR, size_t start, size_t len)
if (nes->apu.clocked) {
nes->apu.clocked=false;
}
bufL[i]=(pulse_output(nes)+tnd_output(nes))*30;
int sample=(pulse_output(nes)+tnd_output(nes)-128)<<7;
if (sample>32767) sample=32767;
if (sample<-32768) sample=-32768;
bufL[i]=sample;
}
}

View file

@ -301,7 +301,9 @@ void DivPlatformSMS::poke(std::vector<DivRegWrite>& wlist) {
}
void DivPlatformSMS::setFlags(unsigned int flags) {
if ((flags&3)==2) {
if ((flags&3)==3) {
chipClock=COLOR_NTSC/2.0;
} else if ((flags&3)==2) {
chipClock=4000000;
} else if ((flags&3)==1) {
chipClock=COLOR_PAL*4.0/5.0;

View file

@ -22,12 +22,20 @@
#include "../engine.h"
uint8_t DivYM2610Interface::ymfm_external_read(ymfm::access_class type, uint32_t address) {
//printf("wants to read from %x\n",address);
if (type!=ymfm::ACCESS_ADPCM_A) return /*s->dataB[address&0xffffff];*/0;
return parent->adpcmMem[address&0xffffff];/*s->dataA[address&0xffffff]*/
/*if (12*sampleBank+(address>>16)>=parent->song.sampleLen) return 0;
return parent->song.sample[12*sampleBank+(address>>16)]->adpcmRendData[(address&0xffff)];*/
switch (type) {
case ymfm::ACCESS_ADPCM_A:
if (parent->adpcmAMem==NULL) return 0;
if ((address&0xffffff)>=parent->adpcmAMemLen) return 0;
return parent->adpcmAMem[address&0xffffff];
case ymfm::ACCESS_ADPCM_B:
if (parent->adpcmBMem==NULL) return 0;
if ((address&0xffffff)>=parent->adpcmBMemLen) return 0;
return parent->adpcmBMem[address&0xffffff];
default:
return 0;
}
return 0;
}
void DivYM2610Interface::ymfm_external_write(ymfm::access_class type, uint32_t address, uint8_t data) {
}
}

View file

@ -237,7 +237,7 @@ void DivPlatformYM2610B::tick() {
// FM
for (int i=0; i<6; i++) {
if (i==1 && extMode) continue;
if (i==2 && extMode) continue;
chan[i].std.next();
if (chan[i].std.hadVol) {
@ -366,7 +366,7 @@ void DivPlatformYM2610B::tick() {
}
for (int i=0; i<6; i++) {
if (i==1 && extMode) continue;
if (i==2 && extMode) continue;
if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>262143) chan[i].freq=262143;