VERA: fix possible PCM crash
This commit is contained in:
parent
dff445fa41
commit
a7be3e9514
|
@ -70,10 +70,18 @@ void DivPlatformVERA::acquire(short** buf, size_t len) {
|
||||||
if (!isMuted[16]) {
|
if (!isMuted[16]) {
|
||||||
// TODO stereo samples once DivSample has a support for it
|
// TODO stereo samples once DivSample has a support for it
|
||||||
if (chan[16].pcm.depth16) {
|
if (chan[16].pcm.depth16) {
|
||||||
tmp_l=s->data16[chan[16].pcm.pos];
|
if (chan[16].pcm.pos<s->samples) {
|
||||||
|
tmp_l=s->data16[chan[16].pcm.pos];
|
||||||
|
} else {
|
||||||
|
tmp_l=0;
|
||||||
|
}
|
||||||
tmp_r=tmp_l;
|
tmp_r=tmp_l;
|
||||||
} else {
|
} else {
|
||||||
tmp_l=s->data8[chan[16].pcm.pos];
|
if (chan[16].pcm.pos<s->samples) {
|
||||||
|
tmp_l=s->data8[chan[16].pcm.pos];
|
||||||
|
} else {
|
||||||
|
tmp_l=0;
|
||||||
|
}
|
||||||
tmp_r=tmp_l;
|
tmp_r=tmp_l;
|
||||||
}
|
}
|
||||||
if (!(chan[16].pan&1)) tmp_l=0;
|
if (!(chan[16].pan&1)) tmp_l=0;
|
||||||
|
|
|
@ -30,13 +30,13 @@ class DivPlatformVERA: public DivDispatch {
|
||||||
protected:
|
protected:
|
||||||
struct Channel: public SharedChannel<int> {
|
struct Channel: public SharedChannel<int> {
|
||||||
unsigned char pan;
|
unsigned char pan;
|
||||||
unsigned accum;
|
unsigned int accum;
|
||||||
int noiseval;
|
int noiseval;
|
||||||
|
|
||||||
struct PCMChannel {
|
struct PCMChannel {
|
||||||
int sample;
|
int sample;
|
||||||
unsigned pos;
|
unsigned int pos;
|
||||||
unsigned len;
|
unsigned int len;
|
||||||
unsigned char freq;
|
unsigned char freq;
|
||||||
bool depth16;
|
bool depth16;
|
||||||
PCMChannel(): sample(-1), pos(0), len(0), freq(0), depth16(false) {}
|
PCMChannel(): sample(-1), pos(0), len(0), freq(0), depth16(false) {}
|
||||||
|
|
Loading…
Reference in a new issue