aboutsummaryrefslogtreecommitdiff
path: root/libopna/opnaadpcm.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-11-23 13:51:14 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-11-23 13:51:14 +0900
commitf774afc5387887f4ce8067502412f5f64899632f (patch)
tree71d588865295f3da64d0ba31ae044d7fc48f64f2 /libopna/opnaadpcm.c
parentdfe585145747ee3d41297367f97d320230df26b3 (diff)
libopna: make levelmeter and oscillo conditional
Diffstat (limited to 'libopna/opnaadpcm.c')
-rw-r--r--libopna/opnaadpcm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libopna/opnaadpcm.c b/libopna/opnaadpcm.c
index 7825c40..4001dc1 100644
--- a/libopna/opnaadpcm.c
+++ b/libopna/opnaadpcm.c
@@ -35,7 +35,9 @@ void opna_adpcm_reset(struct opna_adpcm *adpcm) {
adpcm->prev_acc = 0;
adpcm->adpcmd = 127;
adpcm->out = 0;
+#ifdef LIBOPNA_ENABLE_LEVELDATA
leveldata_init(&adpcm->leveldata);
+#endif
}
static uint32_t addr_conv(const struct opna_adpcm *adpcm, uint16_t a) {
@@ -184,7 +186,9 @@ void opna_adpcm_writereg(struct opna_adpcm *adpcm, unsigned reg, unsigned val) {
void opna_adpcm_mix(struct opna_adpcm *adpcm, int16_t *buf, unsigned samples) {
unsigned level = 0;
if (!adpcm->ram || !(adpcm->control1 & C1_START)) {
+#ifdef LIBOPNA_ENABLE_LEVELDATA
leveldata_update(&adpcm->leveldata, level);
+#endif
return;
}
for (unsigned i = 0; i < samples; i++) {
@@ -208,7 +212,9 @@ void opna_adpcm_mix(struct opna_adpcm *adpcm, int16_t *buf, unsigned samples) {
}
if (!(adpcm->control1 & C1_START)) return;
}
+#ifdef LIBOPNA_ENABLE_LEVELDATA
leveldata_update(&adpcm->leveldata, level);
+#endif
}
void opna_adpcm_set_ram_256k(struct opna_adpcm *adpcm, void *ram) {