diff options
author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-02-19 17:25:56 +0900 |
---|---|---|
committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-02-19 17:25:56 +0900 |
commit | d78900cd1497441d7712805b08072e46ee361ff8 (patch) | |
tree | 5a696ac5ffa4e6d71992c9329ff5b13ad14cf977 /libopna/opnadrum.c | |
parent | be500d48fbc381273dfdc600898f68df725aa954 (diff) |
add opna status display
Diffstat (limited to 'libopna/opnadrum.c')
-rw-r--r-- | libopna/opnadrum.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libopna/opnadrum.c b/libopna/opnadrum.c index 2527c1a..1a298af 100644 --- a/libopna/opnadrum.c +++ b/libopna/opnadrum.c @@ -25,6 +25,7 @@ void opna_drum_reset(struct opna_drum *drum) { drum->drums[d].right = false; } drum->total_level = 0; + drum->mask = 0; } void opna_drum_set_rom(struct opna_drum *drum, void *romptr) { @@ -90,8 +91,10 @@ void opna_drum_mix(struct opna_drum *drum, int16_t *buf, int samples) { unsigned level = (drum->drums[d].level^0x1f) + (drum->total_level^0x3f); co *= 15 - (level&7); co >>= 1+(level>>3); - if (drum->drums[d].left) lo += co; - if (drum->drums[d].right) ro += co; + if (!(drum->mask & (1u << d))) { + if (drum->drums[d].left) lo += co; + if (drum->drums[d].right) ro += co; + } drum->drums[d].index++; if (drum->drums[d].index == drum->drums[d].len) { drum->drums[d].index = 0; |