ES5506: add a volume scale parameter
This commit is contained in:
parent
30ce6e9ed7
commit
e2e0afd18a
|
@ -385,13 +385,19 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
if (chan[i].volChanged.changed) {
|
if (chan[i].volChanged.changed) {
|
||||||
// calculate volume (16 bit)
|
// calculate volume (16 bit)
|
||||||
if (chan[i].volChanged.lVol) {
|
if (chan[i].volChanged.lVol) {
|
||||||
chan[i].resLVol=VOL_SCALE_LOG(chan[i].outVol,chan[i].outLVol,0xfff)<<4;
|
chan[i].resLVol=VOL_SCALE_LOG(chan[i].outVol,chan[i].outLVol,0xfff);
|
||||||
|
chan[i].resLVol-=volScale;
|
||||||
|
if (chan[i].resLVol<0) chan[i].resLVol=0;
|
||||||
|
chan[i].resLVol<<=4;
|
||||||
if (!chan[i].keyOn && chan[i].active) {
|
if (!chan[i].keyOn && chan[i].active) {
|
||||||
pageWrite(0x00|i,0x02,chan[i].resLVol);
|
pageWrite(0x00|i,0x02,chan[i].resLVol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].volChanged.rVol) {
|
if (chan[i].volChanged.rVol) {
|
||||||
chan[i].resRVol=VOL_SCALE_LOG(chan[i].outVol,chan[i].outRVol,0xfff)<<4;
|
chan[i].resRVol=VOL_SCALE_LOG(chan[i].outVol,chan[i].outRVol,0xfff);
|
||||||
|
chan[i].resRVol-=volScale;
|
||||||
|
if (chan[i].resRVol<0) chan[i].resRVol=0;
|
||||||
|
chan[i].resRVol<<=4;
|
||||||
if (!chan[i].keyOn && chan[i].active) {
|
if (!chan[i].keyOn && chan[i].active) {
|
||||||
pageWrite(0x00|i,0x04,chan[i].resRVol);
|
pageWrite(0x00|i,0x04,chan[i].resRVol);
|
||||||
}
|
}
|
||||||
|
@ -1152,6 +1158,7 @@ void DivPlatformES5506::setFlags(const DivConfig& flags) {
|
||||||
CHECK_CUSTOM_CLOCK;
|
CHECK_CUSTOM_CLOCK;
|
||||||
|
|
||||||
initChanMax=MAX(4,flags.getInt("channels",0x1f)&0x1f);
|
initChanMax=MAX(4,flags.getInt("channels",0x1f)&0x1f);
|
||||||
|
volScale=4095-flags.getInt("volScale",4095);
|
||||||
chanMax=initChanMax;
|
chanMax=initChanMax;
|
||||||
pageWriteMask(0x00,0x60,0x0b,chanMax);
|
pageWriteMask(0x00,0x60,0x0b,chanMax);
|
||||||
|
|
||||||
|
@ -1251,6 +1258,7 @@ int DivPlatformES5506::init(DivEngine* p, int channels, int sugRate, const DivCo
|
||||||
parent=p;
|
parent=p;
|
||||||
dumpWrites=false;
|
dumpWrites=false;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
|
volScale=0;
|
||||||
|
|
||||||
for (int i=0; i<32; i++) {
|
for (int i=0; i<32; i++) {
|
||||||
isMuted[i]=false;
|
isMuted[i]=false;
|
||||||
|
|
|
@ -266,7 +266,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
std::queue<QueuedHostIntf> hostIntf8;
|
std::queue<QueuedHostIntf> hostIntf8;
|
||||||
std::queue<unsigned char> queuedRead;
|
std::queue<unsigned char> queuedRead;
|
||||||
std::queue<QueuedReadState> queuedReadState;
|
std::queue<QueuedReadState> queuedReadState;
|
||||||
int cycle, curPage;
|
int cycle, curPage, volScale;
|
||||||
unsigned char maskedVal;
|
unsigned char maskedVal;
|
||||||
unsigned int irqv;
|
unsigned int irqv;
|
||||||
bool isMasked, isReaded;
|
bool isMasked, isReaded;
|
||||||
|
|
|
@ -883,6 +883,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
}
|
}
|
||||||
case DIV_SYSTEM_ES5506: {
|
case DIV_SYSTEM_ES5506: {
|
||||||
int channels=flags.getInt("channels",0x1f)+1;
|
int channels=flags.getInt("channels",0x1f)+1;
|
||||||
|
int volScale=flags.getInt("volScale",4095);
|
||||||
ImGui::Text("Initial channel limit:");
|
ImGui::Text("Initial channel limit:");
|
||||||
if (CWSliderInt("##OTTO_InitialChannelLimit",&channels,5,32)) {
|
if (CWSliderInt("##OTTO_InitialChannelLimit",&channels,5,32)) {
|
||||||
if (channels<5) channels=5;
|
if (channels<5) channels=5;
|
||||||
|
@ -890,9 +891,18 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
altered=true;
|
altered=true;
|
||||||
} rightClickable
|
} rightClickable
|
||||||
|
|
||||||
|
ImGui::Text("Volume scale:");
|
||||||
|
|
||||||
|
if (CWSliderInt("##VolScaleO",&volScale,0,4095)) {
|
||||||
|
if (volScale<0) volScale=0;
|
||||||
|
if (volScale>4095) volScale=4095;
|
||||||
|
altered=true;
|
||||||
|
} rightClickable
|
||||||
|
|
||||||
if (altered) {
|
if (altered) {
|
||||||
e->lockSave([&]() {
|
e->lockSave([&]() {
|
||||||
flags.set("channels",channels-1);
|
flags.set("channels",channels-1);
|
||||||
|
flags.set("volScale",volScale);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue