Merge remote-tracking branch 'upstream/master' into macro

# Conflicts:
#	src/engine/platform/c64.cpp
#	src/gui/insEdit.cpp
This commit is contained in:
cam900 2022-04-10 14:47:10 +09:00
commit ae4f005d67
41 changed files with 635 additions and 350 deletions

View file

@ -74,6 +74,14 @@ int DivDispatch::getPortaFloor(int ch) {
return 0x00;
}
float DivDispatch::getPostAmp() {
return 1.0f;
}
bool DivDispatch::getDCOffRequired() {
return false;
}
const char* DivDispatch::getEffectName(unsigned char effect) {
return NULL;
}

View file

@ -497,6 +497,10 @@ void DivPlatformAY8910::flushWrites() {
while (!writes.empty()) writes.pop();
}
bool DivPlatformAY8910::getDCOffRequired() {
return true;
}
void DivPlatformAY8910::reset() {
while (!writes.empty()) writes.pop();
ay->device_reset();

View file

@ -95,6 +95,7 @@ class DivPlatformAY8910: public DivDispatch {
void setFlags(unsigned int flags);
bool isStereo();
bool keyOffAffectsArp(int ch);
bool getDCOffRequired();
void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist);

View file

@ -123,7 +123,7 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
}
while (!writes.empty()) {
QueuedWrite w=writes.front();
if (bank!=(w.addr>>4)) {
if ((int)bank!=(w.addr>>4)) {
bank=w.addr>>4;
ay->address_w(0x0d);
ay->data_w(0xa0|(bank<<4)|ayEnvMode[0]);

View file

@ -118,7 +118,7 @@ void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len)
void DivPlatformC64::updateFilter() {
rWrite(0x15,filtCut&7);
rWrite(0x16,filtCut>>3);
rWrite(0x17,(filtRes<<4)|(chan[2].filter<<2)|(chan[1].filter<<1)|(chan[0].filter));
rWrite(0x17,(filtRes<<4)|(chan[2].filter<<2)|(chan[1].filter<<1)|(int)(chan[0].filter));
rWrite(0x18,(filtControl<<4)|vol);
}
@ -177,7 +177,7 @@ void DivPlatformC64::tick() {
}
if (chan[i].std.wave.had) {
chan[i].wave=chan[i].std.wave.val;
rWrite(i*7+4,(isMuted[i]?8:(chan[i].wave<<4))|(chan[i].ring<<2)|(chan[i].sync<<1)|chan[i].active);
rWrite(i*7+4,(isMuted[i]?8:(chan[i].wave<<4))|(chan[i].ring<<2)|(chan[i].sync<<1)|(int)(chan[i].active));
}
if (chan[i].std.ex1.had) {
filtControl=chan[i].std.ex1.val&15;
@ -232,7 +232,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
rWrite(c.chan*7+3,chan[c.chan].duty>>8);
}
if (chan[c.chan].insChanged) {
chan[c.chan].wave=(ins->c64.noiseOn<<3)|(ins->c64.pulseOn<<2)|(ins->c64.sawOn<<1)|(ins->c64.triOn);
chan[c.chan].wave=(ins->c64.noiseOn<<3)|(ins->c64.pulseOn<<2)|(ins->c64.sawOn<<1)|(int)(ins->c64.triOn);
chan[c.chan].attack=ins->c64.a;
chan[c.chan].decay=(ins->c64.s==15)?0:ins->c64.d;
chan[c.chan].sustain=ins->c64.s;
@ -245,7 +245,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
if (ins->c64.initFilter) {
filtCut=ins->c64.cut;
filtRes=ins->c64.res;
filtControl=ins->c64.lp|(ins->c64.bp<<1)|(ins->c64.hp<<2)|(ins->c64.ch3off<<3);
filtControl=(int)(ins->c64.lp)|(ins->c64.bp<<1)|(ins->c64.hp<<2)|(ins->c64.ch3off<<3);
}
updateFilter();
}
@ -330,7 +330,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
break;
case DIV_CMD_WAVE:
chan[c.chan].wave=c.value;
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|chan[c.chan].active);
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
break;
case DIV_CMD_LEGATO:
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value+((chan[c.chan].std.arp.will && !chan[c.chan].std.arp.mode)?(chan[c.chan].std.arp.val):(0)));
@ -411,11 +411,11 @@ int DivPlatformC64::dispatch(DivCommand c) {
break;
case 4:
chan[c.chan].ring=c.value;
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|chan[c.chan].active);
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
break;
case 5:
chan[c.chan].sync=c.value;
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|chan[c.chan].active);
rWrite(c.chan*7+4,(isMuted[c.chan]?8:(chan[c.chan].wave<<4))|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|(int)(chan[c.chan].active));
break;
case 6:
filtControl&=7;
@ -434,7 +434,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
void DivPlatformC64::muteChannel(int ch, bool mute) {
isMuted[ch]=mute;
rWrite(ch*7+4,(isMuted[ch]?8:(chan[ch].wave<<4))|(chan[ch].ring<<2)|(chan[ch].sync<<1)|chan[ch].active);
rWrite(ch*7+4,(isMuted[ch]?8:(chan[ch].wave<<4))|(chan[ch].ring<<2)|(chan[ch].sync<<1)|(int)(chan[ch].active));
}
void DivPlatformC64::forceIns() {

View file

@ -89,7 +89,6 @@ void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len
if (!isMuted[2]) {
sample+=mmc5->pcm.output*2;
}
sample=(sample-128)<<6;
if (sample>32767) sample=32767;
if (sample<-32768) sample=-32768;
bufL[i]=sample;
@ -336,6 +335,10 @@ int DivPlatformMMC5::getRegisterPoolSize() {
return 32;
}
float DivPlatformMMC5::getPostAmp() {
return 64.0f;
}
void DivPlatformMMC5::reset() {
for (int i=0; i<3; i++) {
chan[i]=DivPlatformMMC5::Channel();

View file

@ -74,6 +74,7 @@ class DivPlatformMMC5: public DivDispatch {
void tick();
void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch);
float getPostAmp();
void setFlags(unsigned int flags);
void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val);

View file

@ -80,7 +80,14 @@ void DivPlatformNES::acquire(short* bufL, short* bufR, size_t start, size_t len)
DivSample* s=parent->getSample(dacSample);
if (s->samples>0) {
if (!isMuted[4]) {
rWrite(0x4011,((unsigned char)s->data8[dacPos]+0x80)>>1);
unsigned char next=((unsigned char)s->data8[dacPos]+0x80)>>1;
if (dacAntiClickOn && dacAntiClick<next) {
dacAntiClick+=8;
rWrite(0x4011,dacAntiClick);
} else {
dacAntiClickOn=false;
rWrite(0x4011,next);
}
}
if (++dacPos>=s->samples) {
if (s->loopStart>=0 && s->loopStart<(int)s->samples) {
@ -101,7 +108,7 @@ void DivPlatformNES::acquire(short* bufL, short* bufR, size_t start, size_t len)
if (nes->apu.clocked) {
nes->apu.clocked=false;
}
int sample=(pulse_output(nes)+tnd_output(nes)-128)<<7;
int sample=(pulse_output(nes)+tnd_output(nes));
if (sample>32767) sample=32767;
if (sample<-32768) sample=-32768;
bufL[i]=sample;
@ -454,6 +461,10 @@ int DivPlatformNES::getRegisterPoolSize() {
return 32;
}
float DivPlatformNES::getPostAmp() {
return 128.0f;
}
void DivPlatformNES::reset() {
for (int i=0; i<5; i++) {
chan[i]=DivPlatformNES::Channel();
@ -476,6 +487,9 @@ void DivPlatformNES::reset() {
rWrite(0x4015,0x1f);
rWrite(0x4001,chan[0].sweep);
rWrite(0x4005,chan[1].sweep);
dacAntiClickOn=true;
dacAntiClick=0;
}
bool DivPlatformNES::keyOffAffectsArp(int ch) {

View file

@ -54,10 +54,11 @@ class DivPlatformNES: public DivDispatch {
Channel chan[5];
bool isMuted[5];
int dacPeriod, dacRate;
unsigned int dacPos;
unsigned int dacPos, dacAntiClick;
int dacSample;
unsigned char sampleBank;
unsigned char apuType;
bool dacAntiClickOn;
struct NESAPU* nes;
unsigned char regPool[128];
@ -74,6 +75,7 @@ class DivPlatformNES: public DivDispatch {
void tick();
void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch);
float getPostAmp();
void setFlags(unsigned int flags);
void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val);

View file

@ -371,7 +371,7 @@ void DivPlatformOPL::tick() {
if (update4OpMask) {
update4OpMask=false;
if (oplType==3) {
unsigned char opMask=chan[0].fourOp|(chan[2].fourOp<<1)|(chan[4].fourOp<<2)|(chan[6].fourOp<<3)|(chan[8].fourOp<<4)|(chan[10].fourOp<<5);
unsigned char opMask=(int)(chan[0].fourOp)|(chan[2].fourOp<<1)|(chan[4].fourOp<<2)|(chan[6].fourOp<<3)|(chan[8].fourOp<<4)|(chan[10].fourOp<<5);
immWrite(0x104,opMask);
//printf("updating opMask to %.2x\n",opMask);
}

View file

@ -620,7 +620,7 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
}
case DIV_CMD_FM_EXTCH:
if (!properDrumsSys) break;
if (properDrums==c.value) break;
if ((int)properDrums==c.value) break;
if (c.value) {
properDrums=true;
immWrite(0x0e,0x20);

View file

@ -414,6 +414,16 @@ void DivPlatformSAA1099::reset() {
extMode=false;
rWrite(8,255);
rWrite(9,255);
rWrite(10,255);
rWrite(11,255);
rWrite(12,255);
rWrite(13,255);
rWrite(16,0x77);
rWrite(17,0x77);
rWrite(18,0x77);
rWrite(0x1c,2);
rWrite(0x1c,1);
}

View file

@ -1120,7 +1120,7 @@ void ay8910_device::sound_stream_update(short** outputs, int outLen)
for (int chan = 0; chan < NUM_CHANNELS; chan++)
{
tone = &m_tone[chan];
m_vol_enabled[chan] = (tone->output | tone_enable(chan)) & (noise_output() | noise_enable(chan));
m_vol_enabled[chan] = (tone->output | (unsigned char)tone_enable(chan)) & (noise_output() | (unsigned char)noise_enable(chan));
}
/* update envelope */

View file

@ -213,7 +213,8 @@ void apu_turn_on(struct NESAPU* a, BYTE apu_type) {
a->S2.sweep.delay = 1;
a->S2.sweep.divider = 1;
a->TR.frequency = 1;
a->TR.sequencer = 0;
/* questo era 0 ma produce click nell'audio */
a->TR.sequencer = 7;
a->NS.frequency = 1;
a->NS.shift = 1;
a->DMC.frequency = 1;

View file

@ -33,7 +33,7 @@
#pragma once
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif