aboutsummaryrefslogtreecommitdiff
path: root/libopna/opnaadpcm.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-02-19 17:25:56 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-02-19 17:25:56 +0900
commitd78900cd1497441d7712805b08072e46ee361ff8 (patch)
tree5a696ac5ffa4e6d71992c9329ff5b13ad14cf977 /libopna/opnaadpcm.c
parentbe500d48fbc381273dfdc600898f68df725aa954 (diff)
add opna status display
Diffstat (limited to 'libopna/opnaadpcm.c')
-rw-r--r--libopna/opnaadpcm.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libopna/opnaadpcm.c b/libopna/opnaadpcm.c
index 1157b56..68dbae5 100644
--- a/libopna/opnaadpcm.c
+++ b/libopna/opnaadpcm.c
@@ -185,16 +185,18 @@ void opna_adpcm_mix(struct opna_adpcm *adpcm, int16_t *buf, unsigned samples) {
if (!(adpcm->control1 & C1_START)) return;
for (unsigned i = 0; i < samples; i++) {
adpcm_calc(adpcm);
- int32_t lo = buf[i*2+0];
- int32_t ro = buf[i*2+1];
- if (adpcm->control2 & C2_L) lo += (adpcm->out>>1);
- if (adpcm->control2 & C2_R) ro += (adpcm->out>>1);
- if (lo < INT16_MIN) lo = INT16_MIN;
- if (lo > INT16_MAX) lo = INT16_MAX;
- if (ro < INT16_MIN) ro = INT16_MIN;
- if (ro > INT16_MAX) ro = INT16_MAX;
- buf[i*2+0] = lo;
- buf[i*2+1] = ro;
+ if (!adpcm->masked) {
+ int32_t lo = buf[i*2+0];
+ int32_t ro = buf[i*2+1];
+ if (adpcm->control2 & C2_L) lo += (adpcm->out>>1);
+ if (adpcm->control2 & C2_R) ro += (adpcm->out>>1);
+ if (lo < INT16_MIN) lo = INT16_MIN;
+ if (lo > INT16_MAX) lo = INT16_MAX;
+ if (ro < INT16_MIN) ro = INT16_MIN;
+ if (ro > INT16_MAX) ro = INT16_MAX;
+ buf[i*2+0] = lo;
+ buf[i*2+1] = ro;
+ }
if (!(adpcm->control1 & C1_START)) return;
}
}