SN: register view?

This commit is contained in:
tildearrow 2023-03-06 04:21:10 -05:00
parent b4a1dd6663
commit 3651325940
2 changed files with 38 additions and 0 deletions

View File

@ -43,6 +43,23 @@ float DivPlatformSMS::getPostAmp() {
return 1.5f;
}
void DivPlatformSMS::poolWrite(unsigned short a, unsigned char v) {
if (a) {
regPool[9]=v;
} else {
if (v>=0x80) {
regPool[(v>>4)&7]&=~15;
regPool[(v>>4)&7]|=v&15;
chanLatch=(v>>5)&3;
} else {
regPool[chanLatch<<1]&=15;
regPool[chanLatch<<1]|=((v&15)<<4);
regPool[1+(chanLatch<<1)]&=15;
regPool[1+(chanLatch<<1)]|=v&0xf0;
}
}
}
void DivPlatformSMS::acquire_nuked(short** buf, size_t len) {
int oL=0;
int oR=0;
@ -54,6 +71,9 @@ void DivPlatformSMS::acquire_nuked(short** buf, size_t len) {
} else if (w.addr==1) {
YMPSG_WriteStereo(&sn_nuked,w.val);
}
poolWrite(w.addr,w.val);
writes.pop();
}
YMPSG_Clock(&sn_nuked);
@ -97,6 +117,9 @@ void DivPlatformSMS::acquire_mame(short** buf, size_t len) {
else if (w.addr==0) {
sn->write(w.val);
}
poolWrite(w.addr,w.val);
writes.pop();
}
for (size_t h=0; h<len; h++) {
@ -428,7 +451,17 @@ DivDispatchOscBuffer* DivPlatformSMS::getOscBuffer(int ch) {
return oscBuf[ch];
}
unsigned char* DivPlatformSMS::getRegisterPool() {
return regPool;
}
int DivPlatformSMS::getRegisterPoolSize() {
return stereo?9:8;
}
void DivPlatformSMS::reset() {
memset(regPool,0,16);
chanLatch=0;
while (!writes.empty()) writes.pop();
for (int i=0; i<4; i++) {
chan[i]=DivPlatformSMS::Channel();

View File

@ -42,6 +42,8 @@ class DivPlatformSMS: public DivDispatch {
unsigned char lastPan;
unsigned char oldValue;
unsigned char snNoiseMode;
unsigned char regPool[16];
unsigned char chanLatch;
int divider=16;
double toneDivider=64.0;
double noiseDivider=64.0;
@ -65,6 +67,7 @@ class DivPlatformSMS: public DivDispatch {
double NOTE_SN(int ch, int note);
int snCalcFreq(int ch);
void poolWrite(unsigned short a, unsigned char v);
void acquire_nuked(short** buf, size_t len);
void acquire_mame(short** buf, size_t len);
@ -74,6 +77,8 @@ class DivPlatformSMS: public DivDispatch {
void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch);
DivDispatchOscBuffer* getOscBuffer(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset();
void forceIns();
void tick(bool sysTick=true);