Change to int

This commit is contained in:
cam900 2023-02-12 14:45:29 +09:00
parent a1d83e869d
commit 799d54106f
2 changed files with 10 additions and 10 deletions

View File

@ -191,7 +191,7 @@ void DivPlatformES5506::tick(bool sysTick) {
signed int k1=chan[i].k1Prev,k2=chan[i].k2Prev; signed int k1=chan[i].k1Prev,k2=chan[i].k2Prev;
// volume/panning macros // volume/panning macros
if (chan[i].std.vol.had) { if (chan[i].std.vol.had) {
const unsigned int nextVol=VOL_SCALE_LOG(VOL_CALC(chan[i].vol),(0xffff*(unsigned int)chan[i].std.vol.val)/chan[i].volMacroMax,0xffff); const int nextVol=VOL_SCALE_LOG(VOL_CALC(chan[i].vol),(0xffff*(unsigned int)chan[i].std.vol.val)/chan[i].volMacroMax,0xffff);
if (chan[i].outVol!=nextVol) { if (chan[i].outVol!=nextVol) {
chan[i].outVol=nextVol; chan[i].outVol=nextVol;
chan[i].volChanged.lVol=1; chan[i].volChanged.lVol=1;
@ -199,14 +199,14 @@ void DivPlatformES5506::tick(bool sysTick) {
} }
} }
if (chan[i].std.panL.had) { if (chan[i].std.panL.had) {
const unsigned int nextLVol=VOL_SCALE_LOG(VOL_CALC(chan[i].lVol),(0xffff*(unsigned int)chan[i].std.panL.val)/chan[i].panMacroMax,0xffff); const int nextLVol=VOL_SCALE_LOG(VOL_CALC(chan[i].lVol),(0xffff*(unsigned int)chan[i].std.panL.val)/chan[i].panMacroMax,0xffff);
if (chan[i].outLVol!=nextLVol) { if (chan[i].outLVol!=nextLVol) {
chan[i].outLVol=nextLVol; chan[i].outLVol=nextLVol;
chan[i].volChanged.lVol=1; chan[i].volChanged.lVol=1;
} }
} }
if (chan[i].std.panR.had) { if (chan[i].std.panR.had) {
const unsigned int nextRVol=VOL_SCALE_LOG(VOL_CALC(chan[i].rVol),(0xffff*(unsigned int)chan[i].std.panR.val)/chan[i].panMacroMax,0xffff); const int nextRVol=VOL_SCALE_LOG(VOL_CALC(chan[i].rVol),(0xffff*(unsigned int)chan[i].std.panR.val)/chan[i].panMacroMax,0xffff);
if (chan[i].outRVol!=nextRVol) { if (chan[i].outRVol!=nextRVol) {
chan[i].outRVol=nextRVol; chan[i].outRVol=nextRVol;
chan[i].volChanged.rVol=1; chan[i].volChanged.rVol=1;
@ -799,7 +799,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
} }
break; break;
case DIV_CMD_VOLUME: case DIV_CMD_VOLUME:
if (chan[c.chan].vol!=(unsigned int)(c.value)) { if (chan[c.chan].vol!=c.value) {
chan[c.chan].vol=c.value; chan[c.chan].vol=c.value;
if (!chan[c.chan].std.vol.has) { if (!chan[c.chan].std.vol.has) {
chan[c.chan].outVol=VOL_CALC(chan[c.chan].vol); chan[c.chan].outVol=VOL_CALC(chan[c.chan].vol);
@ -819,7 +819,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
chan[c.chan].volChanged.ca=1; chan[c.chan].volChanged.ca=1;
} }
// Left volume // Left volume
if (chan[c.chan].lVol!=(unsigned int)(c.value)) { if (chan[c.chan].lVol!=c.value) {
chan[c.chan].lVol=c.value; chan[c.chan].lVol=c.value;
if (!chan[c.chan].std.panL.has) { if (!chan[c.chan].std.panL.has) {
chan[c.chan].outLVol=VOL_CALC(c.value); chan[c.chan].outLVol=VOL_CALC(c.value);
@ -827,7 +827,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
} }
} }
// Right volume // Right volume
if (chan[c.chan].rVol!=(unsigned int)(c.value2)) { if (chan[c.chan].rVol!=c.value2) {
chan[c.chan].rVol=c.value2; chan[c.chan].rVol=c.value2;
if (!chan[c.chan].std.panR.has) { if (!chan[c.chan].std.panR.has) {
chan[c.chan].outRVol=VOL_CALC(c.value2); chan[c.chan].outRVol=VOL_CALC(c.value2);
@ -844,7 +844,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
} }
if ((c.value&1)==0) { if ((c.value&1)==0) {
// Left volume // Left volume
if (chan[c.chan].lVol!=(unsigned int)(c.value2)) { if (chan[c.chan].lVol!=c.value2) {
chan[c.chan].lVol=c.value2; chan[c.chan].lVol=c.value2;
if (!chan[c.chan].std.panL.has) { if (!chan[c.chan].std.panL.has) {
chan[c.chan].outLVol=VOL_CALC(c.value2); chan[c.chan].outLVol=VOL_CALC(c.value2);
@ -854,7 +854,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
} }
else if ((c.value&1)==1) { else if ((c.value&1)==1) {
// Right volume // Right volume
if (chan[c.chan].rVol!=(unsigned int)(c.value2)) { if (chan[c.chan].rVol!=c.value2) {
chan[c.chan].rVol=c.value2; chan[c.chan].rVol=c.value2;
if (!chan[c.chan].std.panR.has) { if (!chan[c.chan].std.panR.has) {
chan[c.chan].outRVol=VOL_CALC(c.value2); chan[c.chan].outRVol=VOL_CALC(c.value2);

View File

@ -28,7 +28,7 @@
#include "vgsound_emu/src/es550x/es5506.hpp" #include "vgsound_emu/src/es550x/es5506.hpp"
class DivPlatformES5506: public DivDispatch, public es550x_intf { class DivPlatformES5506: public DivDispatch, public es550x_intf {
struct Channel : public SharedChannel<unsigned int> { struct Channel : public SharedChannel<int> {
struct PCM { struct PCM {
bool isNoteMap; bool isNoteMap;
int index, next; int index, next;
@ -184,7 +184,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
DivInstrumentES5506::Filter filter; DivInstrumentES5506::Filter filter;
DivInstrumentES5506::Envelope envelope; DivInstrumentES5506::Envelope envelope;
Channel(): Channel():
SharedChannel<unsigned int>(0xff), SharedChannel<int>(0xff),
pcm(PCM()), pcm(PCM()),
nextFreq(0), nextFreq(0),
nextNote(0), nextNote(0),