AY: add stereo separation slider

This commit is contained in:
tildearrow 2022-09-22 00:18:40 -05:00
parent 5c2c80ce22
commit 9685a5c0d8
5 changed files with 16 additions and 4 deletions

View file

@ -115,8 +115,8 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
ay->sound_stream_update(ayBuf,len);
if (stereo) {
for (size_t i=0; i<len; i++) {
bufL[i+start]=ayBuf[0][i]+ayBuf[1][i];
bufR[i+start]=ayBuf[1][i]+ayBuf[2][i];
bufL[i+start]=ayBuf[0][i]+ayBuf[1][i]+((ayBuf[2][i]*stereoSep)>>8);
bufR[i+start]=((ayBuf[0][i]*stereoSep)>>8)+ayBuf[1][i]+ayBuf[2][i];
}
} else {
for (size_t i=0; i<len; i++) {
@ -659,6 +659,7 @@ void DivPlatformAY8910::setFlags(unsigned int flags) {
ay->device_reset();
stereo=(flags>>6)&1;
stereoSep=(flags>>8)&255;
}
int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {

View file

@ -66,6 +66,7 @@ class DivPlatformAY8910: public DivDispatch {
int dacPos;
int dacSample;
unsigned char sampleBank;
unsigned char stereoSep;
int delay;

View file

@ -99,8 +99,8 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
ay->sound_stream_update(ayBuf,len);
if (stereo) {
for (size_t i=0; i<len; i++) {
bufL[i+start]=ayBuf[0][i]+ayBuf[1][i];
bufR[i+start]=ayBuf[1][i]+ayBuf[2][i];
bufL[i+start]=ayBuf[0][i]+ayBuf[1][i]+((ayBuf[2][i]*stereoSep)>>8);
bufR[i+start]=((ayBuf[0][i]*stereoSep)>>8)+ayBuf[1][i]+ayBuf[2][i];
}
} else {
for (size_t i=0; i<len; i++) {
@ -609,6 +609,7 @@ void DivPlatformAY8930::setFlags(unsigned int flags) {
}
stereo=(flags>>6)&1;
stereoSep=(flags>>8)&255;
}
int DivPlatformAY8930::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {

View file

@ -66,6 +66,7 @@ class DivPlatformAY8930: public DivDispatch {
DivDispatchOscBuffer* oscBuf[3];
unsigned char regPool[32];
unsigned char ayNoiseAnd, ayNoiseOr;
unsigned char stereoSep;
bool bank;
int delay;

View file

@ -358,6 +358,14 @@ void FurnaceGUI::drawSysConf(int chan, DivSystem type, unsigned int& flags, bool
if (ImGui::Checkbox("Stereo##_AY_STEREO",&stereo)) {
copyOfFlags=(flags&(~0x40))|(stereo?0x40:0);
}
if (stereo) {
int sep=256-((flags>>8)&255);
if (CWSliderInt("Separation",&sep,1,256)) {
if (sep<1) sep=1;
if (sep>256) sep=256;
copyOfFlags=(flags&(~0xff00))|((256-sep)<<8);
}
}
ImGui::EndDisabled();
bool clockSel=flags&0x80;
ImGui::BeginDisabled((type==DIV_SYSTEM_AY8910) && ((flags&0x30)!=16));