diff --git a/src/engine/platform/vera.cpp b/src/engine/platform/vera.cpp index 6d97c9c4e..39560cf00 100644 --- a/src/engine/platform/vera.cpp +++ b/src/engine/platform/vera.cpp @@ -70,10 +70,18 @@ void DivPlatformVERA::acquire(short** buf, size_t len) { if (!isMuted[16]) { // TODO stereo samples once DivSample has a support for it if (chan[16].pcm.depth16) { - tmp_l=s->data16[chan[16].pcm.pos]; + if (chan[16].pcm.possamples) { + tmp_l=s->data16[chan[16].pcm.pos]; + } else { + tmp_l=0; + } tmp_r=tmp_l; } else { - tmp_l=s->data8[chan[16].pcm.pos]; + if (chan[16].pcm.possamples) { + tmp_l=s->data8[chan[16].pcm.pos]; + } else { + tmp_l=0; + } tmp_r=tmp_l; } if (!(chan[16].pan&1)) tmp_l=0; diff --git a/src/engine/platform/vera.h b/src/engine/platform/vera.h index 515e17e56..63a3113c1 100644 --- a/src/engine/platform/vera.h +++ b/src/engine/platform/vera.h @@ -30,13 +30,13 @@ class DivPlatformVERA: public DivDispatch { protected: struct Channel: public SharedChannel { unsigned char pan; - unsigned accum; + unsigned int accum; int noiseval; struct PCMChannel { int sample; - unsigned pos; - unsigned len; + unsigned int pos; + unsigned int len; unsigned char freq; bool depth16; PCMChannel(): sample(-1), pos(0), len(0), freq(0), depth16(false) {}