From 2da92b0433f7cccca1c9c4fd4bc52f6a8017a12b Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 1 Jun 2022 18:27:06 -0500 Subject: [PATCH] newVolumeScaling, part 4 (final) --- TODO.md | 2 -- src/engine/platform/fds.cpp | 2 +- src/engine/platform/mmc5.cpp | 2 +- src/engine/platform/nes.cpp | 2 +- src/engine/platform/pce.cpp | 2 +- src/engine/platform/saa.cpp | 2 +- src/engine/platform/tia.cpp | 2 +- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index 7c638b0f6..1c6e9a7b3 100644 --- a/TODO.md +++ b/TODO.md @@ -3,8 +3,6 @@ - additional YM2612 features - CSM - MSM6258 pitch and clock select -- the last compat flags - - newVolumeScaling - collapse/expand pattern and song - Game Boy envelope macro/sequence - rewrite the system name detection function anyway diff --git a/src/engine/platform/fds.cpp b/src/engine/platform/fds.cpp index eba371834..fabeeed93 100644 --- a/src/engine/platform/fds.cpp +++ b/src/engine/platform/fds.cpp @@ -139,7 +139,7 @@ void DivPlatformFDS::tick(bool sysTick) { chan[i].std.next(); if (chan[i].std.vol.had) { // ok, why are the volumes like that? - chan[i].outVol=MIN(32,chan[i].std.vol.val)-(32-MIN(32,chan[i].vol)); + chan[i].outVol=VOL_SCALE_LINEAR_BROKEN(chan[i].vol,chan[i].std.vol.val,32); if (chan[i].outVol<0) chan[i].outVol=0; rWrite(0x4080,0x80|chan[i].outVol); } diff --git a/src/engine/platform/mmc5.cpp b/src/engine/platform/mmc5.cpp index 920b9a061..9a35ac8ce 100644 --- a/src/engine/platform/mmc5.cpp +++ b/src/engine/platform/mmc5.cpp @@ -107,7 +107,7 @@ void DivPlatformMMC5::tick(bool sysTick) { chan[i].std.next(); if (chan[i].std.vol.had) { // ok, why are the volumes like that? - chan[i].outVol=MIN(15,chan[i].std.vol.val)-(15-(chan[i].vol&15)); + chan[i].outVol=VOL_SCALE_LINEAR_BROKEN(chan[i].vol&15,MIN(15,chan[i].std.vol.val),15); if (chan[i].outVol<0) chan[i].outVol=0; rWrite(0x5000+i*4,0x30|chan[i].outVol|((chan[i].duty&3)<<6)); } diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index dfc9108bc..a688a2567 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -230,7 +230,7 @@ void DivPlatformNES::tick(bool sysTick) { chan[i].std.next(); if (chan[i].std.vol.had) { // ok, why are the volumes like that? - chan[i].outVol=MIN(15,chan[i].std.vol.val)-(15-(chan[i].vol&15)); + chan[i].outVol=VOL_SCALE_LINEAR_BROKEN(chan[i].vol&15,MIN(15,chan[i].std.vol.val),15); if (chan[i].outVol<0) chan[i].outVol=0; if (i==2) { // triangle rWrite(0x4000+i*4,(chan[i].outVol==0)?0:255); diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index be104fb91..1816cd072 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -154,7 +154,7 @@ void DivPlatformPCE::tick(bool sysTick) { for (int i=0; i<6; i++) { chan[i].std.next(); if (chan[i].std.vol.had) { - chan[i].outVol=((chan[i].vol&31)*MIN(31,chan[i].std.vol.val))>>5; + chan[i].outVol=VOL_SCALE_LOG(chan[i].vol&31,MIN(31,chan[i].std.vol.val),31); if (chan[i].furnaceDac && chan[i].pcm) { // ignore for now } else { diff --git a/src/engine/platform/saa.cpp b/src/engine/platform/saa.cpp index f6be85090..c3ce14442 100644 --- a/src/engine/platform/saa.cpp +++ b/src/engine/platform/saa.cpp @@ -136,7 +136,7 @@ void DivPlatformSAA1099::tick(bool sysTick) { for (int i=0; i<6; i++) { chan[i].std.next(); if (chan[i].std.vol.had) { - chan[i].outVol=MIN(15,chan[i].std.vol.val)-(15-(chan[i].vol&15)); + chan[i].outVol=VOL_SCALE_LINEAR_BROKEN(chan[i].vol&15,MIN(15,chan[i].std.vol.val),15); if (chan[i].outVol<0) chan[i].outVol=0; if (isMuted[i]) { rWrite(i,0); diff --git a/src/engine/platform/tia.cpp b/src/engine/platform/tia.cpp index 7a4407ebd..60e064b5a 100644 --- a/src/engine/platform/tia.cpp +++ b/src/engine/platform/tia.cpp @@ -88,7 +88,7 @@ void DivPlatformTIA::tick(bool sysTick) { for (int i=0; i<2; i++) { chan[i].std.next(); if (chan[i].std.vol.had) { - chan[i].outVol=MIN(15,chan[i].std.vol.val)-(15-(chan[i].vol&15)); + chan[i].outVol=VOL_SCALE_LINEAR_BROKEN(chan[i].vol&15,MIN(15,chan[i].std.vol.val),15); if (chan[i].outVol<0) chan[i].outVol=0; if (isMuted[i]) { rWrite(0x19+i,0);