Add global volume command

This commit is contained in:
cam900 2024-02-11 17:28:17 +09:00 committed by tildearrow
parent 9d19a1735a
commit 153ceea3bd
3 changed files with 11 additions and 1 deletions

View file

@ -307,6 +307,13 @@ int DivPlatformNDS::dispatch(DivCommand c) {
chan[c.chan].ins=c.value;
}
break;
case DIV_CMD_ADPCMA_GLOBAL_VOLUME: {
if (globalVolume!=(c.value&0x7f)) {
globalVolume=c.value&0x7f;
rWrite32(0x100,0x8000|globalVolume);
}
break;
}
case DIV_CMD_VOLUME:
if (chan[c.chan].vol!=c.value) {
chan[c.chan].vol=c.value;
@ -435,7 +442,8 @@ DivDispatchOscBuffer* DivPlatformNDS::getOscBuffer(int ch) {
void DivPlatformNDS::reset() {
memset(regPool,0,288);
nds.reset();
rWrite32(0x100,0x807f); // enable keyon
globalVolume=0x7f;
rWrite32(0x100,0x8000|globalVolume); // enable keyon
rWrite32(0x104,0x200); // initialize bias
for (int i=0; i<16; i++) {
chan[i]=DivPlatformNDS::Channel();

View file

@ -47,6 +47,7 @@ class DivPlatformNDS: public DivDispatch, public nds_sound_intf {
DivDispatchOscBuffer* oscBuf[16];
bool isMuted[16];
bool isDSi;
int globalVolume;
unsigned int sampleOff[256];
bool sampleLoaded[256];

View file

@ -2031,6 +2031,7 @@ void DivEngine::registerSystems() {
{DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA},
{
{0x12, {DIV_CMD_STD_NOISE_MODE, "12xx: Set duty cycle (pulse: 0 to 7)"}},
{0x1f, {DIV_CMD_ADPCMA_GLOBAL_VOLUME, "1Fxx: Set global volume (0 to 7F)"}},
}
);