From 6884494b5c4565ee6c03bfdf55fae8f17243b502 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 17 Jan 2022 16:23:47 -0500 Subject: [PATCH] fix issue with volume macro+slide --- src/engine/platform/amiga.cpp | 2 +- src/engine/platform/ay.cpp | 2 +- src/engine/platform/ay8930.cpp | 2 +- src/engine/platform/nes.cpp | 2 +- src/engine/platform/pce.cpp | 2 +- src/engine/platform/saa.cpp | 2 +- src/engine/platform/sms.cpp | 2 +- src/engine/platform/tia.cpp | 2 +- src/engine/platform/ym2610.cpp | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/engine/platform/amiga.cpp b/src/engine/platform/amiga.cpp index 7900e682f..6cc6ddd36 100644 --- a/src/engine/platform/amiga.cpp +++ b/src/engine/platform/amiga.cpp @@ -49,7 +49,7 @@ void DivPlatformAmiga::tick() { for (int i=0; i<4; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=(chan[i].vol*chan[i].std.vol)>>6; + chan[i].outVol=((chan[i].vol%65)*chan[i].std.vol)>>6; } if (chan[i].std.hadArp) { if (!chan[i].inPorta) { diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index 6e98ffbbb..d309bf877 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -34,7 +34,7 @@ void DivPlatformAY8910::tick() { for (int i=0; i<3; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=chan[i].std.vol-(15-chan[i].vol); + chan[i].outVol=chan[i].std.vol-(15-(chan[i].vol&15)); if (chan[i].outVol<0) chan[i].outVol=0; if (isMuted[i]) { rWrite(0x08+i,0); diff --git a/src/engine/platform/ay8930.cpp b/src/engine/platform/ay8930.cpp index 35c8852fd..a1e254d23 100644 --- a/src/engine/platform/ay8930.cpp +++ b/src/engine/platform/ay8930.cpp @@ -55,7 +55,7 @@ void DivPlatformAY8930::tick() { for (int i=0; i<3; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=chan[i].std.vol-(31-chan[i].vol); + chan[i].outVol=chan[i].std.vol-(31-(chan[i].vol&31)); if (chan[i].outVol<0) chan[i].outVol=0; if (isMuted[i]) { rWrite(0x08+i,0); diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index 0b9a186b0..5a37ce1df 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -68,7 +68,7 @@ void DivPlatformNES::tick() { chan[i].std.next(); if (chan[i].std.hadVol) { // ok, why are the volumes like that? - chan[i].outVol=chan[i].std.vol-(15-chan[i].vol); + chan[i].outVol=chan[i].std.vol-(15-(chan[i].vol&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 3bcb3479b..36dfb654b 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -88,7 +88,7 @@ void DivPlatformPCE::tick() { for (int i=0; i<6; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=(chan[i].vol*chan[i].std.vol)>>5; + chan[i].outVol=((chan[i].vol&31)*chan[i].std.vol)>>5; chWrite(i,0x04,0x80|chan[i].outVol); } if (chan[i].std.hadArp) { diff --git a/src/engine/platform/saa.cpp b/src/engine/platform/saa.cpp index 89ea5f7b9..60a639ff1 100644 --- a/src/engine/platform/saa.cpp +++ b/src/engine/platform/saa.cpp @@ -37,7 +37,7 @@ void DivPlatformSAA1099::tick() { for (int i=0; i<6; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=chan[i].std.vol-(15-chan[i].vol); + chan[i].outVol=chan[i].std.vol-(15-(chan[i].vol&15)); if (chan[i].outVol<0) chan[i].outVol=0; if (isMuted[i]) { rWrite(i,0); diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index 022ca99b2..515ce769e 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -20,7 +20,7 @@ void DivPlatformSMS::tick() { for (int i=0; i<4; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=(chan[i].vol*chan[i].std.vol)>>4; + chan[i].outVol=((chan[i].vol&15)*chan[i].std.vol)>>4; rWrite(0x90|(i<<5)|(isMuted[i]?15:(15-(chan[i].outVol&15)))); } if (chan[i].std.hadArp) { diff --git a/src/engine/platform/tia.cpp b/src/engine/platform/tia.cpp index c2ca4aaea..ca448c8fe 100644 --- a/src/engine/platform/tia.cpp +++ b/src/engine/platform/tia.cpp @@ -45,7 +45,7 @@ void DivPlatformTIA::tick() { for (int i=0; i<2; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=chan[i].std.vol-(15-chan[i].vol); + chan[i].outVol=chan[i].std.vol-(15-(chan[i].vol&15)); if (chan[i].outVol<0) chan[i].outVol=0; if (isMuted[i]) { rWrite(0x19+i,0); diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index ab311e72e..90326fc59 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -44,7 +44,7 @@ void DivPlatformYM2610::tick() { for (int i=4; i<7; i++) { chan[i].std.next(); if (chan[i].std.hadVol) { - chan[i].outVol=chan[i].std.vol-(15-chan[i].vol); + chan[i].outVol=chan[i].std.vol-(15-(chan[i].vol&15)); if (chan[i].outVol<0) chan[i].outVol=0; if (isMuted[i]) { rWrite(0x04+i,0);