per-channel oscilloscope, part 10

OPZ
This commit is contained in:
tildearrow 2022-05-02 00:22:34 -05:00
parent de09073232
commit 430d0329bd
3 changed files with 19 additions and 0 deletions

View File

@ -320,6 +320,9 @@ public:
// generate one sample of sound
void generate(output_data *output, uint32_t numsamples = 1);
// get the engine
fm_engine* debug_engine() { return &m_fm; }
protected:
// internal state
uint8_t m_address; // address register

View File

@ -147,6 +147,8 @@ const char* DivPlatformTX81Z::getEffectName(unsigned char effect) {
void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t len) {
static int os[2];
ymfm::ym2414::fm_engine* fme=fm_ymfm->debug_engine();
for (size_t h=start; h<start+len; h++) {
os[0]=0; os[1]=0;
if (!writes.empty()) {
@ -162,6 +164,10 @@ void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t le
fm_ymfm->generate(&out_ymfm);
for (int i=0; i<8; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=(fme->debug_channel(i)->debug_output(0)+fme->debug_channel(i)->debug_output(1));
}
os[0]=out_ymfm.data[0];
if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767;
@ -714,6 +720,10 @@ void* DivPlatformTX81Z::getChanState(int ch) {
return &chan[ch];
}
DivDispatchOscBuffer* DivPlatformTX81Z::getOscBuffer(int ch) {
return oscBuf[ch];
}
unsigned char* DivPlatformTX81Z::getRegisterPool() {
return regPool;
}
@ -789,6 +799,7 @@ int DivPlatformTX81Z::init(DivEngine* p, int channels, int sugRate, unsigned int
skipRegisterWrites=false;
for (int i=0; i<8; i++) {
isMuted[i]=false;
oscBuf[i]=new DivDispatchOscBuffer;
}
setFlags(flags);
fm_ymfm=new ymfm::ym2414(iface);
@ -798,6 +809,9 @@ int DivPlatformTX81Z::init(DivEngine* p, int channels, int sugRate, unsigned int
}
void DivPlatformTX81Z::quit() {
for (int i=0; i<8; i++) {
delete oscBuf[i];
}
delete fm_ymfm;
}

View File

@ -68,6 +68,7 @@ class DivPlatformTX81Z: public DivDispatch {
chVolR(127) {}
};
Channel chan[8];
DivDispatchOscBuffer* oscBuf[8];
struct QueuedWrite {
unsigned short addr;
unsigned char val;
@ -102,6 +103,7 @@ class DivPlatformTX81Z: public DivDispatch {
void acquire(short* bufL, short* bufR, size_t start, size_t len);
int dispatch(DivCommand c);
void* getChanState(int chan);
DivDispatchOscBuffer* getOscBuffer(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
void reset();