NDS: acquireDirect()
it took a while master volume may not work
This commit is contained in:
parent
ce59a015e9
commit
c9695caf35
4 changed files with 204 additions and 56 deletions
|
|
@ -68,26 +68,39 @@ const char** DivPlatformNDS::getRegisterSheet() {
|
|||
return regCheatSheetNDS;
|
||||
}
|
||||
|
||||
void DivPlatformNDS::acquire(short** buf, size_t len) {
|
||||
void DivPlatformNDS::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
for (int i=0; i<16; i++) {
|
||||
oscBuf[i]->begin(len);
|
||||
}
|
||||
|
||||
nds.set_bb(bb[0],bb[1]);
|
||||
nds.set_oscbuf(oscBuf);
|
||||
nds.resetTS(0);
|
||||
nds.tick(len);
|
||||
/*
|
||||
for (size_t h=0; h<len; h++) {
|
||||
nds.tick(coreQuality);
|
||||
int advance=len;//nds.predict();
|
||||
//if (advance<1) advance=1;
|
||||
//if (advance>(int)(len-h)) advance=len-h;
|
||||
|
||||
h+=advance-1;
|
||||
|
||||
int lout=((nds.loutput()-0x200)<<5); // scale to 16 bit
|
||||
int rout=((nds.routput()-0x200)<<5); // scale to 16 bit
|
||||
if (lout>32767) lout=32767;
|
||||
if (lout<-32768) lout=-32768;
|
||||
if (rout>32767) rout=32767;
|
||||
if (rout<-32768) rout=-32768;
|
||||
buf[0][h]=lout;
|
||||
buf[1][h]=rout;
|
||||
|
||||
if (lastOut[0]!=lout) {
|
||||
blip_add_delta(bb[0],h,lout-lastOut[0]);
|
||||
lastOut[0]=lout;
|
||||
}
|
||||
if (lastOut[1]!=rout) {
|
||||
blip_add_delta(bb[1],h,rout-lastOut[1]);
|
||||
lastOut[1]=rout;
|
||||
}
|
||||
|
||||
for (int i=0; i<16; i++) {
|
||||
oscBuf[i]->putSample(h,(nds.chan_lout(i)+nds.chan_rout(i))>>1);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
for (int i=0; i<16; i++) {
|
||||
oscBuf[i]->end(len);
|
||||
|
|
@ -453,6 +466,8 @@ void DivPlatformNDS::reset() {
|
|||
memset(regPool,0,288);
|
||||
nds.reset();
|
||||
globalVolume=0x7f;
|
||||
lastOut[0]=0;
|
||||
lastOut[1]=0;
|
||||
rWrite32(0x100,0x8000|globalVolume); // enable keyon
|
||||
rWrite32(0x104,0x200); // initialize bias
|
||||
for (int i=0; i<16; i++) {
|
||||
|
|
@ -466,6 +481,10 @@ int DivPlatformNDS::getOutputCount() {
|
|||
return 2;
|
||||
}
|
||||
|
||||
bool DivPlatformNDS::hasAcquireDirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void DivPlatformNDS::notifyInsChange(int ins) {
|
||||
for (int i=0; i<16; i++) {
|
||||
if (chan[i].ins==ins) {
|
||||
|
|
@ -570,7 +589,7 @@ void DivPlatformNDS::renderSamples(int sysID) {
|
|||
void DivPlatformNDS::setFlags(const DivConfig& flags) {
|
||||
isDSi=flags.getBool("chipType",0);
|
||||
chipClock=33513982;
|
||||
rate=chipClock/2/coreQuality;
|
||||
rate=chipClock/2;
|
||||
for (int i=0; i<16; i++) {
|
||||
oscBuf[i]->setRate(rate);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue