From f774afc5387887f4ce8067502412f5f64899632f Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Thu, 23 Nov 2017 13:51:14 +0900 Subject: libopna: make levelmeter and oscillo conditional --- libopna/opna.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'libopna/opna.c') diff --git a/libopna/opna.c b/libopna/opna.c index 9f87ff3..8998a59 100644 --- a/libopna/opna.c +++ b/libopna/opna.c @@ -1,5 +1,7 @@ #include "opna.h" +#ifdef LIBOPNA_ENABLE_OSCILLO #include "oscillo/oscillo.h" +#endif #include void opna_reset(struct opna *opna) { @@ -30,6 +32,7 @@ void opna_mix(struct opna *opna, int16_t *buf, unsigned samples) { } void opna_mix_oscillo(struct opna *opna, int16_t *buf, unsigned samples, struct oscillodata *oscillo) { +#ifdef LIBOPNA_ENABLE_OSCILLO if (oscillo) { for (int i = 0; i < LIBOPNA_OSCILLO_TRACK_COUNT; i++) { memmove(&oscillo[i].buf[0], @@ -38,9 +41,15 @@ void opna_mix_oscillo(struct opna *opna, int16_t *buf, unsigned samples, struct } } unsigned offset = OSCILLO_SAMPLE_COUNT - samples; - opna_fm_mix(&opna->fm, buf, samples, oscillo ? &oscillo[0] : 0, offset); + struct oscillodata *oscillofm = oscillo ? &oscillo[0] : 0; + struct oscillodata *oscillossg = oscillo ? &oscillo[6] : 0; +#else + struct oscillodata *oscillofm = 0, *oscillossg = 0; + unsigned offset = 0; +#endif + opna_fm_mix(&opna->fm, buf, samples, oscillofm, offset); opna_ssg_mix_55466(&opna->ssg, &opna->resampler, buf, samples, - oscillo ? &oscillo[6] : 0, offset); + oscillossg, offset); opna_drum_mix(&opna->drum, buf, samples); opna_adpcm_mix(&opna->adpcm, buf, samples); opna->generated_frames += samples; -- cgit v1.2.3