diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index e165fa165..19202e2ed 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -698,7 +698,7 @@ bool DivEngine::init() { blip_set_rates(bb[1],dispatch->rate,got.rate); for (int i=0; idispatch(DivCommand(DIV_CMD_GET_VOLMAX,i))<<8; + chan[i].volMax=(dispatch->dispatch(DivCommand(DIV_CMD_GET_VOLMAX,i))<<8)|0xff; chan[i].volume=chan[i].volMax; } diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 62b972a63..520f19cec 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -348,10 +348,11 @@ void DivEngine::nextTick() { chan[i].volume+=chan[i].volSpeed; if (chan[i].volume>chan[i].volMax) { chan[i].volume=chan[i].volMax; + chan[i].volSpeed=0; dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8)); } else if (chan[i].volume<0) { chan[i].volSpeed=0; - chan[i].volume=chan[i].volMax+0x100; + chan[i].volume=chan[i].volMax+1; dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8)); } else { dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));