diff --git a/src/engine/platform/sound/tia/TIASnd.cpp b/src/engine/platform/sound/tia/TIASnd.cpp index f6ef8046..e2d0568c 100644 --- a/src/engine/platform/sound/tia/TIASnd.cpp +++ b/src/engine/platform/sound/tia/TIASnd.cpp @@ -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 diff --git a/src/engine/platform/sound/tia/TIASnd.h b/src/engine/platform/sound/tia/TIASnd.h index 14e48577..78459426 100644 --- a/src/engine/platform/sound/tia/TIASnd.h +++ b/src/engine/platform/sound/tia/TIASnd.h @@ -21,6 +21,7 @@ #define TIASOUND_HXX #include +#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) diff --git a/src/engine/platform/tia.cpp b/src/engine/platform/tia.cpp index f6f7dd9c..d3bd5ce2 100644 --- a/src/engine/platform/tia.cpp +++ b/src/engine/platform/tia.cpp @@ -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); diff --git a/src/engine/platform/tia.h b/src/engine/platform/tia.h index dc3bbfd1..76064d06 100644 --- a/src/engine/platform/tia.h +++ b/src/engine/platform/tia.h @@ -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();