2%
LD.ZRsku p jrsyju rsp jyrsp jyrsp nyeapby eal PT P#
This commit is contained in:
parent
b1ad220c07
commit
eea95b1f90
|
@ -23,16 +23,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
namespace MDFN_IEN_NGP
|
namespace MDFN_IEN_NGP
|
||||||
{
|
{
|
||||||
|
|
||||||
void fakeBufOffset(int time, int delta, Fake_Buffer* buf) {
|
|
||||||
buf->curValue+=delta;
|
|
||||||
}
|
|
||||||
|
|
||||||
T6W28_Osc::T6W28_Osc()
|
T6W28_Osc::T6W28_Osc()
|
||||||
{
|
{
|
||||||
outputs [0] = NULL; // always stays NULL
|
outputs [0] = NULL; // always stays NULL
|
||||||
outputs [1] = NULL;
|
outputs [1] = NULL;
|
||||||
outputs [2] = NULL;
|
oscBuf=NULL;
|
||||||
outputs [3] = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void T6W28_Osc::reset()
|
void T6W28_Osc::reset()
|
||||||
|
@ -61,13 +56,13 @@ void T6W28_Square::run( sms_time_t time, sms_time_t end_time )
|
||||||
// ignore 16kHz and higher
|
// ignore 16kHz and higher
|
||||||
if ( last_amp_left )
|
if ( last_amp_left )
|
||||||
{
|
{
|
||||||
fakeBufOffset( time, -last_amp_left, outputs[2] );
|
blip_add_delta( outputs[0], time, -last_amp_left );
|
||||||
last_amp_left = 0;
|
last_amp_left = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( last_amp_right )
|
if ( last_amp_right )
|
||||||
{
|
{
|
||||||
fakeBufOffset( time, -last_amp_right, outputs[1] );
|
blip_add_delta( outputs[1], time, -last_amp_right, );
|
||||||
last_amp_right = 0;
|
last_amp_right = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,21 +91,21 @@ void T6W28_Square::run( sms_time_t time, sms_time_t end_time )
|
||||||
if ( delta_left )
|
if ( delta_left )
|
||||||
{
|
{
|
||||||
last_amp_left = amp_left;
|
last_amp_left = amp_left;
|
||||||
fakeBufOffset( time, delta_left, outputs[2] );
|
blip_add_delta( outputs[1], time, delta_left );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( delta_right )
|
if ( delta_right )
|
||||||
{
|
{
|
||||||
last_amp_right = amp_right;
|
last_amp_right = amp_right;
|
||||||
fakeBufOffset( time, delta_right, outputs[1] );
|
blip_add_delta( outputs[0], time, delta_right );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time += delay;
|
time += delay;
|
||||||
if ( time < end_time )
|
if ( time < end_time )
|
||||||
{
|
{
|
||||||
Fake_Buffer* const output_left = this->outputs[2];
|
blip_buffer_t* const output_left = this->outputs[1];
|
||||||
Fake_Buffer* const output_right = this->outputs[1];
|
blip_buffer_t* const output_right = this->outputs[2];
|
||||||
|
|
||||||
int delta_left = amp_left * 2;
|
int delta_left = amp_left * 2;
|
||||||
int delta_right = amp_right * 2;
|
int delta_right = amp_right * 2;
|
||||||
|
@ -119,8 +114,8 @@ void T6W28_Square::run( sms_time_t time, sms_time_t end_time )
|
||||||
delta_left = -delta_left;
|
delta_left = -delta_left;
|
||||||
delta_right = -delta_right;
|
delta_right = -delta_right;
|
||||||
|
|
||||||
fakeBufOffset( time, delta_left, output_left );
|
blip_add_delta( output_left, time, delta_left );
|
||||||
fakeBufOffset( time, delta_right, output_right );
|
blip_add_delta( output_right, time, delta_right );
|
||||||
time += period;
|
time += period;
|
||||||
phase ^= 1;
|
phase ^= 1;
|
||||||
}
|
}
|
||||||
|
@ -164,13 +159,13 @@ void T6W28_Noise::run( sms_time_t time, sms_time_t end_time )
|
||||||
if ( delta_left )
|
if ( delta_left )
|
||||||
{
|
{
|
||||||
last_amp_left = amp_left;
|
last_amp_left = amp_left;
|
||||||
fakeBufOffset( time, delta_left, outputs[2] );
|
blip_add_delta( outputs[0], time, delta_left );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( delta_right )
|
if ( delta_right )
|
||||||
{
|
{
|
||||||
last_amp_right = amp_right;
|
last_amp_right = amp_right;
|
||||||
fakeBufOffset( time, delta_right, outputs[1] );
|
blip_add_delta( outputs[1], time, delta_right );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,8 +176,8 @@ void T6W28_Noise::run( sms_time_t time, sms_time_t end_time )
|
||||||
|
|
||||||
if ( time < end_time )
|
if ( time < end_time )
|
||||||
{
|
{
|
||||||
Fake_Buffer* const output_left = this->outputs[2];
|
blip_buffer_t* const output_left = this->outputs[0];
|
||||||
Fake_Buffer* const output_right = this->outputs[1];
|
blip_buffer_t* const output_right = this->outputs[1];
|
||||||
|
|
||||||
unsigned l_shifter = this->shifter;
|
unsigned l_shifter = this->shifter;
|
||||||
int delta_left = amp_left * 2;
|
int delta_left = amp_left * 2;
|
||||||
|
@ -199,10 +194,10 @@ void T6W28_Noise::run( sms_time_t time, sms_time_t end_time )
|
||||||
if ( changed )
|
if ( changed )
|
||||||
{
|
{
|
||||||
delta_left = -delta_left;
|
delta_left = -delta_left;
|
||||||
fakeBufOffset( time, delta_left, output_left );
|
blip_add_delta( output_left, time, delta_left );
|
||||||
|
|
||||||
delta_right = -delta_right;
|
delta_right = -delta_right;
|
||||||
fakeBufOffset( time, delta_right, output_right );
|
blip_add_delta( output_right, time, delta_right );
|
||||||
}
|
}
|
||||||
time += l_period;
|
time += l_period;
|
||||||
}
|
}
|
||||||
|
@ -233,20 +228,20 @@ T6W28_Apu::~T6W28_Apu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void T6W28_Apu::osc_output( int index, Fake_Buffer* center, Fake_Buffer* left, Fake_Buffer* right )
|
void T6W28_Apu::osc_output( int index, DivDispatchOscBuffer* oscBuf )
|
||||||
{
|
{
|
||||||
require( (unsigned int) index < osc_count );
|
require( (unsigned int) index < osc_count );
|
||||||
require( (center && left && right) || (!center && !left && !right) );
|
|
||||||
T6W28_Osc& osc = *oscs [index];
|
T6W28_Osc& osc = *oscs [index];
|
||||||
osc.outputs [1] = right;
|
osc.oscBuf = oscBuf;
|
||||||
osc.outputs [2] = left;
|
|
||||||
osc.outputs [3] = center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void T6W28_Apu::output( Fake_Buffer* center, Fake_Buffer* left, Fake_Buffer* right )
|
void T6W28_Apu::output( blip_buffer_t* left, blip_buffer_t* right )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < osc_count; i++ )
|
for ( int i = 0; i < osc_count; i++ ) {
|
||||||
osc_output( i, center, left, right );
|
T6W28_Osc& osc = *oscs [i];
|
||||||
|
osc.output[0]=left;
|
||||||
|
osc.output[1]=right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void T6W28_Apu::reset()
|
void T6W28_Apu::reset()
|
||||||
|
|
|
@ -8,15 +8,11 @@ namespace MDFN_IEN_NGP
|
||||||
|
|
||||||
typedef long sms_time_t; // clock cycle count
|
typedef long sms_time_t; // clock cycle count
|
||||||
|
|
||||||
struct Fake_Buffer {
|
|
||||||
int curValue;
|
|
||||||
Fake_Buffer():
|
|
||||||
curValue(0) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "blip_buf.h"
|
||||||
|
#include "../../../dispatch.h"
|
||||||
|
|
||||||
#include "T6W28_Oscs.h"
|
#include "T6W28_Oscs.h"
|
||||||
|
|
||||||
namespace MDFN_IEN_NGP
|
namespace MDFN_IEN_NGP
|
||||||
|
@ -45,15 +41,13 @@ public:
|
||||||
|
|
||||||
// Assign all oscillator outputs to specified buffer(s). If buffer
|
// Assign all oscillator outputs to specified buffer(s). If buffer
|
||||||
// is NULL, silences all oscillators.
|
// is NULL, silences all oscillators.
|
||||||
void output( Fake_Buffer* mono );
|
void output( blip_buffer_t* left, blip_buffer_t* right );
|
||||||
void output( Fake_Buffer* center, Fake_Buffer* left, Fake_Buffer* right );
|
|
||||||
|
|
||||||
// Assign single oscillator output to buffer(s). Valid indicies are 0 to 3,
|
// Assign single oscillator output to buffer(s). Valid indicies are 0 to 3,
|
||||||
// which refer to Square 1, Square 2, Square 3, and Noise. If buffer is NULL,
|
// which refer to Square 1, Square 2, Square 3, and Noise. If buffer is NULL,
|
||||||
// silences oscillator.
|
// silences oscillator.
|
||||||
enum { osc_count = 4 };
|
enum { osc_count = 4 };
|
||||||
void osc_output( int index, Fake_Buffer* mono );
|
void osc_output( int index, DivDispatchOscBuffer* oscBuf );
|
||||||
void osc_output( int index, Fake_Buffer* center, Fake_Buffer* left, Fake_Buffer* right );
|
|
||||||
|
|
||||||
// Reset oscillators and internal state
|
// Reset oscillators and internal state
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -85,11 +79,6 @@ private:
|
||||||
|
|
||||||
void run_until( sms_time_t );
|
void run_until( sms_time_t );
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void T6W28_Apu::output( Fake_Buffer* b ) { output( b, b, b ); }
|
|
||||||
|
|
||||||
inline void T6W28_Apu::osc_output( int i, Fake_Buffer* b ) { osc_output( i, b, b, b ); }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,7 +11,8 @@ namespace MDFN_IEN_NGP
|
||||||
|
|
||||||
struct T6W28_Osc
|
struct T6W28_Osc
|
||||||
{
|
{
|
||||||
Fake_Buffer* outputs[4];
|
blip_buffer_t* outputs[2];
|
||||||
|
DivDispatchOscBuffer* oscBuf;
|
||||||
int output_select;
|
int output_select;
|
||||||
|
|
||||||
int delay;
|
int delay;
|
||||||
|
|
|
@ -35,25 +35,25 @@ const char** DivPlatformT6W28::getRegisterSheet() {
|
||||||
return regCheatSheetT6W28;
|
return regCheatSheetT6W28;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformT6W28::acquire(short** buf, size_t len) {
|
void DivPlatformT6W28::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->begin(len);
|
oscBuf[i]->begin(len);
|
||||||
}
|
}
|
||||||
|
t6w->output(i,bb[0],bb[1]);
|
||||||
|
|
||||||
for (size_t h=0; h<len; h++) {
|
while (!writes.empty()) {
|
||||||
cycles=0;
|
QueuedWrite w=writes.front();
|
||||||
while (!writes.empty() && cycles<16) {
|
if (w.addr) {
|
||||||
QueuedWrite w=writes.front();
|
t6w->write_data_right(0,w.val);
|
||||||
if (w.addr) {
|
} else {
|
||||||
t6w->write_data_right(cycles,w.val);
|
t6w->write_data_left(0,w.val);
|
||||||
} else {
|
|
||||||
t6w->write_data_left(cycles,w.val);
|
|
||||||
}
|
|
||||||
regPool[w.addr&1]=w.val;
|
|
||||||
//cycles+=2;
|
|
||||||
writes.pop();
|
|
||||||
}
|
}
|
||||||
t6w->end_frame(16);
|
regPool[w.addr&1]=w.val;
|
||||||
|
writes.pop();
|
||||||
|
}
|
||||||
|
t6w->end_frame(len);
|
||||||
|
/*
|
||||||
|
for (size_t h=0; h<len; h++) {
|
||||||
|
|
||||||
tempL=0;
|
tempL=0;
|
||||||
tempR=0;
|
tempR=0;
|
||||||
|
@ -70,7 +70,7 @@ void DivPlatformT6W28::acquire(short** buf, size_t len) {
|
||||||
|
|
||||||
buf[0][h]=tempL;
|
buf[0][h]=tempL;
|
||||||
buf[1][h]=tempR;
|
buf[1][h]=tempR;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->end(len);
|
oscBuf[i]->end(len);
|
||||||
|
@ -346,7 +346,6 @@ void DivPlatformT6W28::reset() {
|
||||||
lastPan=0xff;
|
lastPan=0xff;
|
||||||
tempL=0;
|
tempL=0;
|
||||||
tempR=0;
|
tempR=0;
|
||||||
cycles=0;
|
|
||||||
curChan=-1;
|
curChan=-1;
|
||||||
delay=0;
|
delay=0;
|
||||||
// default noise mode
|
// default noise mode
|
||||||
|
@ -382,7 +381,7 @@ void DivPlatformT6W28::setFlags(const DivConfig& flags) {
|
||||||
}
|
}
|
||||||
t6w=new MDFN_IEN_NGP::T6W28_Apu;
|
t6w=new MDFN_IEN_NGP::T6W28_Apu;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
t6w->osc_output(i,&out[i][0],&out[i][1],&out[i][2]);
|
t6w->osc_output(i,oscBuf[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ class DivPlatformT6W28: public DivDispatch {
|
||||||
int cycles, curChan, delay;
|
int cycles, curChan, delay;
|
||||||
int tempL, tempR;
|
int tempL, tempR;
|
||||||
MDFN_IEN_NGP::T6W28_Apu* t6w;
|
MDFN_IEN_NGP::T6W28_Apu* t6w;
|
||||||
MDFN_IEN_NGP::Fake_Buffer out[4][3];
|
|
||||||
unsigned char regPool[128];
|
unsigned char regPool[128];
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
@ -59,7 +58,7 @@ class DivPlatformT6W28: public DivDispatch {
|
||||||
|
|
||||||
void writeOutVol(int ch);
|
void writeOutVol(int ch);
|
||||||
public:
|
public:
|
||||||
void acquire(short** buf, size_t len);
|
void acquireDirect(blip_buffer_t** bb, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -74,6 +73,7 @@ class DivPlatformT6W28: public DivDispatch {
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
int getOutputCount();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
|
bool hasAcquireDirect();
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
|
|
Loading…
Reference in a new issue