per-channel oscilloscope, part 8

TIA is done
This commit is contained in:
tildearrow 2022-05-01 04:01:25 -05:00
parent 47f83c0472
commit 3a4f120120
4 changed files with 19 additions and 3 deletions

View file

@ -157,7 +157,7 @@ void TIASound::volume(unsigned int percent)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASound::process(short* buffer, unsigned int samples)
void TIASound::process(short* buffer, unsigned int samples, DivDispatchOscBuffer** oscBuf)
{
// Make temporary local copy
unsigned char audc0 = myAUDC[0], audc1 = myAUDC[1];
@ -339,6 +339,11 @@ void TIASound::process(short* buffer, unsigned int samples)
samples--;
break;
}
if (oscBuf!=NULL) {
oscBuf[0]->data[oscBuf[0]->needle++]=v0;
oscBuf[1]->data[oscBuf[1]->needle++]=v1;
}
}
// Save for next round

View file

@ -21,6 +21,7 @@
#define TIASOUND_HXX
#include <string>
#include "../../../dispatch.h"
/**
This class implements a fairly accurate emulation of the TIA sound
@ -87,7 +88,7 @@ class TIASound
@param buffer The location to store generated samples
@param samples The number of samples to generate
*/
void process(short* buffer, unsigned int samples);
void process(short* buffer, unsigned int samples, DivDispatchOscBuffer** oscBuf=NULL);
/**
Set the volume of the samples created (0-100)

View file

@ -48,7 +48,7 @@ const char** DivPlatformTIA::getRegisterSheet() {
}
void DivPlatformTIA::acquire(short* bufL, short* bufR, size_t start, size_t len) {
tia.process(bufL+start,len);
tia.process(bufL+start,len,oscBuf);
}
unsigned char DivPlatformTIA::dealWithFreq(unsigned char shape, int base, int pitch) {
@ -290,6 +290,10 @@ void* DivPlatformTIA::getChanState(int ch) {
return &chan[ch];
}
DivDispatchOscBuffer* DivPlatformTIA::getOscBuffer(int ch) {
return oscBuf[ch];
}
unsigned char* DivPlatformTIA::getRegisterPool() {
return regPool;
}
@ -337,6 +341,9 @@ void DivPlatformTIA::setFlags(unsigned int flags) {
rate=31468;
}
chipClock=rate;
for (int i=0; i<2; i++) {
oscBuf[i]->rate=rate;
}
}
int DivPlatformTIA::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
@ -345,6 +352,7 @@ int DivPlatformTIA::init(DivEngine* p, int channels, int sugRate, unsigned int f
skipRegisterWrites=false;
for (int i=0; i<2; i++) {
isMuted[i]=false;
oscBuf[i]=new DivDispatchOscBuffer;
}
tia.channels(1,false);
setFlags(flags);

View file

@ -40,6 +40,7 @@ class DivPlatformTIA: public DivDispatch {
Channel(): freq(0), baseFreq(0), pitch(0), pitch2(0), note(0), ins(-1), shape(4), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), inPorta(false), vol(0), outVol(15) {}
};
Channel chan[2];
DivDispatchOscBuffer* oscBuf[2];
bool isMuted[2];
TIASound tia;
unsigned char regPool[16];
@ -51,6 +52,7 @@ class DivPlatformTIA: 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();