mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 06:01:29 +00:00
TIA: fixes fixes fixes
This commit is contained in:
parent
fcefbb4909
commit
917a03eb07
5 changed files with 47 additions and 4 deletions
|
@ -53,6 +53,9 @@ void Audio::reset(bool st)
|
|||
myCurrentSample[0]=0;
|
||||
myCurrentSample[1]=0;
|
||||
|
||||
myChannelOut[0]=0;
|
||||
myChannelOut[1]=0;
|
||||
|
||||
myChannel0.reset();
|
||||
myChannel1.reset();
|
||||
}
|
||||
|
@ -120,6 +123,9 @@ void Audio::addSample(unsigned char sample0, unsigned char sample1)
|
|||
else {
|
||||
myCurrentSample[0] = myMixingTableSum[sample0 + sample1];
|
||||
}
|
||||
|
||||
myChannelOut[0] = myMixingTableIndividual[sample0];
|
||||
myChannelOut[1] = myMixingTableIndividual[sample1];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace TIA {
|
|||
AudioChannel& channel1();
|
||||
|
||||
short myCurrentSample[2];
|
||||
short myChannelOut[2];
|
||||
|
||||
private:
|
||||
void phase1();
|
||||
|
|
|
@ -41,7 +41,19 @@ const char** DivPlatformTIA::getRegisterSheet() {
|
|||
void DivPlatformTIA::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||
for (size_t h=start; h<start+len; h++) {
|
||||
tia.tick();
|
||||
bufL[h]=tia.myCurrentSample[0];
|
||||
if (mixingType==2) {
|
||||
bufL[h]=tia.myCurrentSample[0];
|
||||
bufR[h]=tia.myCurrentSample[1];
|
||||
} else if (mixingType==1) {
|
||||
bufL[h]=(tia.myCurrentSample[0]+tia.myCurrentSample[1])>>1;
|
||||
} else {
|
||||
bufL[h]=tia.myCurrentSample[0];
|
||||
}
|
||||
if (++chanOscCounter>=114) {
|
||||
chanOscCounter=0;
|
||||
oscBuf[0]->data[oscBuf[0]->needle++]=tia.myChannelOut[0];
|
||||
oscBuf[1]->data[oscBuf[1]->needle++]=tia.myChannelOut[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +315,7 @@ int DivPlatformTIA::getRegisterPoolSize() {
|
|||
}
|
||||
|
||||
void DivPlatformTIA::reset() {
|
||||
tia.reset(false);
|
||||
tia.reset(mixingType);
|
||||
memset(regPool,0,16);
|
||||
for (int i=0; i<2; i++) {
|
||||
chan[i]=DivPlatformTIA::Channel();
|
||||
|
@ -313,7 +325,7 @@ void DivPlatformTIA::reset() {
|
|||
}
|
||||
|
||||
bool DivPlatformTIA::isStereo() {
|
||||
return false;
|
||||
return (mixingType==2);
|
||||
}
|
||||
|
||||
bool DivPlatformTIA::keyOffAffectsArp(int ch) {
|
||||
|
@ -341,15 +353,19 @@ void DivPlatformTIA::setFlags(unsigned int flags) {
|
|||
rate=COLOR_NTSC;
|
||||
}
|
||||
chipClock=rate;
|
||||
mixingType=(flags>>1)&3;
|
||||
for (int i=0; i<2; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
oscBuf[i]->rate=rate/114;
|
||||
}
|
||||
tia.reset(mixingType);
|
||||
}
|
||||
|
||||
int DivPlatformTIA::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
|
||||
parent=p;
|
||||
dumpWrites=false;
|
||||
skipRegisterWrites=false;
|
||||
mixingType=0;
|
||||
chanOscCounter=0;
|
||||
for (int i=0; i<2; i++) {
|
||||
isMuted[i]=false;
|
||||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
|
|
|
@ -42,6 +42,8 @@ class DivPlatformTIA: public DivDispatch {
|
|||
Channel chan[2];
|
||||
DivDispatchOscBuffer* oscBuf[2];
|
||||
bool isMuted[2];
|
||||
unsigned char mixingType;
|
||||
unsigned char chanOscCounter;
|
||||
TIA::Audio tia;
|
||||
unsigned char regPool[16];
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
|
|
|
@ -402,6 +402,24 @@ void FurnaceGUI::drawSysConf(int chan, DivSystem type, unsigned int& flags, bool
|
|||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_TIA: {
|
||||
ImGui::Text("Mixing mode:");
|
||||
if (ImGui::RadioButton("Mono",(flags&6)==0)) {
|
||||
copyOfFlags=(flags&(~6));
|
||||
}
|
||||
if (ImGui::RadioButton("Mono (no distortion)",(flags&6)==2)) {
|
||||
copyOfFlags=(flags&(~6))|2;
|
||||
}
|
||||
if (ImGui::RadioButton("Stereo",(flags&6)==4)) {
|
||||
copyOfFlags=(flags&(~6))|4;
|
||||
}
|
||||
|
||||
sysPal=flags&1;
|
||||
if (ImGui::Checkbox("PAL",&sysPal)) {
|
||||
copyOfFlags=(flags&(~1))|(unsigned int)sysPal;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_PCSPKR: {
|
||||
ImGui::Text("Speaker type:");
|
||||
if (ImGui::RadioButton("Unfiltered",(flags&3)==0)) {
|
||||
|
|
Loading…
Reference in a new issue