mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 15:03:01 +00:00
Reduce register spamming
This commit is contained in:
parent
1e54f2da6c
commit
07e0577a36
2 changed files with 20 additions and 8 deletions
|
@ -149,13 +149,20 @@ void DivPlatformK007232::tick(bool sysTick) {
|
||||||
if (stereo) {
|
if (stereo) {
|
||||||
chan[i].lvol=isMuted[i]?0:(((chan[i].outVol&0xf)*((chan[i].panning>>0)&0xf))/15);
|
chan[i].lvol=isMuted[i]?0:(((chan[i].outVol&0xf)*((chan[i].panning>>0)&0xf))/15);
|
||||||
chan[i].rvol=isMuted[i]?0:(((chan[i].outVol&0xf)*((chan[i].panning>>4)&0xf))/15);
|
chan[i].rvol=isMuted[i]?0:(((chan[i].outVol&0xf)*((chan[i].panning>>4)&0xf))/15);
|
||||||
|
const unsigned char prevPan=lastPan[i];
|
||||||
|
lastPan[i]=(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4);
|
||||||
|
if (prevPan!=lastPan[i]) {
|
||||||
rWrite(0x10+i,(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4));
|
rWrite(0x10+i,(chan[i].lvol&0xf)|((chan[i].rvol&0xf)<<4));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
chan[i].lvol=chan[i].rvol=isMuted[i]?0:chan[i].outVol&0xf;
|
chan[i].lvol=chan[i].rvol=isMuted[i]?0:chan[i].outVol&0xf;
|
||||||
|
const unsigned char prevVolume=lastVolume;
|
||||||
lastVolume=(lastVolume&~(0xf<<(i<<2)))|((chan[i].outVol&0xf)<<(i<<2));
|
lastVolume=(lastVolume&~(0xf<<(i<<2)))|((chan[i].outVol&0xf)<<(i<<2));
|
||||||
|
if (prevVolume!=lastVolume) {
|
||||||
rWrite(0xc,lastVolume);
|
rWrite(0xc,lastVolume);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
chan[i].volumeChanged=false;
|
chan[i].volumeChanged=false;
|
||||||
}
|
}
|
||||||
if (chan[i].setPos) {
|
if (chan[i].setPos) {
|
||||||
|
@ -202,13 +209,16 @@ void DivPlatformK007232::tick(bool sysTick) {
|
||||||
chWrite(i,4,0x1);
|
chWrite(i,4,0x1);
|
||||||
chWrite(i,5,0);
|
chWrite(i,5,0);
|
||||||
// keyon
|
// keyon
|
||||||
|
const unsigned char prevLoop=lastLoop;
|
||||||
if (s->isLoopable()) {
|
if (s->isLoopable()) {
|
||||||
loop=start+s->loopStart;
|
loop=start+s->loopStart;
|
||||||
lastLoop|=(1<<i);
|
lastLoop|=(1<<i);
|
||||||
} else {
|
} else {
|
||||||
lastLoop&=~(1<<i);
|
lastLoop&=~(1<<i);
|
||||||
}
|
}
|
||||||
|
if (prevLoop!=lastLoop) {
|
||||||
rWrite(0xd,lastLoop);
|
rWrite(0xd,lastLoop);
|
||||||
|
}
|
||||||
rWrite(0x12+i,bank);
|
rWrite(0x12+i,bank);
|
||||||
chWrite(i,0,chan[i].freq&0xff);
|
chWrite(i,0,chan[i].freq&0xff);
|
||||||
chWrite(i,1,(chan[i].freq>>8)&0xf);
|
chWrite(i,1,(chan[i].freq>>8)&0xf);
|
||||||
|
@ -399,10 +409,11 @@ void DivPlatformK007232::reset() {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
writes.pop();
|
writes.pop();
|
||||||
}
|
}
|
||||||
memset(regPool,0,32);
|
memset(regPool,0,20);
|
||||||
k007232.reset();
|
k007232.reset();
|
||||||
lastLoop=0;
|
lastLoop=0;
|
||||||
lastVolume=0xff;
|
lastVolume=0;
|
||||||
|
lastPan[0]=lastPan[1]=0;
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
chan[i]=DivPlatformK007232::Channel();
|
chan[i]=DivPlatformK007232::Channel();
|
||||||
chan[i].std.setEngine(parent);
|
chan[i].std.setEngine(parent);
|
||||||
|
@ -462,7 +473,7 @@ unsigned char* DivPlatformK007232::getRegisterPool() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivPlatformK007232::getRegisterPoolSize() {
|
int DivPlatformK007232::getRegisterPoolSize() {
|
||||||
return 32;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* DivPlatformK007232::getSampleMem(int index) {
|
const void* DivPlatformK007232::getSampleMem(int index) {
|
||||||
|
|
|
@ -80,13 +80,14 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
|
||||||
unsigned int sampleOffK007232[256];
|
unsigned int sampleOffK007232[256];
|
||||||
bool sampleLoaded[256];
|
bool sampleLoaded[256];
|
||||||
|
|
||||||
int delay, lastLoop, lastVolume;
|
int delay;
|
||||||
|
unsigned char lastLoop, lastVolume, lastPan[2];
|
||||||
bool stereo;
|
bool stereo;
|
||||||
|
|
||||||
unsigned char* sampleMem;
|
unsigned char* sampleMem;
|
||||||
size_t sampleMemLen;
|
size_t sampleMemLen;
|
||||||
k007232_core k007232;
|
k007232_core k007232;
|
||||||
unsigned char regPool[32];
|
unsigned char regPool[20];
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue