mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
SoundUnit: change 1-bit PDM mode to 8-bit TDM
This commit is contained in:
parent
9ba9b7b4f5
commit
0165a19630
3 changed files with 15 additions and 38 deletions
|
@ -258,11 +258,17 @@ void SoundUnit::NextSample(short* l, short* r) {
|
|||
}
|
||||
|
||||
// mix
|
||||
if (dsOut) {
|
||||
tnsL=nsL[dsChannel]<<1;
|
||||
tnsR=nsR[dsChannel]<<1;
|
||||
dsChannel=(dsChannel+1)&7;
|
||||
} else {
|
||||
tnsL=(nsL[0]+nsL[1]+nsL[2]+nsL[3]+nsL[4]+nsL[5]+nsL[6]+nsL[7])>>2;
|
||||
tnsR=(nsR[0]+nsR[1]+nsR[2]+nsR[3]+nsR[4]+nsR[5]+nsR[6]+nsR[7])>>2;
|
||||
|
||||
IL1=minval(32767,maxval(-32767,tnsL))>>8;
|
||||
IL2=minval(32767,maxval(-32767,tnsR))>>8;
|
||||
}
|
||||
|
||||
// write input lines to sample memory
|
||||
if (ILSIZE&64) {
|
||||
|
@ -324,36 +330,8 @@ void SoundUnit::NextSample(short* l, short* r) {
|
|||
}
|
||||
|
||||
if (dsOut) {
|
||||
tnsL=minval(32767,maxval(-32767,tnsL<<1));
|
||||
tnsR=minval(32767,maxval(-32767,tnsR<<1));
|
||||
|
||||
short accumL=0;
|
||||
short accumR=0;
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
if ((tnsL>>8)==0 && dsCounterL>0) dsCounterL=0;
|
||||
dsCounterL+=tnsL>>8;
|
||||
if (dsCounterL>=0) {
|
||||
accumL+=4095;
|
||||
dsCounterL-=127;
|
||||
} else {
|
||||
accumL+=-4095;
|
||||
dsCounterL+=127;
|
||||
}
|
||||
|
||||
if ((tnsR>>8)==0 && dsCounterR>0) dsCounterR=0;
|
||||
dsCounterR+=tnsR>>8;
|
||||
if (dsCounterR>=0) {
|
||||
accumR+=4095;
|
||||
dsCounterR-=127;
|
||||
} else {
|
||||
accumR+=-4095;
|
||||
dsCounterR+=127;
|
||||
}
|
||||
}
|
||||
|
||||
*l=accumL;
|
||||
*r=accumR;
|
||||
*l=minval(32767,maxval(-32767,tnsL))&0xff00;
|
||||
*r=minval(32767,maxval(-32767,tnsR))&0xff00;
|
||||
} else {
|
||||
*l=minval(32767,maxval(-32767,tnsL));
|
||||
*r=minval(32767,maxval(-32767,tnsR));
|
||||
|
@ -402,8 +380,7 @@ void SoundUnit::Reset() {
|
|||
oldfreq[i]=0;
|
||||
pcmdec[i]=0;
|
||||
}
|
||||
dsCounterL=0;
|
||||
dsCounterR=0;
|
||||
dsChannel=0;
|
||||
tnsL=0;
|
||||
tnsR=0;
|
||||
ilBufPos=0;
|
||||
|
|
|
@ -47,7 +47,7 @@ class SoundUnit {
|
|||
unsigned short oldfreq[8];
|
||||
unsigned int pcmSize;
|
||||
bool dsOut;
|
||||
short dsCounterL, dsCounterR;
|
||||
unsigned char dsChannel;
|
||||
public:
|
||||
unsigned short resetfreq[8];
|
||||
unsigned short voldcycles[8];
|
||||
|
|
|
@ -239,7 +239,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
pdm=false;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton("1-bit PDM (rev C/E)",pdm==1)) {
|
||||
if (ImGui::RadioButton("8-bit + TDM (rev C/E)",pdm==1)) {
|
||||
pdm=true;
|
||||
altered=true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue