GA20: excellent...
This commit is contained in:
parent
f13824525a
commit
2c75555fae
|
@ -93,6 +93,52 @@ void DivPlatformGA20::acquire(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformGA20::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||||
|
if (ga20BufLen<len) {
|
||||||
|
ga20BufLen=len;
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
delete[] ga20Buf[i];
|
||||||
|
ga20Buf[i]=new short[ga20BufLen];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
oscBuf[i]->begin(len);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t h=off; h<off+len; h++) {
|
||||||
|
if ((--delay)<=0) {
|
||||||
|
delay=MAX(0,delay);
|
||||||
|
if (!writes.empty()) {
|
||||||
|
QueuedWrite& w=writes.front();
|
||||||
|
ga20.write(w.addr,w.val);
|
||||||
|
regPool[w.addr]=w.val;
|
||||||
|
writes.pop();
|
||||||
|
delay=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
short *buffer[4]={
|
||||||
|
&ga20Buf[0][h],
|
||||||
|
&ga20Buf[1][h],
|
||||||
|
&ga20Buf[2][h],
|
||||||
|
&ga20Buf[3][h]
|
||||||
|
};
|
||||||
|
ga20.sound_stream_update(buffer,1);
|
||||||
|
const int out=(signed int)(ga20Buf[0][h]+ga20Buf[1][h]+ga20Buf[2][h]+ga20Buf[3][h])>>2;
|
||||||
|
if (out!=oldOut) {
|
||||||
|
blip_add_delta(bb[0],h,out-oldOut);
|
||||||
|
oldOut=out;
|
||||||
|
}
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
oscBuf[i]->putSample(h,ga20Buf[i][h]>>1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
oscBuf[i]->end(len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u8 DivPlatformGA20::read_byte(u32 address) {
|
u8 DivPlatformGA20::read_byte(u32 address) {
|
||||||
if ((sampleMem!=NULL) && (address<0x100000)) {
|
if ((sampleMem!=NULL) && (address<0x100000)) {
|
||||||
return sampleMem[address&0xfffff];
|
return sampleMem[address&0xfffff];
|
||||||
|
@ -375,6 +421,7 @@ void DivPlatformGA20::reset() {
|
||||||
memset(regPool,0,32);
|
memset(regPool,0,32);
|
||||||
ga20.device_reset();
|
ga20.device_reset();
|
||||||
delay=0;
|
delay=0;
|
||||||
|
oldOut=0;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
chan[i]=DivPlatformGA20::Channel();
|
chan[i]=DivPlatformGA20::Channel();
|
||||||
chan[i].std.setEngine(parent);
|
chan[i].std.setEngine(parent);
|
||||||
|
@ -385,6 +432,10 @@ void DivPlatformGA20::reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DivPlatformGA20::hasAcquireDirect() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int DivPlatformGA20::getOutputCount() {
|
int DivPlatformGA20::getOutputCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
|
||||||
bool sampleLoaded[256];
|
bool sampleLoaded[256];
|
||||||
|
|
||||||
int delay;
|
int delay;
|
||||||
|
int oldOut;
|
||||||
|
|
||||||
short* ga20Buf[4];
|
short* ga20Buf[4];
|
||||||
size_t ga20BufLen;
|
size_t ga20BufLen;
|
||||||
|
@ -74,6 +75,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
|
||||||
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
|
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
|
||||||
public:
|
public:
|
||||||
virtual u8 read_byte(u32 address) override;
|
virtual u8 read_byte(u32 address) override;
|
||||||
|
virtual void acquireDirect(blip_buffer_t** bb, size_t off, size_t len) override;
|
||||||
virtual void acquire(short** buf, size_t len) override;
|
virtual void acquire(short** buf, size_t len) override;
|
||||||
virtual int dispatch(DivCommand c) override;
|
virtual int dispatch(DivCommand c) override;
|
||||||
virtual void* getChanState(int chan) override;
|
virtual void* getChanState(int chan) override;
|
||||||
|
@ -86,6 +88,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
|
||||||
virtual void forceIns() override;
|
virtual void forceIns() override;
|
||||||
virtual void tick(bool sysTick=true) override;
|
virtual void tick(bool sysTick=true) override;
|
||||||
virtual void muteChannel(int ch, bool mute) override;
|
virtual void muteChannel(int ch, bool mute) override;
|
||||||
|
virtual bool hasAcquireDirect() override;
|
||||||
virtual int getOutputCount() override;
|
virtual int getOutputCount() override;
|
||||||
virtual void notifyInsChange(int ins) override;
|
virtual void notifyInsChange(int ins) override;
|
||||||
virtual void notifyWaveChange(int wave) override;
|
virtual void notifyWaveChange(int wave) override;
|
||||||
|
|
|
@ -650,10 +650,6 @@ bool DivPlatformPCSpeaker::hasAcquireDirect() {
|
||||||
return (speakerType==0 || speakerType==3);
|
return (speakerType==0 || speakerType==3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformPCSpeaker::isOscBufPositional() {
|
|
||||||
return (speakerType==0 || speakerType==3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
|
void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
|
||||||
switch (flags.getInt("clockSel",0)) {
|
switch (flags.getInt("clockSel",0)) {
|
||||||
case 1: // PC-98
|
case 1: // PC-98
|
||||||
|
|
|
@ -88,7 +88,6 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
bool hasAcquireDirect();
|
bool hasAcquireDirect();
|
||||||
bool isOscBufPositional();
|
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
void notifyPlaybackStop();
|
void notifyPlaybackStop();
|
||||||
|
|
Loading…
Reference in a new issue