BubSys: acquireDirect()
This commit is contained in:
parent
ef1fae3bee
commit
418780b82b
|
@ -45,7 +45,7 @@ class k005289_core : public vgsound_emu_core
|
|||
// getters
|
||||
inline u8 addr() { return m_addr; }
|
||||
|
||||
private:
|
||||
public:
|
||||
// registers
|
||||
u8 m_addr = 0; // external address pin
|
||||
u16 m_pitch = 0; // pitch
|
||||
|
@ -77,7 +77,7 @@ class k005289_core : public vgsound_emu_core
|
|||
// 1QA...E/2QA...E pin
|
||||
inline u8 addr(int voice) { return m_timer[voice & 1].addr(); }
|
||||
|
||||
private:
|
||||
public:
|
||||
std::array<timer_t, 2> m_timer;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,15 +39,25 @@ const char** DivPlatformBubSysWSG::getRegisterSheet() {
|
|||
return regCheatSheetBubSysWSG;
|
||||
}
|
||||
|
||||
void DivPlatformBubSysWSG::acquire(short** buf, size_t len) {
|
||||
void DivPlatformBubSysWSG::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
int chanOut=0;
|
||||
for (int i=0; i<2; i++) {
|
||||
oscBuf[i]->begin(len);
|
||||
}
|
||||
for (size_t h=0; h<len; h++) {
|
||||
int advance=len-h;
|
||||
// heuristic
|
||||
for (int i=0; i<2; i++) {
|
||||
const int remain=k005289.m_timer[i].m_counter;
|
||||
if (remain<advance) advance=remain;
|
||||
}
|
||||
if (advance<1) advance=1;
|
||||
|
||||
signed int out=0;
|
||||
// K005289 part
|
||||
k005289.tick(coreQuality);
|
||||
k005289.tick(advance);
|
||||
|
||||
h+=advance-1;
|
||||
|
||||
// Wavetable part
|
||||
for (int i=0; i<2; i++) {
|
||||
|
@ -57,21 +67,16 @@ void DivPlatformBubSysWSG::acquire(short** buf, size_t len) {
|
|||
} else {
|
||||
chanOut=chan[i].waveROM[k005289.addr(i)]*(regPool[2+i]&0xf);
|
||||
out+=chanOut;
|
||||
if (writeOscBuf==0) {
|
||||
oscBuf[i]->putSample(h,chanOut<<7);
|
||||
}
|
||||
oscBuf[i]->putSample(h,chanOut<<7);
|
||||
}
|
||||
}
|
||||
|
||||
if (++writeOscBuf>=8) writeOscBuf=0;
|
||||
|
||||
out<<=6; // scale output to 16 bit
|
||||
|
||||
if (out<-32768) out=-32768;
|
||||
if (out>32767) out=32767;
|
||||
|
||||
//printf("out: %d\n",out);
|
||||
buf[0][h]=out;
|
||||
if (out!=lastOut) {
|
||||
blip_add_delta(bb[0],h,out-lastOut);
|
||||
lastOut=out;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<2; i++) {
|
||||
oscBuf[i]->end(len);
|
||||
|
@ -310,6 +315,7 @@ void DivPlatformBubSysWSG::reset() {
|
|||
addWrite(0xffffffff,0);
|
||||
}
|
||||
k005289.reset();
|
||||
lastOut=0;
|
||||
}
|
||||
|
||||
int DivPlatformBubSysWSG::getOutputCount() {
|
||||
|
@ -320,6 +326,10 @@ bool DivPlatformBubSysWSG::keyOffAffectsArp(int ch) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DivPlatformBubSysWSG::hasAcquireDirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void DivPlatformBubSysWSG::notifyWaveChange(int wave) {
|
||||
for (int i=0; i<2; i++) {
|
||||
if (chan[i].wave==wave) {
|
||||
|
@ -338,7 +348,7 @@ void DivPlatformBubSysWSG::notifyInsDeletion(void* ins) {
|
|||
void DivPlatformBubSysWSG::setFlags(const DivConfig& flags) {
|
||||
chipClock=COLOR_NTSC;
|
||||
CHECK_CUSTOM_CLOCK;
|
||||
rate=chipClock/coreQuality;
|
||||
rate=chipClock;
|
||||
for (int i=0; i<2; i++) {
|
||||
oscBuf[i]->setRate(rate);
|
||||
}
|
||||
|
|
|
@ -38,14 +38,14 @@ class DivPlatformBubSysWSG: public DivDispatch {
|
|||
bool isMuted[2];
|
||||
unsigned char writeOscBuf;
|
||||
|
||||
int coreQuality;
|
||||
int coreQuality, lastOut;
|
||||
k005289_core k005289;
|
||||
unsigned short regPool[4];
|
||||
void updateWave(int ch);
|
||||
friend void putDispatchChip(void*,int);
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
public:
|
||||
void acquire(short** buf, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
|
@ -58,6 +58,7 @@ class DivPlatformBubSysWSG: public DivDispatch {
|
|||
void muteChannel(int ch, bool mute);
|
||||
int getOutputCount();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
bool hasAcquireDirect();
|
||||
DivMacroInt* getChanMacroInt(int ch);
|
||||
void setFlags(const DivConfig& flags);
|
||||
void notifyWaveChange(int wave);
|
||||
|
|
Loading…
Reference in a new issue